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

Side by Side Diff: content/shell/renderer/layout_test/webkit_test_runner.cc

Issue 677673002: Move LayoutTestMessageFilter-related IPCs to their own message file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-land-cs-show
Patch Set: try including ipc_message_macros.h Created 6 years, 1 month 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
« no previous file with comments | « content/shell/common/shell_messages.h ('k') | ipc/ipc_message_start.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/renderer/layout_test/webkit_test_runner.h" 5 #include "content/shell/renderer/layout_test/webkit_test_runner.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <clocale> 8 #include <clocale>
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 10 matching lines...) Expand all
21 #include "base/strings/sys_string_conversions.h" 21 #include "base/strings/sys_string_conversions.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
25 #include "content/public/common/url_constants.h" 25 #include "content/public/common/url_constants.h"
26 #include "content/public/common/web_preferences.h" 26 #include "content/public/common/web_preferences.h"
27 #include "content/public/renderer/render_view.h" 27 #include "content/public/renderer/render_view.h"
28 #include "content/public/renderer/render_view_visitor.h" 28 #include "content/public/renderer/render_view_visitor.h"
29 #include "content/public/renderer/renderer_gamepad_provider.h" 29 #include "content/public/renderer/renderer_gamepad_provider.h"
30 #include "content/public/test/layouttest_support.h" 30 #include "content/public/test/layouttest_support.h"
31 #include "content/shell/common/layout_test/layout_test_messages.h"
31 #include "content/shell/common/shell_messages.h" 32 #include "content/shell/common/shell_messages.h"
32 #include "content/shell/common/shell_switches.h" 33 #include "content/shell/common/shell_switches.h"
33 #include "content/shell/common/webkit_test_helpers.h" 34 #include "content/shell/common/webkit_test_helpers.h"
34 #include "content/shell/renderer/layout_test/gc_controller.h" 35 #include "content/shell/renderer/layout_test/gc_controller.h"
35 #include "content/shell/renderer/layout_test/layout_test_render_process_observer .h" 36 #include "content/shell/renderer/layout_test/layout_test_render_process_observer .h"
36 #include "content/shell/renderer/layout_test/leak_detector.h" 37 #include "content/shell/renderer/layout_test/leak_detector.h"
37 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" 38 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h"
38 #include "content/shell/renderer/test_runner/web_task.h" 39 #include "content/shell/renderer/test_runner/web_task.h"
39 #include "content/shell/renderer/test_runner/web_test_interfaces.h" 40 #include "content/shell/renderer/test_runner/web_test_interfaces.h"
40 #include "content/shell/renderer/test_runner/web_test_proxy.h" 41 #include "content/shell/renderer/test_runner/web_test_proxy.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 base::Bind(&WebTask::run, base::Owned(task)), 255 base::Bind(&WebTask::run, base::Owned(task)),
255 base::TimeDelta::FromMilliseconds(ms)); 256 base::TimeDelta::FromMilliseconds(ms));
256 } 257 }
257 258
258 WebString WebKitTestRunner::RegisterIsolatedFileSystem( 259 WebString WebKitTestRunner::RegisterIsolatedFileSystem(
259 const blink::WebVector<blink::WebString>& absolute_filenames) { 260 const blink::WebVector<blink::WebString>& absolute_filenames) {
260 std::vector<base::FilePath> files; 261 std::vector<base::FilePath> files;
261 for (size_t i = 0; i < absolute_filenames.size(); ++i) 262 for (size_t i = 0; i < absolute_filenames.size(); ++i)
262 files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i])); 263 files.push_back(base::FilePath::FromUTF16Unsafe(absolute_filenames[i]));
263 std::string filesystem_id; 264 std::string filesystem_id;
264 Send(new ShellViewHostMsg_RegisterIsolatedFileSystem( 265 Send(new LayoutTestHostMsg_RegisterIsolatedFileSystem(
265 routing_id(), files, &filesystem_id)); 266 routing_id(), files, &filesystem_id));
266 return WebString::fromUTF8(filesystem_id); 267 return WebString::fromUTF8(filesystem_id);
267 } 268 }
268 269
269 long long WebKitTestRunner::GetCurrentTimeInMillisecond() { 270 long long WebKitTestRunner::GetCurrentTimeInMillisecond() {
270 return base::TimeDelta(base::Time::Now() - 271 return base::TimeDelta(base::Time::Now() -
271 base::Time::UnixEpoch()).ToInternalValue() / 272 base::Time::UnixEpoch()).ToInternalValue() /
272 base::Time::kMicrosecondsPerMillisecond; 273 base::Time::kMicrosecondsPerMillisecond;
273 } 274 }
274 275
275 WebString WebKitTestRunner::GetAbsoluteWebStringFromUTF8Path( 276 WebString WebKitTestRunner::GetAbsoluteWebStringFromUTF8Path(
276 const std::string& utf8_path) { 277 const std::string& utf8_path) {
277 base::FilePath path = base::FilePath::FromUTF8Unsafe(utf8_path); 278 base::FilePath path = base::FilePath::FromUTF8Unsafe(utf8_path);
278 if (!path.IsAbsolute()) { 279 if (!path.IsAbsolute()) {
279 GURL base_url = 280 GURL base_url =
280 net::FilePathToFileURL(test_config_.current_working_directory.Append( 281 net::FilePathToFileURL(test_config_.current_working_directory.Append(
281 FILE_PATH_LITERAL("foo"))); 282 FILE_PATH_LITERAL("foo")));
282 net::FileURLToFilePath(base_url.Resolve(utf8_path), &path); 283 net::FileURLToFilePath(base_url.Resolve(utf8_path), &path);
283 } 284 }
284 return path.AsUTF16Unsafe(); 285 return path.AsUTF16Unsafe();
285 } 286 }
286 287
287 WebURL WebKitTestRunner::LocalFileToDataURL(const WebURL& file_url) { 288 WebURL WebKitTestRunner::LocalFileToDataURL(const WebURL& file_url) {
288 base::FilePath local_path; 289 base::FilePath local_path;
289 if (!net::FileURLToFilePath(file_url, &local_path)) 290 if (!net::FileURLToFilePath(file_url, &local_path))
290 return WebURL(); 291 return WebURL();
291 292
292 std::string contents; 293 std::string contents;
293 Send(new ShellViewHostMsg_ReadFileToString( 294 Send(new LayoutTestHostMsg_ReadFileToString(
294 routing_id(), local_path, &contents)); 295 routing_id(), local_path, &contents));
295 296
296 std::string contents_base64; 297 std::string contents_base64;
297 base::Base64Encode(contents, &contents_base64); 298 base::Base64Encode(contents, &contents_base64);
298 299
299 const char data_url_prefix[] = "data:text/css:charset=utf-8;base64,"; 300 const char data_url_prefix[] = "data:text/css:charset=utf-8;base64,";
300 return WebURL(GURL(data_url_prefix + contents_base64)); 301 return WebURL(GURL(data_url_prefix + contents_base64));
301 } 302 }
302 303
303 WebURL WebKitTestRunner::RewriteLayoutTestsURL(const std::string& utf8_url) { 304 WebURL WebKitTestRunner::RewriteLayoutTestsURL(const std::string& utf8_url) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 398 }
398 399
399 void WebKitTestRunner::EvaluateInWebInspector(long call_id, 400 void WebKitTestRunner::EvaluateInWebInspector(long call_id,
400 const std::string& script) { 401 const std::string& script) {
401 WebDevToolsAgent* agent = render_view()->GetWebView()->devToolsAgent(); 402 WebDevToolsAgent* agent = render_view()->GetWebView()->devToolsAgent();
402 if (agent) 403 if (agent)
403 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script)); 404 agent->evaluateInWebInspector(call_id, WebString::fromUTF8(script));
404 } 405 }
405 406
406 void WebKitTestRunner::ClearAllDatabases() { 407 void WebKitTestRunner::ClearAllDatabases() {
407 Send(new ShellViewHostMsg_ClearAllDatabases(routing_id())); 408 Send(new LayoutTestHostMsg_ClearAllDatabases(routing_id()));
408 } 409 }
409 410
410 void WebKitTestRunner::SetDatabaseQuota(int quota) { 411 void WebKitTestRunner::SetDatabaseQuota(int quota) {
411 Send(new ShellViewHostMsg_SetDatabaseQuota(routing_id(), quota)); 412 Send(new LayoutTestHostMsg_SetDatabaseQuota(routing_id(), quota));
412 } 413 }
413 414
414 blink::WebNotificationPresenter::Permission 415 blink::WebNotificationPresenter::Permission
415 WebKitTestRunner::CheckWebNotificationPermission(const GURL& origin) { 416 WebKitTestRunner::CheckWebNotificationPermission(const GURL& origin) {
416 int permission = blink::WebNotificationPresenter::PermissionNotAllowed; 417 int permission = blink::WebNotificationPresenter::PermissionNotAllowed;
417 Send(new ShellViewHostMsg_CheckWebNotificationPermission( 418 Send(new LayoutTestHostMsg_CheckWebNotificationPermission(
418 routing_id(), 419 routing_id(),
419 origin, 420 origin,
420 &permission)); 421 &permission));
421 return static_cast<blink::WebNotificationPresenter::Permission>(permission); 422 return static_cast<blink::WebNotificationPresenter::Permission>(permission);
422 } 423 }
423 424
424 void WebKitTestRunner::GrantWebNotificationPermission(const GURL& origin, 425 void WebKitTestRunner::GrantWebNotificationPermission(const GURL& origin,
425 bool permission_granted) { 426 bool permission_granted) {
426 Send(new ShellViewHostMsg_GrantWebNotificationPermission( 427 Send(new LayoutTestHostMsg_GrantWebNotificationPermission(
427 routing_id(), origin, permission_granted)); 428 routing_id(), origin, permission_granted));
428 } 429 }
429 430
430 void WebKitTestRunner::ClearWebNotificationPermissions() { 431 void WebKitTestRunner::ClearWebNotificationPermissions() {
431 Send(new ShellViewHostMsg_ClearWebNotificationPermissions(routing_id())); 432 Send(new LayoutTestHostMsg_ClearWebNotificationPermissions(routing_id()));
432 } 433 }
433 434
434 void WebKitTestRunner::SimulateWebNotificationClick(const std::string& title) { 435 void WebKitTestRunner::SimulateWebNotificationClick(const std::string& title) {
435 Send(new ShellViewHostMsg_SimulateWebNotificationClick(routing_id(), title)); 436 Send(new LayoutTestHostMsg_SimulateWebNotificationClick(routing_id(), title));
436 } 437 }
437 438
438 void WebKitTestRunner::SetDeviceScaleFactor(float factor) { 439 void WebKitTestRunner::SetDeviceScaleFactor(float factor) {
439 content::SetDeviceScaleFactor(render_view(), factor); 440 content::SetDeviceScaleFactor(render_view(), factor);
440 } 441 }
441 442
442 void WebKitTestRunner::SetDeviceColorProfile(const std::string& name) { 443 void WebKitTestRunner::SetDeviceColorProfile(const std::string& name) {
443 content::SetDeviceColorProfile(render_view(), name); 444 content::SetDeviceColorProfile(render_view(), name);
444 } 445 }
445 446
(...skipping 18 matching lines...) Expand all
464 } 465 }
465 } else { 466 } else {
466 if (focused_view_ == visitor.render_view()) { 467 if (focused_view_ == visitor.render_view()) {
467 SetFocusAndActivate(visitor.render_view(), false); 468 SetFocusAndActivate(visitor.render_view(), false);
468 focused_view_ = NULL; 469 focused_view_ = NULL;
469 } 470 }
470 } 471 }
471 } 472 }
472 473
473 void WebKitTestRunner::SetAcceptAllCookies(bool accept) { 474 void WebKitTestRunner::SetAcceptAllCookies(bool accept) {
474 Send(new ShellViewHostMsg_AcceptAllCookies(routing_id(), accept)); 475 Send(new LayoutTestHostMsg_AcceptAllCookies(routing_id(), accept));
475 } 476 }
476 477
477 std::string WebKitTestRunner::PathToLocalResource(const std::string& resource) { 478 std::string WebKitTestRunner::PathToLocalResource(const std::string& resource) {
478 #if defined(OS_WIN) 479 #if defined(OS_WIN)
479 if (resource.find("/tmp/") == 0) { 480 if (resource.find("/tmp/") == 0) {
480 // We want a temp file. 481 // We want a temp file.
481 GURL base_url = net::FilePathToFileURL(test_config_.temp_path); 482 GURL base_url = net::FilePathToFileURL(test_config_.temp_path);
482 return base_url.Resolve(resource.substr(strlen("/tmp/"))).spec(); 483 return base_url.Resolve(resource.substr(strlen("/tmp/"))).spec();
483 } 484 }
484 #endif 485 #endif
(...skipping 29 matching lines...) Expand all
514 } 515 }
515 } 516 }
516 517
517 void WebKitTestRunner::CloseRemainingWindows() { 518 void WebKitTestRunner::CloseRemainingWindows() {
518 NavigateAwayVisitor visitor(render_view()); 519 NavigateAwayVisitor visitor(render_view());
519 RenderView::ForEach(&visitor); 520 RenderView::ForEach(&visitor);
520 Send(new ShellViewHostMsg_CloseRemainingWindows(routing_id())); 521 Send(new ShellViewHostMsg_CloseRemainingWindows(routing_id()));
521 } 522 }
522 523
523 void WebKitTestRunner::DeleteAllCookies() { 524 void WebKitTestRunner::DeleteAllCookies() {
524 Send(new ShellViewHostMsg_DeleteAllCookies(routing_id())); 525 Send(new LayoutTestHostMsg_DeleteAllCookies(routing_id()));
525 } 526 }
526 527
527 int WebKitTestRunner::NavigationEntryCount() { 528 int WebKitTestRunner::NavigationEntryCount() {
528 return GetLocalSessionHistoryLength(render_view()); 529 return GetLocalSessionHistoryLength(render_view());
529 } 530 }
530 531
531 void WebKitTestRunner::GoToOffset(int offset) { 532 void WebKitTestRunner::GoToOffset(int offset) {
532 Send(new ShellViewHostMsg_GoToOffset(routing_id(), offset)); 533 Send(new ShellViewHostMsg_GoToOffset(routing_id(), offset));
533 } 534 }
534 535
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 754
754 leak_detector_->TryLeakDetection(main_frame); 755 leak_detector_->TryLeakDetection(main_frame);
755 } 756 }
756 757
757 void WebKitTestRunner::ReportLeakDetectionResult( 758 void WebKitTestRunner::ReportLeakDetectionResult(
758 const LeakDetectionResult& report) { 759 const LeakDetectionResult& report) {
759 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 760 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
760 } 761 }
761 762
762 } // namespace content 763 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/common/shell_messages.h ('k') | ipc/ipc_message_start.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698