Index: content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java |
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..008b21d59160e3cb8fc2017a557c4c73b3d2b18c |
--- /dev/null |
+++ b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellShellManagementTest.java |
@@ -0,0 +1,47 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.content_shell_apk; |
+ |
+import android.test.suitebuilder.annotation.SmallTest; |
+ |
+import org.chromium.base.ThreadUtils; |
+import org.chromium.base.test.util.Feature; |
+import org.chromium.base.test.util.UrlUtils; |
+import org.chromium.content_shell.Shell; |
+ |
+/** |
+ * Test suite to verify the behavior of the shell management logic. |
+ */ |
+public class ContentShellShellManagementTest extends ContentShellTestBase { |
+ |
+ private static final String TEST_PAGE_1 = UrlUtils.encodeHtmlDataUri( |
+ "<html><body style='background: red;'></body></html>"); |
+ private static final String TEST_PAGE_2 = UrlUtils.encodeHtmlDataUri( |
+ "<html><body style='background: green;'></body></html>"); |
+ |
+ @SmallTest |
+ @Feature({"Main"}) |
+ public void testMultipleShellsLaunched() throws InterruptedException { |
+ final ContentShellActivity activity = launchContentShellWithUrl(TEST_PAGE_1); |
+ assertEquals(TEST_PAGE_1, activity.getActiveShell().getContentView().getUrl()); |
+ |
+ Shell previousActiveShell = activity.getActiveShell(); |
+ assertFalse(previousActiveShell.isDestroyed()); |
+ |
+ ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
+ @Override |
+ public void run() { |
+ activity.getShellManager().launchShell(TEST_PAGE_2); |
+ } |
+ }); |
+ waitForActiveShellToBeDoneLoading(); |
+ assertEquals(TEST_PAGE_2, activity.getActiveShell().getContentView().getUrl()); |
+ |
+ assertNotSame(previousActiveShell, activity.getActiveShell()); |
+ assertTrue(previousActiveShell.isDestroyed()); |
+ assertFalse(previousActiveShell.getContentView().isAlive()); |
+ } |
+ |
+} |