Changeset 249746 in webkit


Ignore:
Timestamp:
Sep 10, 2019 5:35:19 PM (5 years ago)
Author:
Chris Dumez
Message:

Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/cookies/private-cookie-storage.html
https://bugs.webkit.org/show_bug.cgi?id=201648

Reviewed by Alex Christensen.

Use testRunner.setShouldSwapToEphemeralSessionOnNextNavigation() / setShouldSwapToDefaultSessionOnNextNavigation() to
truly switch session on WebKit2 instead of using the testRunner.setPrivateBrowsingEnabled_DEPRECATED() hack.

  • http/tests/cookies/private-cookie-storage-expected.txt:
  • http/tests/cookies/private-cookie-storage.html:
  • http/tests/cookies/resources/cookies-test-pre.js:

(testCookies):

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249744 r249746  
     12019-09-10  Chris Dumez  <cdumez@apple.com>
     2
     3        Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/cookies/private-cookie-storage.html
     4        https://bugs.webkit.org/show_bug.cgi?id=201648
     5
     6        Reviewed by Alex Christensen.
     7
     8        Use testRunner.setShouldSwapToEphemeralSessionOnNextNavigation() / setShouldSwapToDefaultSessionOnNextNavigation() to
     9        truly switch session on WebKit2 instead of using the testRunner.setPrivateBrowsingEnabled_DEPRECATED() hack.
     10
     11        * http/tests/cookies/private-cookie-storage-expected.txt:
     12        * http/tests/cookies/private-cookie-storage.html:
     13        * http/tests/cookies/resources/cookies-test-pre.js:
     14        (testCookies):
     15
    1162019-09-10  Ryan Haddad  <ryanhaddad@apple.com>
    217
  • trunk/LayoutTests/http/tests/cookies/private-cookie-storage-expected.txt

    r197720 r249746  
    44
    55
    6 Cookies before setting (should be empty):
    7 Cookies before enabling private browsing (should be key1=value1):key1=value1
    8 PASS cookie is 'key1=value1'.
    9 Cookies after enabling private browsing (should be empty):
    10 PASS cookie is ''.
    11 Cookies after setting in private browsing (should be key2=value2):key2=value2
    12 PASS cookie is 'key2=value2'.
    136Cookies after disabling private browsing (should be key1=value1):key1=value1
    147PASS cookie is 'key1=value1'.
  • trunk/LayoutTests/http/tests/cookies/private-cookie-storage.html

    r249542 r249746  
    22<script>
    33description("This test checks that cookies set from a Set-Cookie header in private browsing mode are stored in the same cookie storage as cookies set with document.cookie.");
     4jsTestIsAsync = true;
    45
    5 debug("Cookies before setting (should be empty):" + document.cookie);
     6function runTest() {
     7    if (window.location.search === "?stepTwo") {
     8        debug("Cookies after enabling private browsing (should be empty): " + document.cookie);
     9        if (!testCookies("")) { // We're using a different cookie storage now.  key1=value1 is still in the default cookie storage.
     10            finishJSTest();
     11            return;
     12        }
     13        document.cookie = "key2=value2";
     14        debug("Cookies after setting in private browsing (should be key2=value2):" + document.cookie);
     15        if (!testCookies("key2=value2")) {
     16            finishJSTest();
     17            return;
     18        }
     19        clearCookies();
    620
    7 document.cookie = "key1=value1";
    8 debug("Cookies before enabling private browsing (should be key1=value1):" + document.cookie);
    9 testCookies("key1=value1");
     21        if (window.testRunner)
     22            testRunner.setShouldSwapToDefaultSessionOnNextNavigation(true);
     23        window.location = "/cookies/private-cookie-storage.html?stepThree";
     24    } else if (window.location.search === "?stepThree") {
     25        debug("Cookies after disabling private browsing (should be key1=value1):" + document.cookie);
     26        testCookies("key1=value1");
     27        finishJSTest();
     28    } else {
     29        debug("Cookies before setting (should be empty):" + document.cookie);
    1030
    11 if (window.testRunner) { testRunner.setPrivateBrowsingEnabled_DEPRECATED(true); }
     31        document.cookie = "key1=value1";
     32        debug("Cookies before enabling private browsing (should be key1=value1):" + document.cookie);
     33        if (!testCookies("key1=value1")) {
     34            finishJSTest();
     35            return;
     36        }
     37   
     38        if (window.testRunner)
     39            testRunner.setShouldSwapToEphemeralSessionOnNextNavigation(true);
     40        window.location = "/cookies/private-cookie-storage.html?stepTwo";
     41    }
     42}
    1243
    13 debug("Cookies after enabling private browsing (should be empty):" + document.cookie);
    14 testCookies(""); // We're using a different cookie storage now.  key1=value1 is still in the default cookie storage.
    15 document.cookie = "key2=value2";
    16 debug("Cookies after setting in private browsing (should be key2=value2):" + document.cookie);
    17 testCookies("key2=value2");
    18 clearCookies();
    19 
    20 if (window.testRunner) { testRunner.setPrivateBrowsingEnabled_DEPRECATED(false); }
    21 
    22 debug("Cookies after disabling private browsing (should be key1=value1):" + document.cookie);
    23 testCookies("key1=value1");
    24 
     44onload = runTest;
    2545</script>
    2646<script src="resources/cookies-test-post.js"></script>
  • trunk/LayoutTests/http/tests/cookies/resources/cookies-test-pre.js

    r174190 r249746  
    4848    cookie = normalizeCookie(cookie);
    4949   
    50     if (cookie === result)
     50    if (cookie === result) {
    5151        testPassed("cookie is '" + cookie + "'.");
    52     else
     52        return true;
     53    } else {
    5354        testFailed("cookie was '" + cookie + "'. Expected '" + result + "'.");
     55        return false;
     56    }
    5457}
    5558
  • trunk/Tools/DumpRenderTree/PlatformWin.cmake

    r245968 r249746  
    77    win/DRTDesktopNotificationPresenter.cpp
    88    win/DRTDropSource.cpp
     9    win/DefaultPolicyDelegate.cpp
    910    win/DumpRenderTree.cpp
    1011    win/EditingDelegate.cpp
  • trunk/Tools/DumpRenderTree/TestRunner.cpp

    r249675 r249746  
    25682568        ASSERT(m_shouldSwapToEphemeralSessionOnNextNavigation != m_shouldSwapToDefaultSessionOnNextNavigation);
    25692569        setPrivateBrowsingEnabled(m_shouldSwapToEphemeralSessionOnNextNavigation);
     2570        m_shouldSwapToEphemeralSessionOnNextNavigation = false;
     2571        m_shouldSwapToDefaultSessionOnNextNavigation = false;
    25702572    }
    25712573}
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r249571 r249746  
    3030#include "DumpRenderTree.h"
    3131
     32#include "DefaultPolicyDelegate.h"
    3233#include "EditingDelegate.h"
    3334#include "FrameLoadDelegate.h"
     
    996997    }
    997998
    998     webView->setPolicyDelegate(nullptr);
     999    webView->setPolicyDelegate(DefaultPolicyDelegate::sharedInstance());
    9991000    policyDelegate->setPermissive(false);
    10001001    policyDelegate->setControllerToNotifyDone(nullptr);
Note: See TracChangeset for help on using the changeset viewer.