OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/blink_test_controller.h" | 5 #include "content/shell/browser/layout_test/blink_test_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <iostream> | 9 #include <iostream> |
10 #include <set> | 10 #include <set> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void BlinkTestResultPrinter::PrintAudioFooter() { | 161 void BlinkTestResultPrinter::PrintAudioFooter() { |
162 if (state_ != IN_AUDIO_BLOCK) | 162 if (state_ != IN_AUDIO_BLOCK) |
163 return; | 163 return; |
164 if (!capture_text_only_) { | 164 if (!capture_text_only_) { |
165 *output_ << "#EOF\n"; | 165 *output_ << "#EOF\n"; |
166 output_->flush(); | 166 output_->flush(); |
167 } | 167 } |
168 state_ = IN_IMAGE_BLOCK; | 168 state_ = IN_IMAGE_BLOCK; |
169 } | 169 } |
170 | 170 |
| 171 void BlinkTestResultPrinter::AddMessageToStderr(const std::string& message) { |
| 172 *error_ << message; |
| 173 } |
| 174 |
171 void BlinkTestResultPrinter::AddMessage(const std::string& message) { | 175 void BlinkTestResultPrinter::AddMessage(const std::string& message) { |
172 AddMessageRaw(message + "\n"); | 176 AddMessageRaw(message + "\n"); |
173 } | 177 } |
174 | 178 |
175 void BlinkTestResultPrinter::AddMessageRaw(const std::string& message) { | 179 void BlinkTestResultPrinter::AddMessageRaw(const std::string& message) { |
176 if (state_ != DURING_TEST) | 180 if (state_ != DURING_TEST) |
177 return; | 181 return; |
178 *output_ << message; | 182 *output_ << message; |
179 } | 183 } |
180 | 184 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 event_handler); | 417 event_handler); |
414 } | 418 } |
415 return base::MakeUnique<LayoutTestFirstDeviceBluetoothChooser>(event_handler); | 419 return base::MakeUnique<LayoutTestFirstDeviceBluetoothChooser>(event_handler); |
416 } | 420 } |
417 | 421 |
418 bool BlinkTestController::OnMessageReceived(const IPC::Message& message) { | 422 bool BlinkTestController::OnMessageReceived(const IPC::Message& message) { |
419 DCHECK(CalledOnValidThread()); | 423 DCHECK(CalledOnValidThread()); |
420 bool handled = true; | 424 bool handled = true; |
421 IPC_BEGIN_MESSAGE_MAP(BlinkTestController, message) | 425 IPC_BEGIN_MESSAGE_MAP(BlinkTestController, message) |
422 IPC_MESSAGE_HANDLER(ShellViewHostMsg_PrintMessage, OnPrintMessage) | 426 IPC_MESSAGE_HANDLER(ShellViewHostMsg_PrintMessage, OnPrintMessage) |
| 427 IPC_MESSAGE_HANDLER(ShellViewHostMsg_PrintMessageToStderr, |
| 428 OnPrintMessageToStderr) |
423 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) | 429 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) |
424 IPC_MESSAGE_HANDLER(ShellViewHostMsg_InitiateLayoutDump, | 430 IPC_MESSAGE_HANDLER(ShellViewHostMsg_InitiateLayoutDump, |
425 OnInitiateLayoutDump) | 431 OnInitiateLayoutDump) |
426 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) | 432 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) |
427 IPC_MESSAGE_HANDLER(ShellViewHostMsg_AudioDump, OnAudioDump) | 433 IPC_MESSAGE_HANDLER(ShellViewHostMsg_AudioDump, OnAudioDump) |
428 IPC_MESSAGE_HANDLER(ShellViewHostMsg_OverridePreferences, | 434 IPC_MESSAGE_HANDLER(ShellViewHostMsg_OverridePreferences, |
429 OnOverridePreferences) | 435 OnOverridePreferences) |
430 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TestFinished, OnTestFinished) | 436 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TestFinished, OnTestFinished) |
431 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ClearDevToolsLocalStorage, | 437 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ClearDevToolsLocalStorage, |
432 OnClearDevToolsLocalStorage) | 438 OnClearDevToolsLocalStorage) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 RenderViewHost* render_view_host = | 774 RenderViewHost* render_view_host = |
769 main_window_->web_contents()->GetRenderViewHost(); | 775 main_window_->web_contents()->GetRenderViewHost(); |
770 render_view_host->Send(new ShellViewMsg_LayoutDumpCompleted( | 776 render_view_host->Send(new ShellViewMsg_LayoutDumpCompleted( |
771 render_view_host->GetRoutingID(), stitched_layout_dump)); | 777 render_view_host->GetRoutingID(), stitched_layout_dump)); |
772 } | 778 } |
773 | 779 |
774 void BlinkTestController::OnPrintMessage(const std::string& message) { | 780 void BlinkTestController::OnPrintMessage(const std::string& message) { |
775 printer_->AddMessageRaw(message); | 781 printer_->AddMessageRaw(message); |
776 } | 782 } |
777 | 783 |
| 784 void BlinkTestController::OnPrintMessageToStderr(const std::string& message) { |
| 785 printer_->AddMessageToStderr(message); |
| 786 } |
| 787 |
778 void BlinkTestController::OnOverridePreferences(const WebPreferences& prefs) { | 788 void BlinkTestController::OnOverridePreferences(const WebPreferences& prefs) { |
779 should_override_prefs_ = true; | 789 should_override_prefs_ = true; |
780 prefs_ = prefs; | 790 prefs_ = prefs; |
781 | 791 |
782 // Notifies the main RenderViewHost that Blink preferences changed so | 792 // Notifies the main RenderViewHost that Blink preferences changed so |
783 // immediately apply the new settings and to avoid re-usage of cached | 793 // immediately apply the new settings and to avoid re-usage of cached |
784 // preferences that are now stale. RenderViewHost::UpdateWebkitPreferences is | 794 // preferences that are now stale. RenderViewHost::UpdateWebkitPreferences is |
785 // not used here because it would send an unneeded preferences update to the | 795 // not used here because it would send an unneeded preferences update to the |
786 // renderer. | 796 // renderer. |
787 RenderViewHost* main_render_view_host = | 797 RenderViewHost* main_render_view_host = |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 } | 985 } |
976 DCHECK(layout_test_control_map_[frame].get()); | 986 DCHECK(layout_test_control_map_[frame].get()); |
977 return layout_test_control_map_[frame].get(); | 987 return layout_test_control_map_[frame].get(); |
978 } | 988 } |
979 | 989 |
980 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { | 990 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { |
981 layout_test_control_map_.erase(frame); | 991 layout_test_control_map_.erase(frame); |
982 } | 992 } |
983 | 993 |
984 } // namespace content | 994 } // namespace content |
OLD | NEW |