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.ntp; | 5 package org.chromium.chrome.browser.ntp; |
6 | 6 |
7 import android.test.suitebuilder.annotation.LargeTest; | 7 import android.support.test.filters.LargeTest; |
8 import android.test.suitebuilder.annotation.MediumTest; | 8 import android.support.test.filters.MediumTest; |
9 import android.test.suitebuilder.annotation.Smoke; | |
10 | 9 |
11 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
12 import org.chromium.base.test.util.RetryOnFailure; | 11 import org.chromium.base.test.util.RetryOnFailure; |
13 import org.chromium.chrome.browser.UrlConstants; | 12 import org.chromium.chrome.browser.UrlConstants; |
14 import org.chromium.chrome.browser.tab.Tab; | 13 import org.chromium.chrome.browser.tab.Tab; |
15 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; | 14 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; |
16 import org.chromium.net.test.EmbeddedTestServer; | 15 import org.chromium.net.test.EmbeddedTestServer; |
17 | 16 |
18 /** | 17 /** |
19 * Tests loading the NTP and navigating between it and other pages. | 18 * Tests loading the NTP and navigating between it and other pages. |
(...skipping 11 matching lines...) Expand all Loading... |
31 | 30 |
32 @Override | 31 @Override |
33 protected void tearDown() throws Exception { | 32 protected void tearDown() throws Exception { |
34 mTestServer.stopAndDestroyServer(); | 33 mTestServer.stopAndDestroyServer(); |
35 super.tearDown(); | 34 super.tearDown(); |
36 } | 35 } |
37 | 36 |
38 /** | 37 /** |
39 * Sanity check that we do start on the NTP by default. | 38 * Sanity check that we do start on the NTP by default. |
40 */ | 39 */ |
41 @Smoke | |
42 @MediumTest | 40 @MediumTest |
43 @Feature({"NewTabPage", "Main"}) | 41 @Feature({"NewTabPage", "Main"}) |
44 public void testNTPIsDefault() { | 42 public void testNTPIsDefault() { |
45 Tab tab = getActivity().getActivityTab(); | 43 Tab tab = getActivity().getActivityTab(); |
46 assertNotNull(tab); | 44 assertNotNull(tab); |
47 String url = tab.getUrl(); | 45 String url = tab.getUrl(); |
48 assertTrue("Unexpected url: " + url, | 46 assertTrue("Unexpected url: " + url, |
49 url.startsWith("chrome-native://newtab/") | 47 url.startsWith("chrome-native://newtab/") |
50 || url.startsWith("chrome-native://bookmarks/") | 48 || url.startsWith("chrome-native://bookmarks/") |
51 || url.startsWith("chrome-native://recent-tabs/")); | 49 || url.startsWith("chrome-native://recent-tabs/")); |
(...skipping 30 matching lines...) Expand all Loading... |
82 assertNotNull(tab.getNativePage() instanceof NewTabPage); | 80 assertNotNull(tab.getNativePage() instanceof NewTabPage); |
83 } | 81 } |
84 | 82 |
85 @Override | 83 @Override |
86 public void startMainActivity() throws InterruptedException { | 84 public void startMainActivity() throws InterruptedException { |
87 // Passing null below starts the activity on its default page, which is
the NTP on a clean | 85 // Passing null below starts the activity on its default page, which is
the NTP on a clean |
88 // profile. | 86 // profile. |
89 startMainActivityWithURL(null); | 87 startMainActivityWithURL(null); |
90 } | 88 } |
91 } | 89 } |
OLD | NEW |