| 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/shell/renderer/layout_test/blink_test_runner.h" | 5 #include "content/shell/renderer/layout_test/blink_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 |
| 11 #include "base/base64.h" | 11 #include "base/base64.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/debug/debugger.h" | 14 #include "base/debug/debugger.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/md5.h" | 16 #include "base/md5.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 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 "components/plugins/renderer/plugin_placeholder.h" |
| 24 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 25 #include "content/public/common/url_constants.h" | 26 #include "content/public/common/url_constants.h" |
| 26 #include "content/public/common/web_preferences.h" | 27 #include "content/public/common/web_preferences.h" |
| 27 #include "content/public/renderer/render_frame.h" | 28 #include "content/public/renderer/render_frame.h" |
| 28 #include "content/public/renderer/render_view.h" | 29 #include "content/public/renderer/render_view.h" |
| 29 #include "content/public/renderer/render_view_visitor.h" | 30 #include "content/public/renderer/render_view_visitor.h" |
| 30 #include "content/public/renderer/renderer_gamepad_provider.h" | 31 #include "content/public/renderer/renderer_gamepad_provider.h" |
| 31 #include "content/public/test/layouttest_support.h" | 32 #include "content/public/test/layouttest_support.h" |
| 32 #include "content/shell/common/layout_test/layout_test_messages.h" | 33 #include "content/shell/common/layout_test/layout_test_messages.h" |
| 33 #include "content/shell/common/shell_messages.h" | 34 #include "content/shell/common/shell_messages.h" |
| 34 #include "content/shell/common/shell_switches.h" | 35 #include "content/shell/common/shell_switches.h" |
| 35 #include "content/shell/renderer/layout_test/blink_test_helpers.h" | 36 #include "content/shell/renderer/layout_test/blink_test_helpers.h" |
| 36 #include "content/shell/renderer/layout_test/gc_controller.h" | 37 #include "content/shell/renderer/layout_test/gc_controller.h" |
| 37 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" | 38 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" |
| 38 #include "content/shell/renderer/layout_test/leak_detector.h" | 39 #include "content/shell/renderer/layout_test/leak_detector.h" |
| 39 #include "content/shell/renderer/layout_test/test_plugin_placeholder.h" | |
| 40 #include "content/shell/renderer/test_runner/app_banner_client.h" | 40 #include "content/shell/renderer/test_runner/app_banner_client.h" |
| 41 #include "content/shell/renderer/test_runner/gamepad_controller.h" | 41 #include "content/shell/renderer/test_runner/gamepad_controller.h" |
| 42 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" | 42 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" |
| 43 #include "content/shell/renderer/test_runner/test_interfaces.h" | 43 #include "content/shell/renderer/test_runner/test_interfaces.h" |
| 44 #include "content/shell/renderer/test_runner/web_task.h" | 44 #include "content/shell/renderer/test_runner/web_task.h" |
| 45 #include "content/shell/renderer/test_runner/web_test_interfaces.h" | 45 #include "content/shell/renderer/test_runner/web_test_interfaces.h" |
| 46 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 46 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
| 47 #include "content/shell/renderer/test_runner/web_test_runner.h" | 47 #include "content/shell/renderer/test_runner/web_test_runner.h" |
| 48 #include "net/base/filename_util.h" | 48 #include "net/base/filename_util.h" |
| 49 #include "net/base/net_errors.h" | 49 #include "net/base/net_errors.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 void BlinkTestRunner::ResolveBeforeInstallPromptPromise( | 676 void BlinkTestRunner::ResolveBeforeInstallPromptPromise( |
| 677 int request_id, const std::string& platform) { | 677 int request_id, const std::string& platform) { |
| 678 WebTestInterfaces* interfaces = | 678 WebTestInterfaces* interfaces = |
| 679 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); | 679 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); |
| 680 interfaces->GetTestInterfaces()->GetAppBannerClient()->ResolvePromise( | 680 interfaces->GetTestInterfaces()->GetAppBannerClient()->ResolvePromise( |
| 681 request_id, platform); | 681 request_id, platform); |
| 682 } | 682 } |
| 683 | 683 |
| 684 blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder( | 684 blink::WebPlugin* BlinkTestRunner::CreatePluginPlaceholder( |
| 685 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { | 685 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { |
| 686 if (params.mimeType == "application/x-plugin-placeholder-test") | 686 if (params.mimeType != "application/x-plugin-placeholder-test") |
| 687 return (new TestPluginPlaceholder(frame, params))->plugin(); | 687 return nullptr; |
| 688 return 0; | 688 |
| 689 plugins::PluginPlaceholder* placeholder = new plugins::PluginPlaceholder( |
| 690 nullptr, frame, params, "<div>Test content</div>"); |
| 691 return placeholder->plugin(); |
| 689 } | 692 } |
| 690 | 693 |
| 691 // RenderViewObserver -------------------------------------------------------- | 694 // RenderViewObserver -------------------------------------------------------- |
| 692 | 695 |
| 693 void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) { | 696 void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) { |
| 694 WebTestingSupport::injectInternalsObject(frame); | 697 WebTestingSupport::injectInternalsObject(frame); |
| 695 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->BindTo( | 698 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->BindTo( |
| 696 frame); | 699 frame); |
| 697 GCController::Install(frame); | 700 GCController::Install(frame); |
| 698 } | 701 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 | 886 |
| 884 leak_detector_->TryLeakDetection(main_frame); | 887 leak_detector_->TryLeakDetection(main_frame); |
| 885 } | 888 } |
| 886 | 889 |
| 887 void BlinkTestRunner::ReportLeakDetectionResult( | 890 void BlinkTestRunner::ReportLeakDetectionResult( |
| 888 const LeakDetectionResult& report) { | 891 const LeakDetectionResult& report) { |
| 889 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 892 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 890 } | 893 } |
| 891 | 894 |
| 892 } // namespace content | 895 } // namespace content |
| OLD | NEW |