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

Side by Side Diff: content/shell/shell_javascript_dialog_creator.cc

Issue 10832412: [content shell] create a central WebKitTestController object that manages the test cycle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « content/shell/shell_browser_main.cc ('k') | content/shell/webkit_test_runner_host.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/shell/shell_javascript_dialog_creator.h" 5 #include "content/shell/shell_javascript_dialog_creator.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #endif 80 #endif
81 } 81 }
82 82
83 void ShellJavaScriptDialogCreator::RunBeforeUnloadDialog( 83 void ShellJavaScriptDialogCreator::RunBeforeUnloadDialog(
84 WebContents* web_contents, 84 WebContents* web_contents,
85 const string16& message_text, 85 const string16& message_text,
86 bool is_reload, 86 bool is_reload,
87 const DialogClosedCallback& callback) { 87 const DialogClosedCallback& callback) {
88 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) { 88 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) {
89 printf("CONFIRM NAVIGATION: %s\n", UTF16ToUTF8(message_text).c_str()); 89 printf("CONFIRM NAVIGATION: %s\n", UTF16ToUTF8(message_text).c_str());
90 WebKitTestRunnerHost* controller = 90 WebKitTestController* controller = WebKitTestController::Get();
91 WebKitTestRunnerHost::FromRenderViewHost(
92 web_contents->GetRenderViewHost());
93 callback.Run( 91 callback.Run(
94 !controller->should_stay_on_page_after_handling_before_unload(), 92 !controller->should_stay_on_page_after_handling_before_unload(),
95 string16()); 93 string16());
96 return; 94 return;
97 } 95 }
98 96
99 if (!dialog_request_callback_.is_null()) { 97 if (!dialog_request_callback_.is_null()) {
100 dialog_request_callback_.Run(); 98 dialog_request_callback_.Run();
101 callback.Run(true, string16()); 99 callback.Run(true, string16());
102 dialog_request_callback_.Reset(); 100 dialog_request_callback_.Reset();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void ShellJavaScriptDialogCreator::DialogClosed(ShellJavaScriptDialog* dialog) { 143 void ShellJavaScriptDialogCreator::DialogClosed(ShellJavaScriptDialog* dialog) {
146 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK) 144 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(TOOLKIT_GTK)
147 DCHECK_EQ(dialog, dialog_.get()); 145 DCHECK_EQ(dialog, dialog_.get());
148 dialog_.reset(); 146 dialog_.reset();
149 #else 147 #else
150 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if 148 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if
151 #endif 149 #endif
152 } 150 }
153 151
154 } // namespace content 152 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_browser_main.cc ('k') | content/shell/webkit_test_runner_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698