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

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

Issue 1582513003: Add a testing restriction for whether Google Play Services is up-to-date. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 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
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_PHONE;
8
9 import android.test.FlakyTest; 7 import android.test.FlakyTest;
10 import android.test.suitebuilder.annotation.MediumTest; 8 import android.test.suitebuilder.annotation.MediumTest;
11 import android.view.View; 9 import android.view.View;
12 import android.view.View.OnFocusChangeListener; 10 import android.view.View.OnFocusChangeListener;
13 11
14 import org.chromium.base.ThreadUtils; 12 import org.chromium.base.ThreadUtils;
15 import org.chromium.base.test.util.Feature; 13 import org.chromium.base.test.util.Feature;
16 import org.chromium.base.test.util.Restriction;
17 import org.chromium.base.test.util.UrlUtils; 14 import org.chromium.base.test.util.UrlUtils;
18 import org.chromium.chrome.R; 15 import org.chromium.chrome.R;
19 import org.chromium.chrome.browser.compositor.layouts.LayoutManager; 16 import org.chromium.chrome.browser.compositor.layouts.LayoutManager;
20 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeEvent Filter.ScrollDirection; 17 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeEvent Filter.ScrollDirection;
21 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandl er; 18 import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandl er;
22 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; 19 import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
20 import org.chromium.chrome.test.util.ChromeRestriction;
23 import org.chromium.chrome.test.util.ChromeTabUtils; 21 import org.chromium.chrome.test.util.ChromeTabUtils;
24 import org.chromium.chrome.test.util.OverviewModeBehaviorWatcher; 22 import org.chromium.chrome.test.util.OverviewModeBehaviorWatcher;
25 import org.chromium.content.browser.test.util.Criteria; 23 import org.chromium.content.browser.test.util.Criteria;
26 import org.chromium.content.browser.test.util.CriteriaHelper; 24 import org.chromium.content.browser.test.util.CriteriaHelper;
27 import org.chromium.content.browser.test.util.TestTouchUtils; 25 import org.chromium.content.browser.test.util.TestTouchUtils;
28 26
29 import java.util.ArrayDeque; 27 import java.util.ArrayDeque;
30 28
31 /** 29 /**
32 * Test suite for ContentView focus and its interaction with Tab switcher, 30 * Test suite for ContentView focus and its interaction with Tab switcher,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return !mFocusChanges.isEmpty(); 69 return !mFocusChanges.isEmpty();
72 } 70 }
73 } 71 }
74 72
75 /** 73 /**
76 * Verify ContentView loses/gains focus on swiping tab. 74 * Verify ContentView loses/gains focus on swiping tab.
77 * 75 *
78 * @throws Exception 76 * @throws Exception
79 * @MediumTest 77 * @MediumTest
80 * @Feature({"TabContents"}) 78 * @Feature({"TabContents"})
81 * @Restriction(RESTRICTION_TYPE_PHONE) 79 * @ChromeRestriction(RESTRICTION_TYPE_PHONE)
jbudorick 2016/01/25 15:21:37 nit: ChromeRestriction.RESTRICTION_TYPE_PHONE
82 * Bug: http://crbug.com/172473 80 * Bug: http://crbug.com/172473
83 */ 81 */
84 @FlakyTest 82 @FlakyTest
85 public void testHideSelectionOnPhoneTabSwiping() throws Exception { 83 public void testHideSelectionOnPhoneTabSwiping() throws Exception {
86 // Setup 84 // Setup
87 ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 2); 85 ChromeTabUtils.newTabsFromMenu(getInstrumentation(), getActivity(), 2);
88 String url = UrlUtils.getIsolatedTestFileUrl( 86 String url = UrlUtils.getIsolatedTestFileUrl(
89 "chrome/test/data/android/content_view_focus/content_view_focus_ long_text.html"); 87 "chrome/test/data/android/content_view_focus/content_view_focus_ long_text.html");
90 loadUrl(url); 88 loadUrl(url);
91 View view = getActivity().getActivityTab().getContentViewCore().getConta inerView(); 89 View view = getActivity().getActivityTab().getContentViewCore().getConta inerView();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 139 }
142 140
143 /** 141 /**
144 * Verify ContentView loses/gains focus on overview mode. 142 * Verify ContentView loses/gains focus on overview mode.
145 * 143 *
146 * @throws Exception 144 * @throws Exception
147 * @Feature({"TabContents"}) 145 * @Feature({"TabContents"})
148 */ 146 */
149 @MediumTest 147 @MediumTest
150 @Feature({"TabContents"}) 148 @Feature({"TabContents"})
151 @Restriction(RESTRICTION_TYPE_PHONE) 149 @ChromeRestriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
152 public void testHideSelectionOnPhoneTabSwitcher() throws Exception { 150 public void testHideSelectionOnPhoneTabSwitcher() throws Exception {
153 // Setup 151 // Setup
154 OverviewModeBehaviorWatcher showWatcher = new OverviewModeBehaviorWatche r( 152 OverviewModeBehaviorWatcher showWatcher = new OverviewModeBehaviorWatche r(
155 getActivity().getLayoutManager(), true, false); 153 getActivity().getLayoutManager(), true, false);
156 OverviewModeBehaviorWatcher hideWatcher = new OverviewModeBehaviorWatche r( 154 OverviewModeBehaviorWatcher hideWatcher = new OverviewModeBehaviorWatche r(
157 getActivity().getLayoutManager(), false, true); 155 getActivity().getLayoutManager(), false, true);
158 View currentView = getActivity().getActivityTab().getContentViewCore().g etContainerView(); 156 View currentView = getActivity().getActivityTab().getContentViewCore().g etContainerView();
159 addFocusChangedListener(currentView); 157 addFocusChangedListener(currentView);
160 158
161 // Enter the tab switcher 159 // Enter the tab switcher
(...skipping 14 matching lines...) Expand all
176 174
177 assertTrue("Content view didn't regain focus", blockForFocusChanged()); 175 assertTrue("Content view didn't regain focus", blockForFocusChanged());
178 assertFalse("Unexpected focus change", haveFocusChanges()); 176 assertFalse("Unexpected focus change", haveFocusChanges());
179 } 177 }
180 178
181 @Override 179 @Override
182 public void startMainActivity() throws InterruptedException { 180 public void startMainActivity() throws InterruptedException {
183 startMainActivityOnBlankPage(); 181 startMainActivityOnBlankPage();
184 } 182 }
185 } 183 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698