OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/layout_test/layout_test_devtools_frontend.h" | 5 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.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/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 void LayoutTestDevToolsFrontend::EvaluateInFrontend( | 96 void LayoutTestDevToolsFrontend::EvaluateInFrontend( |
97 int call_id, | 97 int call_id, |
98 const std::string& script) { | 98 const std::string& script) { |
99 if (!ready_for_test_) { | 99 if (!ready_for_test_) { |
100 pending_evaluations_.push_back(std::make_pair(call_id, script)); | 100 pending_evaluations_.push_back(std::make_pair(call_id, script)); |
101 return; | 101 return; |
102 } | 102 } |
103 | 103 |
104 std::string encoded_script; | 104 std::string encoded_script; |
105 base::JSONWriter::Write(base::StringValue(script), &encoded_script); | 105 base::JSONWriter::Write(base::Value(script), &encoded_script); |
106 std::string source = | 106 std::string source = |
107 base::StringPrintf("DevToolsAPI.evaluateForTestInFrontend(%d, %s);", | 107 base::StringPrintf("DevToolsAPI.evaluateForTestInFrontend(%d, %s);", |
108 call_id, | 108 call_id, |
109 encoded_script.c_str()); | 109 encoded_script.c_str()); |
110 web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( | 110 web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( |
111 base::UTF8ToUTF16(source)); | 111 base::UTF8ToUTF16(source)); |
112 } | 112 } |
113 | 113 |
114 LayoutTestDevToolsFrontend::LayoutTestDevToolsFrontend( | 114 LayoutTestDevToolsFrontend::LayoutTestDevToolsFrontend( |
115 Shell* frontend_shell, | 115 Shell* frontend_shell, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 base::TerminationStatus status) { | 149 base::TerminationStatus status) { |
150 BlinkTestController::Get()->DevToolsProcessCrashed(); | 150 BlinkTestController::Get()->DevToolsProcessCrashed(); |
151 } | 151 } |
152 | 152 |
153 void LayoutTestDevToolsFrontend::RenderFrameCreated( | 153 void LayoutTestDevToolsFrontend::RenderFrameCreated( |
154 RenderFrameHost* render_frame_host) { | 154 RenderFrameHost* render_frame_host) { |
155 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); | 155 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); |
156 } | 156 } |
157 | 157 |
158 } // namespace content | 158 } // namespace content |
OLD | NEW |