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

Side by Side Diff: content/test/browser_test_utils.cc

Issue 10823029: Move WaitForLoadStop from ui_test_utils to browser_test_utils so that it can be reused in content_b… (Closed) Base URL: svn://chrome-svn/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/public/test/browser_test_utils.h ('k') | no next file » | 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/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 const std::string& query_string) { 152 const std::string& query_string) {
153 GURL url = net::FilePathToFileURL(path); 153 GURL url = net::FilePathToFileURL(path);
154 if (!query_string.empty()) { 154 if (!query_string.empty()) {
155 GURL::Replacements replacements; 155 GURL::Replacements replacements;
156 replacements.SetQueryStr(query_string); 156 replacements.SetQueryStr(query_string);
157 return url.ReplaceComponents(replacements); 157 return url.ReplaceComponents(replacements);
158 } 158 }
159 return url; 159 return url;
160 } 160 }
161 161
162 void WaitForLoadStop(WebContents* web_contents) {
163 WindowedNotificationObserver load_stop_observer(
164 NOTIFICATION_LOAD_STOP,
165 Source<NavigationController>(&web_contents->GetController()));
166 // In many cases, the load may have finished before we get here. Only wait if
167 // the tab still has a pending navigation.
168 if (!web_contents->IsLoading())
169 return;
170 load_stop_observer.Wait();
171 }
172
173
162 void SimulateMouseClick(WebContents* web_contents) { 174 void SimulateMouseClick(WebContents* web_contents) {
163 int x = web_contents->GetView()->GetContainerSize().width() / 2; 175 int x = web_contents->GetView()->GetContainerSize().width() / 2;
164 int y = web_contents->GetView()->GetContainerSize().height() / 2; 176 int y = web_contents->GetView()->GetContainerSize().height() / 2;
165 WebKit::WebMouseEvent mouse_event; 177 WebKit::WebMouseEvent mouse_event;
166 mouse_event.type = WebKit::WebInputEvent::MouseDown; 178 mouse_event.type = WebKit::WebInputEvent::MouseDown;
167 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; 179 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
168 mouse_event.x = x; 180 mouse_event.x = x;
169 mouse_event.y = y; 181 mouse_event.y = y;
170 // Mac needs globalX/globalY for events to plugins. 182 // Mac needs globalX/globalY for events to plugins.
171 gfx::Rect offset; 183 gfx::Rect offset;
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 base::LaunchProcess(*cmd_line.get(), options, NULL); 479 base::LaunchProcess(*cmd_line.get(), options, NULL);
468 480
469 #if defined(OS_POSIX) 481 #if defined(OS_POSIX)
470 // Just to make sure that the server process terminates certainly. 482 // Just to make sure that the server process terminates certainly.
471 if (process_group_id_ != base::kNullProcessHandle) 483 if (process_group_id_ != base::kNullProcessHandle)
472 base::KillProcessGroup(process_group_id_); 484 base::KillProcessGroup(process_group_id_);
473 #endif 485 #endif
474 } 486 }
475 487
476 } // namespace content 488 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698