OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/layout_test_render_process_observer
.h" | 5 #include "content/shell/renderer/layout_test/layout_test_render_process_observer
.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/common/content_client.h" | 8 #include "content/public/common/content_client.h" |
9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
10 #include "content/public/renderer/render_view.h" | 10 #include "content/public/renderer/render_view.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 WebKitTestRunner* test_runner = WebKitTestRunner::Get(view); | 56 WebKitTestRunner* test_runner = WebKitTestRunner::Get(view); |
57 test_interfaces_->SetWebView(view->GetWebView(), test_runner->proxy()); | 57 test_interfaces_->SetWebView(view->GetWebView(), test_runner->proxy()); |
58 main_test_runner_ = test_runner; | 58 main_test_runner_ = test_runner; |
59 } | 59 } |
60 | 60 |
61 void LayoutTestRenderProcessObserver::WebKitInitialized() { | 61 void LayoutTestRenderProcessObserver::WebKitInitialized() { |
62 // We always expose GC to layout tests. | 62 // We always expose GC to layout tests. |
63 std::string flags("--expose-gc"); | 63 std::string flags("--expose-gc"); |
64 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); | 64 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); |
65 | 65 |
66 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 66 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
67 switches::kStableReleaseMode)) { | 67 switches::kStableReleaseMode)) { |
68 WebRuntimeFeatures::enableTestOnlyFeatures(true); | 68 WebRuntimeFeatures::enableTestOnlyFeatures(true); |
69 } | 69 } |
70 | 70 |
71 test_interfaces_.reset(new WebTestInterfaces); | 71 test_interfaces_.reset(new WebTestInterfaces); |
72 test_interfaces_->ResetAll(); | 72 test_interfaces_->ResetAll(); |
73 } | 73 } |
74 | 74 |
75 void LayoutTestRenderProcessObserver::OnRenderProcessShutdown() { | 75 void LayoutTestRenderProcessObserver::OnRenderProcessShutdown() { |
76 test_interfaces_.reset(); | 76 test_interfaces_.reset(); |
77 } | 77 } |
78 | 78 |
79 bool LayoutTestRenderProcessObserver::OnControlMessageReceived( | 79 bool LayoutTestRenderProcessObserver::OnControlMessageReceived( |
80 const IPC::Message& message) { | 80 const IPC::Message& message) { |
81 bool handled = true; | 81 bool handled = true; |
82 IPC_BEGIN_MESSAGE_MAP(LayoutTestRenderProcessObserver, message) | 82 IPC_BEGIN_MESSAGE_MAP(LayoutTestRenderProcessObserver, message) |
83 IPC_MESSAGE_HANDLER(ShellViewMsg_SetWebKitSourceDir, OnSetWebKitSourceDir) | 83 IPC_MESSAGE_HANDLER(ShellViewMsg_SetWebKitSourceDir, OnSetWebKitSourceDir) |
84 IPC_MESSAGE_UNHANDLED(handled = false) | 84 IPC_MESSAGE_UNHANDLED(handled = false) |
85 IPC_END_MESSAGE_MAP() | 85 IPC_END_MESSAGE_MAP() |
86 | 86 |
87 return handled; | 87 return handled; |
88 } | 88 } |
89 | 89 |
90 void LayoutTestRenderProcessObserver::OnSetWebKitSourceDir( | 90 void LayoutTestRenderProcessObserver::OnSetWebKitSourceDir( |
91 const base::FilePath& webkit_source_dir) { | 91 const base::FilePath& webkit_source_dir) { |
92 webkit_source_dir_ = webkit_source_dir; | 92 webkit_source_dir_ = webkit_source_dir; |
93 } | 93 } |
94 | 94 |
95 } // namespace content | 95 } // namespace content |
OLD | NEW |