OLD | NEW |
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" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "net/base/net_util.h" |
15 #include "content/public/browser/dom_operation_notification_details.h" | 16 #include "content/public/browser/dom_operation_notification_details.h" |
16 #include "content/public/browser/notification_types.h" | 17 #include "content/public/browser/notification_types.h" |
17 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
19 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
20 #include "content/public/browser/web_contents_view.h" | 21 #include "content/public/browser/web_contents_view.h" |
21 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
22 #include "net/test/python_utils.h" | 23 #include "net/test/python_utils.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 140 |
140 if (alt) | 141 if (alt) |
141 event->modifiers |= WebKit::WebInputEvent::AltKey; | 142 event->modifiers |= WebKit::WebInputEvent::AltKey; |
142 | 143 |
143 if (command) | 144 if (command) |
144 event->modifiers |= WebKit::WebInputEvent::MetaKey; | 145 event->modifiers |= WebKit::WebInputEvent::MetaKey; |
145 } | 146 } |
146 | 147 |
147 } // namespace | 148 } // namespace |
148 | 149 |
| 150 |
| 151 GURL GetFileUrlWithQuery(const FilePath& path, |
| 152 const std::string& query_string) { |
| 153 GURL url = net::FilePathToFileURL(path); |
| 154 if (!query_string.empty()) { |
| 155 GURL::Replacements replacements; |
| 156 replacements.SetQueryStr(query_string); |
| 157 return url.ReplaceComponents(replacements); |
| 158 } |
| 159 return url; |
| 160 } |
| 161 |
149 void SimulateMouseClick(WebContents* web_contents) { | 162 void SimulateMouseClick(WebContents* web_contents) { |
150 int x = web_contents->GetView()->GetContainerSize().width() / 2; | 163 int x = web_contents->GetView()->GetContainerSize().width() / 2; |
151 int y = web_contents->GetView()->GetContainerSize().height() / 2; | 164 int y = web_contents->GetView()->GetContainerSize().height() / 2; |
152 WebKit::WebMouseEvent mouse_event; | 165 WebKit::WebMouseEvent mouse_event; |
153 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 166 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
154 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 167 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; |
155 mouse_event.x = x; | 168 mouse_event.x = x; |
156 mouse_event.y = y; | 169 mouse_event.y = y; |
157 // Mac needs globalX/globalY for events to plugins. | 170 // Mac needs globalX/globalY for events to plugins. |
158 gfx::Rect offset; | 171 gfx::Rect offset; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 base::LaunchProcess(*cmd_line.get(), options, NULL); | 467 base::LaunchProcess(*cmd_line.get(), options, NULL); |
455 | 468 |
456 #if defined(OS_POSIX) | 469 #if defined(OS_POSIX) |
457 // Just to make sure that the server process terminates certainly. | 470 // Just to make sure that the server process terminates certainly. |
458 if (process_group_id_ != base::kNullProcessHandle) | 471 if (process_group_id_ != base::kNullProcessHandle) |
459 base::KillProcessGroup(process_group_id_); | 472 base::KillProcessGroup(process_group_id_); |
460 #endif | 473 #endif |
461 } | 474 } |
462 | 475 |
463 } // namespace content | 476 } // namespace content |
OLD | NEW |