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

Side by Side Diff: chrome/browser/browser_browsertest.cc

Issue 560030: Refactored out JS specific part of modal dialog stack into its own class, exp... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/app_modal_dialog_win.cc ('k') | chrome/browser/cookie_modal_dialog.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <string> 5 #include <string>
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "chrome/app/chrome_dll_resource.h" 9 #include "chrome/app/chrome_dll_resource.h"
10 #include "chrome/browser/app_modal_dialog.h" 10 #include "chrome/browser/app_modal_dialog.h"
11 #include "chrome/browser/browser.h" 11 #include "chrome/browser/browser.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/defaults.h" 13 #include "chrome/browser/defaults.h"
14 #include "chrome/browser/extensions/extension_browsertest.h" 14 #include "chrome/browser/extensions/extension_browsertest.h"
15 #include "chrome/browser/extensions/extensions_service.h" 15 #include "chrome/browser/extensions/extensions_service.h"
16 #include "chrome/browser/js_modal_dialog.h"
16 #include "chrome/browser/profile.h" 17 #include "chrome/browser/profile.h"
17 #include "chrome/browser/renderer_host/render_process_host.h" 18 #include "chrome/browser/renderer_host/render_process_host.h"
18 #include "chrome/browser/tab_contents/tab_contents.h" 19 #include "chrome/browser/tab_contents/tab_contents.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/extensions/extension.h" 21 #include "chrome/common/extensions/extension.h"
21 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
22 #include "chrome/common/page_transition_types.h" 23 #include "chrome/common/page_transition_types.h"
23 #include "chrome/test/in_process_browser_test.h" 24 #include "chrome/test/in_process_browser_test.h"
24 #include "chrome/test/ui_test_utils.h" 25 #include "chrome/test/ui_test_utils.h"
25 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 254
254 // Close the new window with JavaScript, which should show a single 255 // Close the new window with JavaScript, which should show a single
255 // beforeunload dialog. Then show another alert, to make it easy to verify 256 // beforeunload dialog. Then show another alert, to make it easy to verify
256 // that a second beforeunload dialog isn't shown. 257 // that a second beforeunload dialog isn't shown.
257 browser()->GetTabContentsAt(0)->render_view_host()-> 258 browser()->GetTabContentsAt(0)->render_view_host()->
258 ExecuteJavascriptInWebFrame(L"", L"w.close(); alert('bar');"); 259 ExecuteJavascriptInWebFrame(L"", L"w.close(); alert('bar');");
259 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 260 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
260 alert->AcceptWindow(); 261 alert->AcceptWindow();
261 262
262 alert = ui_test_utils::WaitForAppModalDialog(); 263 alert = ui_test_utils::WaitForAppModalDialog();
263 EXPECT_FALSE(alert->is_before_unload_dialog()); 264 EXPECT_FALSE(static_cast<JavaScriptAppModalDialog*>(alert)->
265 is_before_unload_dialog());
264 alert->AcceptWindow(); 266 alert->AcceptWindow();
265 } 267 }
266 268
267 // Test that get_process_idle_time() returns reasonable values when compared 269 // Test that get_process_idle_time() returns reasonable values when compared
268 // with time deltas measured locally. 270 // with time deltas measured locally.
269 IN_PROC_BROWSER_TEST_F(BrowserTest, RenderIdleTime) { 271 IN_PROC_BROWSER_TEST_F(BrowserTest, RenderIdleTime) {
270 base::TimeTicks start = base::TimeTicks::Now(); 272 base::TimeTicks start = base::TimeTicks::Now();
271 ui_test_utils::NavigateToURL(browser(), 273 ui_test_utils::NavigateToURL(browser(),
272 ui_test_utils::GetTestUrl(L".", L"title1.html")); 274 ui_test_utils::GetTestUrl(L".", L"title1.html"));
273 RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); 275 RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 // Now navigate to a page in French. 414 // Now navigate to a page in French.
413 ui_test_utils::NavigateToURL( 415 ui_test_utils::NavigateToURL(
414 browser(), GURL(server->TestServerPage("files/french_page.html"))); 416 browser(), GURL(server->TestServerPage("files/french_page.html")));
415 entry = current_tab->controller().GetActiveEntry(); 417 entry = current_tab->controller().GetActiveEntry();
416 ASSERT_TRUE(NULL != entry); 418 ASSERT_TRUE(NULL != entry);
417 EXPECT_TRUE(entry->language().empty()); 419 EXPECT_TRUE(entry->language().empty());
418 lang = ui_test_utils::WaitForLanguageDetection(current_tab); 420 lang = ui_test_utils::WaitForLanguageDetection(current_tab);
419 EXPECT_EQ("fr", lang); 421 EXPECT_EQ("fr", lang);
420 EXPECT_EQ("fr", entry->language()); 422 EXPECT_EQ("fr", entry->language());
421 } 423 }
OLDNEW
« no previous file with comments | « chrome/browser/app_modal_dialog_win.cc ('k') | chrome/browser/cookie_modal_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698