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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistencePolicyTest.java

Issue 2979853002: Reland of customtabs: Remove unnecessary Context plumbing. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.chrome.browser.customtabs; 5 package org.chromium.chrome.browser.customtabs;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.os.AsyncTask; 8 import android.os.AsyncTask;
9 import android.support.test.InstrumentationRegistry; 9 import android.support.test.InstrumentationRegistry;
10 import android.support.test.filters.MediumTest; 10 import android.support.test.filters.MediumTest;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 @RunWith(ChromeJUnit4ClassRunner.class) 59 @RunWith(ChromeJUnit4ClassRunner.class)
60 public class CustomTabTabPersistencePolicyTest { 60 public class CustomTabTabPersistencePolicyTest {
61 private TestTabModelDirectory mMockDirectory; 61 private TestTabModelDirectory mMockDirectory;
62 private AdvancedMockContext mAppContext; 62 private AdvancedMockContext mAppContext;
63 63
64 @Rule 64 @Rule
65 public UiThreadTestRule mRule = new UiThreadTestRule(); 65 public UiThreadTestRule mRule = new UiThreadTestRule();
66 66
67 @Before 67 @Before
68 public void setUp() throws Exception { 68 public void setUp() throws Exception {
69 // CustomTabsConnection needs a true context, not the mock context set b elow.
70 CustomTabsConnection.getInstance();
71
69 mAppContext = new AdvancedMockContext(InstrumentationRegistry.getInstrum entation() 72 mAppContext = new AdvancedMockContext(InstrumentationRegistry.getInstrum entation()
70 .getTargetContext() 73 .getTargetContext()
71 .getApplicationContext()); 74 .getApplicationContext());
72 ContextUtils.initApplicationContextForTests(mAppContext); 75 ContextUtils.initApplicationContextForTests(mAppContext);
73 76
74 mMockDirectory = new TestTabModelDirectory( 77 mMockDirectory = new TestTabModelDirectory(
75 mAppContext, "CustomTabTabPersistencePolicyTest", 78 mAppContext, "CustomTabTabPersistencePolicyTest",
76 CustomTabTabPersistencePolicy.SAVED_STATE_DIRECTORY); 79 CustomTabTabPersistencePolicy.SAVED_STATE_DIRECTORY);
77 TabPersistentStore.setBaseStateDirectoryForTests(mMockDirectory.getBaseD irectory()); 80 TabPersistentStore.setBaseStateDirectoryForTests(mMockDirectory.getBaseD irectory());
78 } 81 }
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 461
459 CustomTabActivity activity = new CustomTabActivity(); 462 CustomTabActivity activity = new CustomTabActivity();
460 ApplicationStatus.onStateChangeForTesting(activity, ActivityState.CREATE D); 463 ApplicationStatus.onStateChangeForTesting(activity, ActivityState.CREATE D);
461 TabModelSelectorImpl selector = new TabModelSelectorImpl( 464 TabModelSelectorImpl selector = new TabModelSelectorImpl(
462 activity, activity, buildTestPersistencePolicy(), false, false); 465 activity, activity, buildTestPersistencePolicy(), false, false);
463 selector.initializeForTesting(normalTabModel, incognitoTabModel); 466 selector.initializeForTesting(normalTabModel, incognitoTabModel);
464 ApplicationStatus.onStateChangeForTesting(activity, ActivityState.DESTRO YED); 467 ApplicationStatus.onStateChangeForTesting(activity, ActivityState.DESTRO YED);
465 return selector; 468 return selector;
466 } 469 }
467 } 470 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698