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

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

Issue 481803004: Removing ContentViewCore dependencies from few functions which acts as direct wrapper to WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments and rebased the patch. Created 6 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.test; 5 package org.chromium.chrome.browser.test;
6 6
7 import android.app.AlertDialog; 7 import android.app.AlertDialog;
8 import android.content.DialogInterface; 8 import android.content.DialogInterface;
9 import android.test.suitebuilder.annotation.MediumTest; 9 import android.test.suitebuilder.annotation.MediumTest;
10 import android.util.Log; 10 import android.util.Log;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 loadUrlWithSanitization(BEFORE_UNLOAD_URL); 177 loadUrlWithSanitization(BEFORE_UNLOAD_URL);
178 executeJavaScriptAndWaitForDialog("history.back();"); 178 executeJavaScriptAndWaitForDialog("history.back();");
179 179
180 JavascriptAppModalDialog jsDialog = getCurrentDialog(); 180 JavascriptAppModalDialog jsDialog = getCurrentDialog();
181 assertNotNull("No dialog showing.", jsDialog); 181 assertNotNull("No dialog showing.", jsDialog);
182 checkButtonPresenceVisibilityText( 182 checkButtonPresenceVisibilityText(
183 jsDialog, 0, org.chromium.chrome.R.string.stay_on_this_page, 183 jsDialog, 0, org.chromium.chrome.R.string.stay_on_this_page,
184 "Stay on this page"); 184 "Stay on this page");
185 clickCancel(jsDialog); 185 clickCancel(jsDialog);
186 186
187 assertEquals(BEFORE_UNLOAD_URL, getActivity().getActiveContentViewCore() .getUrl()); 187 assertEquals(BEFORE_UNLOAD_URL, getActivity().getActiveContentViewCore()
188 .getWebContents().getUrl());
188 executeJavaScriptAndWaitForDialog("history.back();"); 189 executeJavaScriptAndWaitForDialog("history.back();");
189 190
190 jsDialog = getCurrentDialog(); 191 jsDialog = getCurrentDialog();
191 assertNotNull("No dialog showing.", jsDialog); 192 assertNotNull("No dialog showing.", jsDialog);
192 checkButtonPresenceVisibilityText( 193 checkButtonPresenceVisibilityText(
193 jsDialog, 2, org.chromium.chrome.R.string.leave_this_page, 194 jsDialog, 2, org.chromium.chrome.R.string.leave_this_page,
194 "Leave this page"); 195 "Leave this page");
195 196
196 final TestCallbackHelperContainer.OnPageFinishedHelper onPageLoaded = 197 final TestCallbackHelperContainer.OnPageFinishedHelper onPageLoaded =
197 getActiveTabTestCallbackHelperContainer().getOnPageFinishedHelpe r(); 198 getActiveTabTestCallbackHelperContainer().getOnPageFinishedHelpe r();
198 int callCount = onPageLoaded.getCallCount(); 199 int callCount = onPageLoaded.getCallCount();
199 clickOk(jsDialog); 200 clickOk(jsDialog);
200 onPageLoaded.waitForCallback(callCount); 201 onPageLoaded.waitForCallback(callCount);
201 assertEquals(EMPTY_PAGE, getActivity().getActiveContentViewCore().getUrl ()); 202 assertEquals(EMPTY_PAGE, getActivity().getActiveContentViewCore()
203 .getWebContents().getUrl());
202 } 204 }
203 205
204 /** 206 /**
205 * Verifies that when showing a beforeunload dialogs as a result of a page 207 * Verifies that when showing a beforeunload dialogs as a result of a page
206 * reload, the correct UI strings are used. 208 * reload, the correct UI strings are used.
207 */ 209 */
208 @MediumTest 210 @MediumTest
209 @Feature({"Browser", "Main"}) 211 @Feature({"Browser", "Main"})
210 public void testBeforeUnloadOnReloadDialog() 212 public void testBeforeUnloadOnReloadDialog()
211 throws InterruptedException, TimeoutException, ExecutionException { 213 throws InterruptedException, TimeoutException, ExecutionException {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 button.getVisibility()); 408 button.getVisibility());
407 assertEquals("'" + readableName + "' button has wrong text", 409 assertEquals("'" + readableName + "' button has wrong text",
408 getActivity().getResources().getString(expectedTextResourceId), 410 getActivity().getResources().getString(expectedTextResourceId),
409 button.getText().toString()); 411 button.getText().toString());
410 } 412 }
411 413
412 private TestCallbackHelperContainer getActiveTabTestCallbackHelperContainer( ) { 414 private TestCallbackHelperContainer getActiveTabTestCallbackHelperContainer( ) {
413 return new TestCallbackHelperContainer(getActivity().getActiveTab().getC ontentViewCore()); 415 return new TestCallbackHelperContainer(getActivity().getActiveTab().getC ontentViewCore());
414 } 416 }
415 } 417 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698