Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java

Issue 2933623002: Create AwJUnit4ClassRunner AwActivityTestRule and convert AwContentsTest (Closed)
Patch Set: address bo's comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java
index f094c9acb31ea230b739dea88ed18d28bf226335..d9405ab53f05cdd7b6c606de5925e3dd427cb15f 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java
@@ -114,13 +114,12 @@ public class CookieManagerTest extends AwTestBase {
private void setCookieWithJavaScript(final String name, final String value)
throws Throwable {
- JSUtils.executeJavaScriptAndWaitForResult(
- this, mAwContents,
+ JSUtils.executeJavaScriptAndWaitForResult(getInstrumentation(), mAwContents,
mContentsClient.getOnEvaluateJavaScriptResultHelper(),
"var expirationDate = new Date();"
- + "expirationDate.setDate(expirationDate.getDate() + 5);"
- + "document.cookie='" + name + "=" + value
- + "; expires=' + expirationDate.toUTCString();");
+ + "expirationDate.setDate(expirationDate.getDate() + 5);"
+ + "document.cookie='" + name + "=" + value
+ + "; expires=' + expirationDate.toUTCString();");
}
@MediumTest
@@ -366,15 +365,14 @@ public class CookieManagerTest extends AwTestBase {
@MediumTest
@Feature({"AndroidWebView", "Privacy"})
public void testThirdPartyCookie() throws Throwable {
- // In theory we need two servers to test this, one server ('the first party') which returns
- // a response with a link to a second server ('the third party') at different origin. This
- // second server attempts to set a cookie which should fail if AcceptThirdPartyCookie() is
- // false.
- // Strictly according to the letter of RFC6454 it should be possible to set this situation
- // up with two TestServers on different ports (these count as having different origins) but
- // Chrome is not strict about this and does not check the port. Instead we cheat making some
- // of the urls come from localhost and some from 127.0.0.1 which count (both in theory and
- // pratice) as having different origins.
+ // In theory we need two servers to test this, one server ('the first
+ // party') which returns a response with a link to a second server ('the third party') at
+ // different origin. This second server attempts to set a cookie which should fail if
+ // AcceptThirdPartyCookie() is false. Strictly according to the letter of RFC6454 it should
+ // be possible to set this situation up with two TestServers on different ports (these count
+ // as having different origins) but Chrome is not strict about this and does not check the
+ // port. Instead we cheat making some of the urls come from localhost and some from
+ // 127.0.0.1 which count (both in theory and pratice) as having different origins.
TestWebServer webServer = TestWebServer.start();
try {
// Turn global allow on.

Powered by Google App Engine
This is Rietveld 408576698