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

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

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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_NON_LOW_E ND_DEVICE; 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE;
8 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE; 8 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_PHONE;
9 9
10 import android.content.DialogInterface; 10 import android.content.DialogInterface;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 126 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
127 public void testSpawnPopupOnBackgroundTab() throws InterruptedException, Tim eoutException { 127 public void testSpawnPopupOnBackgroundTab() throws InterruptedException, Tim eoutException {
128 loadUrl(UrlUtils.getIsolatedTestFileUrl(TEST_FILE_PATH)); 128 loadUrl(UrlUtils.getIsolatedTestFileUrl(TEST_FILE_PATH));
129 final Tab tab = getActivity().getActivityTab(); 129 final Tab tab = getActivity().getActivityTab();
130 130
131 newIncognitoTabFromMenu(); 131 newIncognitoTabFromMenu();
132 132
133 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 133 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
134 @Override 134 @Override
135 public void run() { 135 public void run() {
136 tab.getWebContents().evaluateJavaScriptForTests( 136 tab.getWebContents().evaluateJavaScript(
137 "(function() {" 137 "(function() {"
138 + " window.open('www.google.com');" 138 + " window.open('www.google.com');"
139 + "})()", 139 + "})()",
140 null); 140 null);
141 } 141 }
142 }); 142 });
143 143
144 assertTrue("Tab never spawned in normal model.", 144 assertTrue("Tab never spawned in normal model.",
145 CriteriaHelper.pollForUIThreadCriteria(new Criteria() { 145 CriteriaHelper.pollForUIThreadCriteria(new Criteria() {
146 @Override 146 @Override
147 public boolean isSatisfied() { 147 public boolean isSatisfied() {
148 return getActivity().getTabModelSelector().getModel(fals e).getCount() == 2; 148 return getActivity().getTabModelSelector().getModel(fals e).getCount() == 2;
149 } 149 }
150 })); 150 }));
151 } 151 }
152 152
153 @MediumTest 153 @MediumTest
154 public void testAlertDialogDoesNotChangeActiveModel() throws InterruptedExce ption { 154 public void testAlertDialogDoesNotChangeActiveModel() throws InterruptedExce ption {
155 newIncognitoTabFromMenu(); 155 newIncognitoTabFromMenu();
156 loadUrl(UrlUtils.getIsolatedTestFileUrl(TEST_FILE_PATH)); 156 loadUrl(UrlUtils.getIsolatedTestFileUrl(TEST_FILE_PATH));
157 final Tab tab = getActivity().getActivityTab(); 157 final Tab tab = getActivity().getActivityTab();
158 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 158 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
159 @Override 159 @Override
160 public void run() { 160 public void run() {
161 tab.getWebContents().evaluateJavaScriptForTests( 161 tab.getWebContents().evaluateJavaScript(
162 "(function() {" 162 "(function() {"
163 + " alert('hi');" 163 + " alert('hi');"
164 + "})()", 164 + "})()",
165 null); 165 null);
166 } 166 }
167 }); 167 });
168 168
169 final AtomicReference<JavascriptAppModalDialog> dialog = 169 final AtomicReference<JavascriptAppModalDialog> dialog =
170 new AtomicReference<JavascriptAppModalDialog>(); 170 new AtomicReference<JavascriptAppModalDialog>();
171 171
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 || getName().equals("testTabsAreDestroyedOnModelDestruction")) { 1655 || getName().equals("testTabsAreDestroyedOnModelDestruction")) {
1656 return; 1656 return;
1657 } 1657 }
1658 1658
1659 if (getName().equals("testSpawnPopupOnBackgroundTab")) { 1659 if (getName().equals("testSpawnPopupOnBackgroundTab")) {
1660 CommandLine.getInstance().appendSwitch(ContentSwitches.DISABLE_POPUP _BLOCKING); 1660 CommandLine.getInstance().appendSwitch(ContentSwitches.DISABLE_POPUP _BLOCKING);
1661 } 1661 }
1662 startMainActivityFromLauncher(); 1662 startMainActivityFromLauncher();
1663 } 1663 }
1664 } 1664 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698