| 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::AddLogMessage(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_PrintLogMessage, OnPrintLogMessage) |
| 423 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) | 428 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TextDump, OnTextDump) |
| 424 IPC_MESSAGE_HANDLER(ShellViewHostMsg_InitiateLayoutDump, | 429 IPC_MESSAGE_HANDLER(ShellViewHostMsg_InitiateLayoutDump, |
| 425 OnInitiateLayoutDump) | 430 OnInitiateLayoutDump) |
| 426 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) | 431 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ImageDump, OnImageDump) |
| 427 IPC_MESSAGE_HANDLER(ShellViewHostMsg_AudioDump, OnAudioDump) | 432 IPC_MESSAGE_HANDLER(ShellViewHostMsg_AudioDump, OnAudioDump) |
| 428 IPC_MESSAGE_HANDLER(ShellViewHostMsg_OverridePreferences, | 433 IPC_MESSAGE_HANDLER(ShellViewHostMsg_OverridePreferences, |
| 429 OnOverridePreferences) | 434 OnOverridePreferences) |
| 430 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TestFinished, OnTestFinished) | 435 IPC_MESSAGE_HANDLER(ShellViewHostMsg_TestFinished, OnTestFinished) |
| 431 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ClearDevToolsLocalStorage, | 436 IPC_MESSAGE_HANDLER(ShellViewHostMsg_ClearDevToolsLocalStorage, |
| 432 OnClearDevToolsLocalStorage) | 437 OnClearDevToolsLocalStorage) |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 RenderViewHost* render_view_host = | 773 RenderViewHost* render_view_host = |
| 769 main_window_->web_contents()->GetRenderViewHost(); | 774 main_window_->web_contents()->GetRenderViewHost(); |
| 770 render_view_host->Send(new ShellViewMsg_LayoutDumpCompleted( | 775 render_view_host->Send(new ShellViewMsg_LayoutDumpCompleted( |
| 771 render_view_host->GetRoutingID(), stitched_layout_dump)); | 776 render_view_host->GetRoutingID(), stitched_layout_dump)); |
| 772 } | 777 } |
| 773 | 778 |
| 774 void BlinkTestController::OnPrintMessage(const std::string& message) { | 779 void BlinkTestController::OnPrintMessage(const std::string& message) { |
| 775 printer_->AddMessageRaw(message); | 780 printer_->AddMessageRaw(message); |
| 776 } | 781 } |
| 777 | 782 |
| 783 void BlinkTestController::OnPrintLogMessage(const std::string& message) { |
| 784 printer_->AddLogMessage(message); |
| 785 } |
| 786 |
| 778 void BlinkTestController::OnOverridePreferences(const WebPreferences& prefs) { | 787 void BlinkTestController::OnOverridePreferences(const WebPreferences& prefs) { |
| 779 should_override_prefs_ = true; | 788 should_override_prefs_ = true; |
| 780 prefs_ = prefs; | 789 prefs_ = prefs; |
| 781 | 790 |
| 782 // Notifies the main RenderViewHost that Blink preferences changed so | 791 // Notifies the main RenderViewHost that Blink preferences changed so |
| 783 // immediately apply the new settings and to avoid re-usage of cached | 792 // immediately apply the new settings and to avoid re-usage of cached |
| 784 // preferences that are now stale. RenderViewHost::UpdateWebkitPreferences is | 793 // preferences that are now stale. RenderViewHost::UpdateWebkitPreferences is |
| 785 // not used here because it would send an unneeded preferences update to the | 794 // not used here because it would send an unneeded preferences update to the |
| 786 // renderer. | 795 // renderer. |
| 787 RenderViewHost* main_render_view_host = | 796 RenderViewHost* main_render_view_host = |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 } | 984 } |
| 976 DCHECK(layout_test_control_map_[frame].get()); | 985 DCHECK(layout_test_control_map_[frame].get()); |
| 977 return layout_test_control_map_[frame].get(); | 986 return layout_test_control_map_[frame].get(); |
| 978 } | 987 } |
| 979 | 988 |
| 980 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { | 989 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { |
| 981 layout_test_control_map_.erase(frame); | 990 layout_test_control_map_.erase(frame); |
| 982 } | 991 } |
| 983 | 992 |
| 984 } // namespace content | 993 } // namespace content |
| OLD | NEW |