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 |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 void BlinkTestRunner::SetBluetoothMockDataSet(const std::string& name) { | 477 void BlinkTestRunner::SetBluetoothMockDataSet(const std::string& name) { |
478 Send(new LayoutTestHostMsg_SetBluetoothAdapter(name)); | 478 Send(new LayoutTestHostMsg_SetBluetoothAdapter(name)); |
479 // Auto-reset the chooser type so we don't get order dependence when some | 479 // Auto-reset the chooser type so we don't get order dependence when some |
480 // tests forget to do it explicitly. | 480 // tests forget to do it explicitly. |
481 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), false)); | 481 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), false)); |
482 } | 482 } |
483 | 483 |
484 void BlinkTestRunner::SetBluetoothManualChooser() { | 484 void BlinkTestRunner::SetBluetoothManualChooser() { |
485 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), true)); | 485 Send(new ShellViewHostMsg_SetBluetoothManualChooser(routing_id(), true)); |
486 } | 486 } |
487 std::vector<std::string> BlinkTestRunner::GetBluetoothManualChooserEvents() { | 487 |
488 std::vector<std::string> result; | 488 void BlinkTestRunner::GetBluetoothManualChooserEvents( |
489 Send(new ShellViewHostMsg_GetBluetoothManualChooserEvents(routing_id(), | 489 const base::Callback<void(const std::vector<std::string>&)>& callback) { |
490 &result)); | 490 get_bluetooth_events_callbacks_.push_back(callback); |
491 return result; | 491 Send(new ShellViewHostMsg_GetBluetoothManualChooserEvents(routing_id())); |
492 } | 492 } |
| 493 |
493 void BlinkTestRunner::SendBluetoothManualChooserEvent( | 494 void BlinkTestRunner::SendBluetoothManualChooserEvent( |
494 const std::string& event, | 495 const std::string& event, |
495 const std::string& argument) { | 496 const std::string& argument) { |
496 Send(new ShellViewHostMsg_SendBluetoothManualChooserEvent(routing_id(), event, | 497 Send(new ShellViewHostMsg_SendBluetoothManualChooserEvent(routing_id(), event, |
497 argument)); | 498 argument)); |
498 } | 499 } |
499 | 500 |
500 void BlinkTestRunner::SetGeofencingMockProvider(bool service_available) { | 501 void BlinkTestRunner::SetGeofencingMockProvider(bool service_available) { |
501 content::SetGeofencingMockProvider(service_available); | 502 content::SetGeofencingMockProvider(service_available); |
502 } | 503 } |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 726 |
726 bool BlinkTestRunner::OnMessageReceived(const IPC::Message& message) { | 727 bool BlinkTestRunner::OnMessageReceived(const IPC::Message& message) { |
727 bool handled = true; | 728 bool handled = true; |
728 IPC_BEGIN_MESSAGE_MAP(BlinkTestRunner, message) | 729 IPC_BEGIN_MESSAGE_MAP(BlinkTestRunner, message) |
729 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, | 730 IPC_MESSAGE_HANDLER(ShellViewMsg_SetTestConfiguration, |
730 OnSetTestConfiguration) | 731 OnSetTestConfiguration) |
731 IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) | 732 IPC_MESSAGE_HANDLER(ShellViewMsg_SessionHistory, OnSessionHistory) |
732 IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) | 733 IPC_MESSAGE_HANDLER(ShellViewMsg_Reset, OnReset) |
733 IPC_MESSAGE_HANDLER(ShellViewMsg_NotifyDone, OnNotifyDone) | 734 IPC_MESSAGE_HANDLER(ShellViewMsg_NotifyDone, OnNotifyDone) |
734 IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) | 735 IPC_MESSAGE_HANDLER(ShellViewMsg_TryLeakDetection, OnTryLeakDetection) |
| 736 IPC_MESSAGE_HANDLER(ShellViewMsg_ReplyBluetoothManualChooserEvents, |
| 737 OnReplyBluetoothManualChooserEvents) |
735 IPC_MESSAGE_UNHANDLED(handled = false) | 738 IPC_MESSAGE_UNHANDLED(handled = false) |
736 IPC_END_MESSAGE_MAP() | 739 IPC_END_MESSAGE_MAP() |
737 | 740 |
738 return handled; | 741 return handled; |
739 } | 742 } |
740 | 743 |
741 void BlinkTestRunner::Navigate(const GURL& url) { | 744 void BlinkTestRunner::Navigate(const GURL& url) { |
742 focus_on_next_commit_ = true; | 745 focus_on_next_commit_ = true; |
743 if (!is_main_window_ && | 746 if (!is_main_window_ && |
744 LayoutTestRenderProcessObserver::GetInstance()->main_test_runner() == | 747 LayoutTestRenderProcessObserver::GetInstance()->main_test_runner() == |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 | 907 |
905 void BlinkTestRunner::OnTryLeakDetection() { | 908 void BlinkTestRunner::OnTryLeakDetection() { |
906 WebLocalFrame* main_frame = | 909 WebLocalFrame* main_frame = |
907 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); | 910 render_view()->GetWebView()->mainFrame()->toWebLocalFrame(); |
908 DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->document().url())); | 911 DCHECK_EQ(GURL(url::kAboutBlankURL), GURL(main_frame->document().url())); |
909 DCHECK(!main_frame->isLoading()); | 912 DCHECK(!main_frame->isLoading()); |
910 | 913 |
911 leak_detector_->TryLeakDetection(main_frame); | 914 leak_detector_->TryLeakDetection(main_frame); |
912 } | 915 } |
913 | 916 |
| 917 void BlinkTestRunner::OnReplyBluetoothManualChooserEvents( |
| 918 const std::vector<std::string>& events) { |
| 919 DCHECK(!get_bluetooth_events_callbacks_.empty()); |
| 920 base::Callback<void(const std::vector<std::string>&)> callback = |
| 921 get_bluetooth_events_callbacks_.front(); |
| 922 get_bluetooth_events_callbacks_.pop_front(); |
| 923 callback.Run(events); |
| 924 } |
| 925 |
914 void BlinkTestRunner::ReportLeakDetectionResult( | 926 void BlinkTestRunner::ReportLeakDetectionResult( |
915 const LeakDetectionResult& report) { | 927 const LeakDetectionResult& report) { |
916 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 928 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
917 } | 929 } |
918 | 930 |
919 } // namespace content | 931 } // namespace content |
OLD | NEW |