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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabWindowManagerTest.java

Issue 2123863004: ScreenCapture for Android phase1, part II (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 3 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
« no previous file with comments | « chrome/android/java/strings/android_chrome_strings.grd ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabWindowManagerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabWindowManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabWindowManagerTest.java
index 6d810ea7eec96828fe7395f5c035dc906d88c4d8..4cbe1485994712be154b1f7cd0023bf73ff410ef 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabWindowManagerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabWindowManagerTest.java
@@ -255,7 +255,8 @@ public class TabWindowManagerTest extends InstrumentationTestCase {
AsyncTabParamsManager.getAsyncTabParams().clear();
final int asyncTabId = 123;
- final TabReparentingParams dummyParams = new TabReparentingParams(null, null, null, false);
+ final TabReparentingParams dummyParams =
+ new TabReparentingParams(new Tab(0, false, null), null, null, false);
assertFalse(manager.tabExistsInAnySelector(asyncTabId));
AsyncTabParamsManager.add(asyncTabId, dummyParams);
try {
@@ -264,4 +265,38 @@ public class TabWindowManagerTest extends InstrumentationTestCase {
AsyncTabParamsManager.getAsyncTabParams().clear();
}
}
+
+ /**
+ * Tests that getTabById() functions properly.
+ */
+ @SmallTest
+ @Feature({"Multiwindow"})
+ @UiThreadTest
+ public void testGetTabById() {
+ final TabWindowManager manager = TabWindowManager.getInstance();
+
+ ChromeActivity activity0 = buildActivity();
+ ChromeActivity activity1 = buildActivity();
+ MockTabModelSelector selector0 = requestSelector(activity0, 0);
+ MockTabModelSelector selector1 = requestSelector(activity1, 1);
+ Tab tab1 = selector0.addMockTab();
+ Tab tab2 = selector1.addMockIncognitoTab();
+
+ assertNull(manager.getTabById(tab1.getId() - 1));
+ assertNotNull(manager.getTabById(tab1.getId()));
+ assertNotNull(manager.getTabById(tab2.getId()));
+ assertNull(manager.getTabById(tab2.getId() + 1));
+
+ AsyncTabParamsManager.getAsyncTabParams().clear();
+ final int asyncTabId = 123;
+ final TabReparentingParams dummyParams =
+ new TabReparentingParams(new Tab(0, false, null), null, null, false);
+ assertNull(manager.getTabById(asyncTabId));
+ AsyncTabParamsManager.add(asyncTabId, dummyParams);
+ try {
+ assertNotNull(manager.getTabById(asyncTabId));
+ } finally {
+ AsyncTabParamsManager.getAsyncTabParams().clear();
+ }
+ }
}
« no previous file with comments | « chrome/android/java/strings/android_chrome_strings.grd ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698