| 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 "components/test_runner/web_test_proxy.h" | 5 #include "components/test_runner/web_test_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cctype> | 10 #include <cctype> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 result.append(delegate->DumpHistoryForWindow(window_list.at(i))); | 74 result.append(delegate->DumpHistoryForWindow(window_list.at(i))); |
| 75 return result; | 75 return result; |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace | 78 } // namespace |
| 79 | 79 |
| 80 WebTestProxyBase::WebTestProxyBase() | 80 WebTestProxyBase::WebTestProxyBase() |
| 81 : test_interfaces_(nullptr), | 81 : test_interfaces_(nullptr), |
| 82 delegate_(nullptr), | 82 delegate_(nullptr), |
| 83 web_view_(nullptr), | 83 web_view_(nullptr), |
| 84 web_widget_(nullptr), | 84 web_widget_(nullptr) {} |
| 85 spellcheck_(new SpellCheckClient(this)) {} | |
| 86 | 85 |
| 87 WebTestProxyBase::~WebTestProxyBase() { | 86 WebTestProxyBase::~WebTestProxyBase() { |
| 88 test_interfaces_->WindowClosed(this); | 87 test_interfaces_->WindowClosed(this); |
| 89 } | 88 } |
| 90 | 89 |
| 91 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { | 90 void WebTestProxyBase::SetInterfaces(WebTestInterfaces* interfaces) { |
| 92 test_interfaces_ = interfaces->GetTestInterfaces(); | 91 test_interfaces_ = interfaces->GetTestInterfaces(); |
| 93 test_interfaces_->WindowOpened(this); | 92 test_interfaces_->WindowOpened(this); |
| 94 } | 93 } |
| 95 | 94 |
| 96 void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) { | 95 void WebTestProxyBase::SetDelegate(WebTestDelegate* delegate) { |
| 97 delegate_ = delegate; | 96 delegate_ = delegate; |
| 98 spellcheck_->SetDelegate(delegate); | |
| 99 } | |
| 100 | |
| 101 blink::WebSpellCheckClient* WebTestProxyBase::GetSpellCheckClient() const { | |
| 102 return spellcheck_.get(); | |
| 103 } | 97 } |
| 104 | 98 |
| 105 std::string WebTestProxyBase::DumpBackForwardLists() { | 99 std::string WebTestProxyBase::DumpBackForwardLists() { |
| 106 return DumpAllBackForwardLists(test_interfaces_, delegate_); | 100 return DumpAllBackForwardLists(test_interfaces_, delegate_); |
| 107 } | 101 } |
| 108 | 102 |
| 109 void LayoutAndPaintCallback::didLayoutAndPaint() { | 103 void LayoutAndPaintCallback::didLayoutAndPaint() { |
| 110 TRACE_EVENT0("shell", "LayoutAndPaintCallback::didLayoutAndPaint"); | 104 TRACE_EVENT0("shell", "LayoutAndPaintCallback::didLayoutAndPaint"); |
| 111 if (wait_for_popup_) { | 105 if (wait_for_popup_) { |
| 112 wait_for_popup_ = false; | 106 wait_for_popup_ = false; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 134 blink::WebScreenInfo& screen_info) { | 128 blink::WebScreenInfo& screen_info) { |
| 135 MockScreenOrientationClient* mock_client = | 129 MockScreenOrientationClient* mock_client = |
| 136 test_interfaces_->GetTestRunner()->getMockScreenOrientationClient(); | 130 test_interfaces_->GetTestRunner()->getMockScreenOrientationClient(); |
| 137 if (mock_client->IsDisabled()) | 131 if (mock_client->IsDisabled()) |
| 138 return; | 132 return; |
| 139 // Override screen orientation information with mock data. | 133 // Override screen orientation information with mock data. |
| 140 screen_info.orientationType = mock_client->CurrentOrientationType(); | 134 screen_info.orientationType = mock_client->CurrentOrientationType(); |
| 141 screen_info.orientationAngle = mock_client->CurrentOrientationAngle(); | 135 screen_info.orientationAngle = mock_client->CurrentOrientationAngle(); |
| 142 } | 136 } |
| 143 | 137 |
| 144 MockCredentialManagerClient* | |
| 145 WebTestProxyBase::GetCredentialManagerClientMock() { | |
| 146 if (!credential_manager_client_.get()) | |
| 147 credential_manager_client_.reset(new MockCredentialManagerClient()); | |
| 148 return credential_manager_client_.get(); | |
| 149 } | |
| 150 | |
| 151 void WebTestProxyBase::PostSpellCheckEvent(const blink::WebString& event_name) { | |
| 152 if (test_interfaces_->GetTestRunner()->shouldDumpSpellCheckCallbacks()) { | |
| 153 delegate_->PrintMessage(std::string("SpellCheckEvent: ") + | |
| 154 event_name.utf8().data() + "\n"); | |
| 155 } | |
| 156 } | |
| 157 | |
| 158 } // namespace test_runner | 138 } // namespace test_runner |
| OLD | NEW |