| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_TABLET; | 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_TABLET; |
| 8 | 8 |
| 9 import android.test.FlakyTest; | 9 import android.test.FlakyTest; |
| 10 import android.test.suitebuilder.annotation.MediumTest; | 10 import android.test.suitebuilder.annotation.MediumTest; |
| 11 import android.test.suitebuilder.annotation.Smoke; | 11 import android.test.suitebuilder.annotation.Smoke; |
| 12 import android.text.TextUtils; | 12 import android.text.TextUtils; |
| 13 import android.view.KeyEvent; | 13 import android.view.KeyEvent; |
| 14 | 14 |
| 15 import org.chromium.base.ThreadUtils; | 15 import org.chromium.base.ThreadUtils; |
| 16 import org.chromium.base.test.util.DisabledTest; | 16 import org.chromium.base.test.util.DisableIf; |
| 17 import org.chromium.base.test.util.Feature; | 17 import org.chromium.base.test.util.Feature; |
| 18 import org.chromium.base.test.util.Restriction; | 18 import org.chromium.base.test.util.Restriction; |
| 19 import org.chromium.base.test.util.UrlUtils; | 19 import org.chromium.base.test.util.UrlUtils; |
| 20 import org.chromium.chrome.R; | 20 import org.chromium.chrome.R; |
| 21 import org.chromium.chrome.browser.omnibox.LocationBarLayout; | 21 import org.chromium.chrome.browser.omnibox.LocationBarLayout; |
| 22 import org.chromium.chrome.browser.omnibox.UrlBar; | 22 import org.chromium.chrome.browser.omnibox.UrlBar; |
| 23 import org.chromium.chrome.browser.tab.EmptyTabObserver; | 23 import org.chromium.chrome.browser.tab.EmptyTabObserver; |
| 24 import org.chromium.chrome.browser.tab.Tab; | 24 import org.chromium.chrome.browser.tab.Tab; |
| 25 import org.chromium.chrome.browser.tab.TabObserver; | 25 import org.chromium.chrome.browser.tab.TabObserver; |
| 26 import org.chromium.chrome.browser.tabmodel.TabModel; | 26 import org.chromium.chrome.browser.tabmodel.TabModel; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 urls[1], getActivity().getActivityTab().getUrl()); | 348 urls[1], getActivity().getActivityTab().getUrl()); |
| 349 | 349 |
| 350 singleClickView(getActivity().findViewById(R.id.forward_button)); | 350 singleClickView(getActivity().findViewById(R.id.forward_button)); |
| 351 UiUtils.settleDownUI(getInstrumentation()); | 351 UiUtils.settleDownUI(getInstrumentation()); |
| 352 assertEquals(String.format(Locale.US, | 352 assertEquals(String.format(Locale.US, |
| 353 "URL mismatch after pressing fwd button for the 2nd time in
repetition %d.", i), | 353 "URL mismatch after pressing fwd button for the 2nd time in
repetition %d.", i), |
| 354 urls[2], getActivity().getActivityTab().getUrl()); | 354 urls[2], getActivity().getActivityTab().getUrl()); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 | 357 |
| 358 @DisabledTest // Fails on android-one: crbug.com/540723 | 358 @DisableIf.Build( |
| 359 hardware_is = "sprout", |
| 360 message = "fails on android-one: crbug.com/540723") |
| 359 @MediumTest | 361 @MediumTest |
| 360 @Feature({"Navigation"}) | 362 @Feature({"Navigation"}) |
| 361 public void testWindowOpenUrlSpoof() throws Exception { | 363 public void testWindowOpenUrlSpoof() throws Exception { |
| 362 TestWebServer webServer = TestWebServer.start(); | 364 TestWebServer webServer = TestWebServer.start(); |
| 363 try { | 365 try { |
| 364 // Make sure that we start with one tab. | 366 // Make sure that we start with one tab. |
| 365 final TabModel model = getActivity().getTabModelSelector().getModel(
false); | 367 final TabModel model = getActivity().getTabModelSelector().getModel(
false); |
| 366 | 368 |
| 367 final Semaphore urlServedSemaphore = new Semaphore(0); | 369 final Semaphore urlServedSemaphore = new Semaphore(0); |
| 368 Runnable checkAction = new Runnable() { | 370 Runnable checkAction = new Runnable() { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 assert false : "Unexpected TimeoutException"; | 455 assert false : "Unexpected TimeoutException"; |
| 454 } | 456 } |
| 455 return null; | 457 return null; |
| 456 } | 458 } |
| 457 | 459 |
| 458 @Override | 460 @Override |
| 459 public void startMainActivity() throws InterruptedException { | 461 public void startMainActivity() throws InterruptedException { |
| 460 startMainActivityFromLauncher(); | 462 startMainActivityFromLauncher(); |
| 461 } | 463 } |
| 462 } | 464 } |
| OLD | NEW |