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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/appmenu/MenuTest.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.appmenu;
6
7 import android.test.suitebuilder.annotation.SmallTest;
8 import android.view.KeyEvent;
9
10 import org.chromium.base.test.util.Feature;
11 import org.chromium.base.test.util.UrlUtils;
12 import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
13 import org.chromium.chrome.test.util.ChromeTabUtils;
14 import org.chromium.content.browser.test.util.Criteria;
15 import org.chromium.content.browser.test.util.CriteriaHelper;
16
17 /**
18 * Application Menu tests.
19 */
20 public class MenuTest extends ChromeTabbedActivityTestBase {
21 private static final String TEST_URL = UrlUtils.encodeHtmlDataUri("<html>poi t.</html>");
22
23 @Override
24 protected void setUp() throws Exception {
25 super.setUp();
26 // Make sure the popup menu gets created, then add our observer to it.
27 assertTrue(CriteriaHelper.pollForCriteria(new Criteria() {
28 @Override
29 public boolean isSatisfied() {
30 if (getActivity().getAppMenuHandler().isAppMenuShowing()) return true;
31 pressKey(KeyEvent.KEYCODE_MENU);
32 return false;
33 }
34 }));
35 }
36
37 /**
38 * Verify opening a new tab from the menu.
39 */
40 @SmallTest
41 @Feature({"Browser", "Main"})
42 public void testMenuNewTab() throws InterruptedException {
43 final int tabCountBefore = getActivity().getCurrentTabModel().getCount() ;
44 ChromeTabUtils.newTabFromMenu(getInstrumentation(), getActivity());
45 final int tabCountAfter = getActivity().getCurrentTabModel().getCount();
46 assertTrue("Expected: " + (tabCountBefore + 1) + " Got: " + tabCountAfte r,
47 tabCountBefore + 1 == tabCountAfter);
48 }
49
50 private void pressKey(int keycode) {
51 getInstrumentation().sendKeyDownUpSync(keycode);
52 getInstrumentation().waitForIdleSync();
53 }
54
55 @Override
56 public void startMainActivity() throws InterruptedException {
57 startMainActivityWithURL(TEST_URL);
58 }
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698