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

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java

Issue 1935433002: Revert of Unify application context usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.test.suitebuilder.annotation.MediumTest; 8 import android.test.suitebuilder.annotation.MediumTest;
9 import android.test.suitebuilder.annotation.SmallTest; 9 import android.test.suitebuilder.annotation.SmallTest;
10 10
11 import org.chromium.android_webview.AwBrowserProcess; 11 import org.chromium.android_webview.AwBrowserProcess;
12 import org.chromium.android_webview.AwContents; 12 import org.chromium.android_webview.AwContents;
13 import org.chromium.android_webview.AwCookieManager; 13 import org.chromium.android_webview.AwCookieManager;
14 import org.chromium.android_webview.AwWebResourceResponse; 14 import org.chromium.android_webview.AwWebResourceResponse;
15 import org.chromium.android_webview.test.util.CommonResources; 15 import org.chromium.android_webview.test.util.CommonResources;
16 import org.chromium.android_webview.test.util.CookieUtils; 16 import org.chromium.android_webview.test.util.CookieUtils;
17 import org.chromium.base.ContextUtils;
17 import org.chromium.base.test.util.Feature; 18 import org.chromium.base.test.util.Feature;
18 import org.chromium.net.test.util.TestWebServer; 19 import org.chromium.net.test.util.TestWebServer;
19 20
20 21
21 /** 22 /**
22 * Tests for CookieManager/Chromium startup ordering weirdness. 23 * Tests for CookieManager/Chromium startup ordering weirdness.
23 */ 24 */
24 public class CookieManagerStartupTest extends AwTestBase { 25 public class CookieManagerStartupTest extends AwTestBase {
25 26
26 private TestAwContentsClient mContentsClient; 27 private TestAwContentsClient mContentsClient;
27 private AwContents mAwContents; 28 private AwContents mAwContents;
28 29
29 @Override 30 @Override
30 protected void setUp() throws Exception { 31 protected void setUp() throws Exception {
31 super.setUp(); 32 super.setUp();
32 // CookeManager assumes that native is loaded, but webview browser shoul d not be loaded for 33 ContextUtils.initApplicationContext(getActivity().getApplicationContext( ));
33 // these tests as webview is not necessarily loaded when CookieManager i s called.
34 AwBrowserProcess.loadLibrary(
35 getInstrumentation().getTargetContext().getApplicationContext()) ;
36 } 34 }
37 35
38 @Override 36 @Override
39 protected boolean needsBrowserProcessStarted() { 37 protected boolean needsBrowserProcessStarted() {
40 return false; 38 return false;
41 } 39 }
42 40
43 private void startChromium() throws Exception { 41 private void startChromium() throws Exception {
44 startChromiumWithClient(new TestAwContentsClient()); 42 startChromiumWithClient(new TestAwContentsClient());
45 } 43 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 @Override 121 @Override
124 public AwWebResourceResponse shouldInterceptRequest(AwWebResourceReq uest request) { 122 public AwWebResourceResponse shouldInterceptRequest(AwWebResourceReq uest request) {
125 (new AwCookieManager()).getCookie("www.example.com"); 123 (new AwCookieManager()).getCookie("www.example.com");
126 return null; 124 return null;
127 } 125 }
128 }; 126 };
129 startChromiumWithClient(contentsClient); 127 startChromiumWithClient(contentsClient);
130 loadUrlSync(mAwContents, contentsClient.getOnPageFinishedHelper(), url); 128 loadUrlSync(mAwContents, contentsClient.getOnPageFinishedHelper(), url);
131 } 129 }
132 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698