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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/MainActivityWithURLTest.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser;
6
7 import android.test.suitebuilder.annotation.SmallTest;
8
9 import org.chromium.base.test.util.Feature;
10 import org.chromium.chrome.browser.tabmodel.TabModel;
11 import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
12 import org.chromium.chrome.test.util.ChromeTabUtils;
13 import org.chromium.chrome.test.util.TestHttpServerClient;
14
15 /**
16 * Tests starting the activity with URLs.
17 */
18 public class MainActivityWithURLTest extends ChromeTabbedActivityTestBase {
19
20 @Override
21 public void startMainActivity() {
22 // Don't launch activity automatically.
23 }
24
25 /**
26 * Verify launch the activity with URL.
27 */
28 @SmallTest
29 @Feature({"Navigation"})
30 public void testLaunchActivityWithURL() throws Exception {
31 // Launch chrome
32 startMainActivityWithURL(TestHttpServerClient.getUrl(
33 "chrome/test/data/android/simple.html"));
34 String expectedTitle = "Activity test page";
35 TabModel model = getActivity().getCurrentTabModel();
36 String title = model.getTabAt(model.index()).getTitle();
37 assertEquals(expectedTitle, title);
38 }
39
40 /**
41 * Launch and verify URL is neither null nor empty.
42 */
43 @SmallTest
44 @Feature({"Navigation"})
45 public void testLaunchActivity() throws Exception {
46 // Launch chrome
47 startMainActivityFromLauncher();
48 String currentUrl = getActivity().getActivityTab().getUrl();
49 assertNotNull(currentUrl);
50 assertEquals(false, currentUrl.isEmpty());
51 }
52
53 /**
54 * Launch a NTP for most_visited and make sure it loads correctly. This make s sure
55 * NTP loading complete notification is received.
56 */
57 @SmallTest
58 @Feature({"Navigation"})
59 public void testNewTabPageLaunch() throws Exception {
60 // Launch chrome with NTP for most_visited
61 startMainActivityWithURL(UrlConstants.NTP_URL);
62 String currentUrl = getActivity().getActivityTab().getUrl();
63 assertNotNull(currentUrl);
64 assertEquals(false, currentUrl.isEmpty());
65
66 // Open NTP.
67 ChromeTabUtils.newTabFromMenu(getInstrumentation(), getActivity());
68 currentUrl = getActivity().getActivityTab().getUrl();
69 assertNotNull(currentUrl);
70 assertEquals(false, currentUrl.isEmpty());
71 }
72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698