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

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

Issue 1139643006: Rename chrome/android/javatests to javatests_shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java
deleted file mode 100644
index 22e8b3c2c09d9bf15de27d427c49b1335cb30468..0000000000000000000000000000000000000000
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2015 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.chrome.browser;
-
-import android.test.suitebuilder.annotation.SmallTest;
-
-import org.chromium.base.ThreadUtils;
-import org.chromium.base.test.util.Feature;
-import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType;
-import org.chromium.chrome.shell.ChromeShellTestBase;
-import org.chromium.content.browser.test.util.CallbackHelper;
-
-/**
- * Tests for Tab class.
- */
-public class TabTest extends ChromeShellTestBase {
- private Tab mTab;
- private CallbackHelper mOnTitleUpdatedHelper;
-
- private final TabObserver mTabObserver = new EmptyTabObserver() {
- @Override
- public void onTitleUpdated(Tab tab) {
- mOnTitleUpdatedHelper.notifyCalled();
- }
- };
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- launchChromeShellWithBlankPage();
- waitForActiveShellToBeDoneLoading();
- mTab = getActivity().getActiveTab();
- mTab.addObserver(mTabObserver);
- mOnTitleUpdatedHelper = new CallbackHelper();
- }
-
- @SmallTest
- @Feature({"Tab"})
- public void testTitleDelayUpdate() throws Throwable {
- final String oldTitle = "oldTitle";
- final String newTitle = "newTitle";
-
- loadUrl("data:text/html;charset=utf-8,<html><head><title>"
- + oldTitle + "</title></head><body/></html>");
- assertEquals("title does not match initial title", oldTitle, mTab.getTitle());
- int currentCallCount = mOnTitleUpdatedHelper.getCallCount();
- loadUrl("javascript:document.title='" + newTitle + "';");
- mOnTitleUpdatedHelper.waitForCallback(currentCallCount);
- assertEquals("title does not update", newTitle, mTab.getTitle());
- }
-
- @SmallTest
- @Feature({"Tab"})
- public void testTabRestoredIfKilledWhileActivityStopped() {
- launchChromeShellWithBlankPage();
- final Tab tab = getActivity().getActiveTab();
-
- // Ensure the tab is showing before stopping the activity.
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- tab.show(TabSelectionType.FROM_NEW);
- }
- });
-
- assertFalse(tab.needsReload());
- assertFalse(tab.isHidden());
- assertFalse(tab.isShowingSadTab());
-
- // Stop the activity and simulate a killed renderer.
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- getInstrumentation().callActivityOnPause(getActivity());
- getInstrumentation().callActivityOnStop(getActivity());
- tab.simulateRendererKilledForTesting(false);
- }
- });
-
- assertTrue(tab.needsReload());
- assertFalse(tab.isHidden());
- assertFalse(tab.isShowingSadTab());
-
- // Resume the activity.
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
- @Override
- public void run() {
- getInstrumentation().callActivityOnStart(getActivity());
- getInstrumentation().callActivityOnResume(getActivity());
- }
- });
-
- // The tab should be restored and visible.
- assertFalse(tab.isHidden());
- assertFalse(tab.needsReload());
- assertFalse(tab.isShowingSadTab());
- }
-}

Powered by Google App Engine
This is Rietveld 408576698