| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.app.Instrumentation; | 7 import android.app.Instrumentation; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.test.ActivityInstrumentationTestCase2; | 9 import android.test.ActivityInstrumentationTestCase2; |
| 10 | 10 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 @Override | 184 @Override |
| 185 public void run() { | 185 public void run() { |
| 186 awContents.loadUrl(LoadUrlParams.createLoadDataParams( | 186 awContents.loadUrl(LoadUrlParams.createLoadDataParams( |
| 187 data, mimeType, isBase64Encoded)); | 187 data, mimeType, isBase64Encoded)); |
| 188 } | 188 } |
| 189 }); | 189 }); |
| 190 } | 190 } |
| 191 | 191 |
| 192 protected AwTestContainerView createAwTestContainerView( | 192 protected AwTestContainerView createAwTestContainerView( |
| 193 final AwContentsClient awContentsClient) { | 193 final AwContentsClient awContentsClient) { |
| 194 return createAwTestContainerView(new AwTestContainerView(getActivity()), | 194 AwTestContainerView testContainerView = createDetachedAwTestContainerVie
w(awContentsClient); |
| 195 awContentsClient); | |
| 196 } | |
| 197 | |
| 198 protected AwTestContainerView createAwTestContainerView( | |
| 199 final AwTestContainerView testContainerView, | |
| 200 final AwContentsClient awContentsClient) { | |
| 201 testContainerView.initialize(new AwContents( | |
| 202 new AwBrowserContext(new InMemorySharedPreferences()), | |
| 203 testContainerView, testContainerView.getInternalAccessDelegate()
, | |
| 204 awContentsClient, false)); | |
| 205 getActivity().addView(testContainerView); | 195 getActivity().addView(testContainerView); |
| 206 testContainerView.requestFocus(); | 196 testContainerView.requestFocus(); |
| 207 return testContainerView; | 197 return testContainerView; |
| 208 } | 198 } |
| 209 | 199 |
| 200 protected AwTestContainerView createDetachedAwTestContainerView( |
| 201 final AwContentsClient awContentsClient) { |
| 202 final AwTestContainerView testContainerView = new AwTestContainerView(ge
tActivity()); |
| 203 testContainerView.initialize(new AwContents( |
| 204 new AwBrowserContext(new InMemorySharedPreferences()), |
| 205 testContainerView, testContainerView.getInternalAccessDelegate()
, |
| 206 awContentsClient, false)); |
| 207 return testContainerView; |
| 208 } |
| 209 |
| 210 protected AwTestContainerView createAwTestContainerViewOnMainSync( | 210 protected AwTestContainerView createAwTestContainerViewOnMainSync( |
| 211 final AwContentsClient client) throws Exception { | 211 final AwContentsClient client) throws Exception { |
| 212 final AtomicReference<AwTestContainerView> testContainerView = | 212 final AtomicReference<AwTestContainerView> testContainerView = |
| 213 new AtomicReference<AwTestContainerView>(); | 213 new AtomicReference<AwTestContainerView>(); |
| 214 getInstrumentation().runOnMainSync(new Runnable() { | 214 getInstrumentation().runOnMainSync(new Runnable() { |
| 215 @Override | 215 @Override |
| 216 public void run() { | 216 public void run() { |
| 217 testContainerView.set(createAwTestContainerView(client)); | 217 testContainerView.set(createAwTestContainerView(client)); |
| 218 } | 218 } |
| 219 }); | 219 }); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 final AwContents awContents, | 295 final AwContents awContents, |
| 296 final boolean includeDiskFiles) throws Exception { | 296 final boolean includeDiskFiles) throws Exception { |
| 297 getInstrumentation().runOnMainSync(new Runnable() { | 297 getInstrumentation().runOnMainSync(new Runnable() { |
| 298 @Override | 298 @Override |
| 299 public void run() { | 299 public void run() { |
| 300 awContents.clearCache(includeDiskFiles); | 300 awContents.clearCache(includeDiskFiles); |
| 301 } | 301 } |
| 302 }); | 302 }); |
| 303 } | 303 } |
| 304 } | 304 } |
| OLD | NEW |