| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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.infobar; | 5 package org.chromium.chrome.browser.infobar; |
| 6 | 6 |
| 7 import android.support.test.filters.SmallTest; | 7 import android.support.test.filters.SmallTest; |
| 8 | 8 |
| 9 import org.chromium.base.metrics.RecordHistogram; | 9 import org.chromium.base.metrics.RecordHistogram; |
| 10 import org.chromium.base.test.util.CommandLineFlags; | 10 import org.chromium.base.test.util.CommandLineFlags; |
| 11 import org.chromium.base.test.util.Feature; | 11 import org.chromium.base.test.util.Feature; |
| 12 import org.chromium.chrome.browser.ChromeActivity; | 12 import org.chromium.chrome.browser.ChromeActivity; |
| 13 import org.chromium.chrome.browser.SearchGeolocationDisclosureTabHelper; | 13 import org.chromium.chrome.browser.SearchGeolocationDisclosureTabHelper; |
| 14 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 14 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 15 import org.chromium.chrome.test.util.InfoBarTestAnimationListener; | 15 import org.chromium.chrome.test.util.InfoBarTestAnimationListener; |
| 16 import org.chromium.chrome.test.util.InfoBarUtil; | 16 import org.chromium.chrome.test.util.InfoBarUtil; |
| 17 import org.chromium.net.test.EmbeddedTestServer; | 17 import org.chromium.net.test.EmbeddedTestServer; |
| 18 | 18 |
| 19 import java.util.concurrent.TimeoutException; | 19 import java.util.concurrent.TimeoutException; |
| 20 | 20 |
| 21 /** Tests for the SearchGeolocationDisclosureInfobar. */ | 21 /** Tests for the SearchGeolocationDisclosureInfobar. */ |
| 22 public class SearchGeolocationDisclosureInfoBarTest | 22 public class SearchGeolocationDisclosureInfoBarTest |
| 23 extends ChromeActivityTestCaseBase<ChromeActivity> { | 23 extends ChromeActivityTestCaseBase<ChromeActivity> { |
| 24 private static final String SEARCH_PAGE = "/chrome/test/data/empty.html"; | 24 private static final String SEARCH_PAGE = "/chrome/test/data/android/google.
html"; |
| 25 private static final String ENABLE_NEW_DISCLOSURE_FEATURE = | 25 private static final String ENABLE_NEW_DISCLOSURE_FEATURE = |
| 26 "enable-features=ConsistentOmniboxGeolocation"; | 26 "enable-features=ConsistentOmniboxGeolocation"; |
| 27 private static final String DISABLE_NEW_DISCLOSURE_FEATURE = | 27 private static final String DISABLE_NEW_DISCLOSURE_FEATURE = |
| 28 "disable-features=ConsistentOmniboxGeolocation"; | 28 "disable-features=ConsistentOmniboxGeolocation"; |
| 29 | 29 |
| 30 private EmbeddedTestServer mTestServer; | 30 private EmbeddedTestServer mTestServer; |
| 31 | 31 |
| 32 public SearchGeolocationDisclosureInfoBarTest() { | 32 public SearchGeolocationDisclosureInfoBarTest() { |
| 33 super(ChromeActivity.class); | 33 super(ChromeActivity.class); |
| 34 } | 34 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 @CommandLineFlags.Add(DISABLE_NEW_DISCLOSURE_FEATURE) | 174 @CommandLineFlags.Add(DISABLE_NEW_DISCLOSURE_FEATURE) |
| 175 public void testInfoBarAppearsDoesntAppearWithoutFeature() | 175 public void testInfoBarAppearsDoesntAppearWithoutFeature() |
| 176 throws InterruptedException, TimeoutException { | 176 throws InterruptedException, TimeoutException { |
| 177 SearchGeolocationDisclosureTabHelper.setIgnoreUrlChecksForTesting(); | 177 SearchGeolocationDisclosureTabHelper.setIgnoreUrlChecksForTesting(); |
| 178 assertEquals("Wrong starting infobar count", 0, getInfoBars().size()); | 178 assertEquals("Wrong starting infobar count", 0, getInfoBars().size()); |
| 179 | 179 |
| 180 loadUrl(mTestServer.getURL(SEARCH_PAGE)); | 180 loadUrl(mTestServer.getURL(SEARCH_PAGE)); |
| 181 assertEquals("Wrong infobar count after search", 0, getInfoBars().size()
); | 181 assertEquals("Wrong infobar count after search", 0, getInfoBars().size()
); |
| 182 } | 182 } |
| 183 } | 183 } |
| OLD | NEW |