Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: components/test_runner/web_frame_test_client.cc

Issue 1897363003: Use correct WebView from EventSender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed initial state of EventSender. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_frame_test_client.h" 5 #include "components/test_runner/web_frame_test_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_piece.h" 9 #include "base/strings/string_piece.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "components/test_runner/accessibility_controller.h" 12 #include "components/test_runner/accessibility_controller.h"
13 #include "components/test_runner/event_sender.h" 13 #include "components/test_runner/event_sender.h"
14 #include "components/test_runner/mock_color_chooser.h" 14 #include "components/test_runner/mock_color_chooser.h"
15 #include "components/test_runner/mock_screen_orientation_client.h" 15 #include "components/test_runner/mock_screen_orientation_client.h"
16 #include "components/test_runner/mock_web_user_media_client.h" 16 #include "components/test_runner/mock_web_user_media_client.h"
17 #include "components/test_runner/test_common.h" 17 #include "components/test_runner/test_common.h"
18 #include "components/test_runner/test_interfaces.h"
18 #include "components/test_runner/test_plugin.h" 19 #include "components/test_runner/test_plugin.h"
19 #include "components/test_runner/test_runner.h" 20 #include "components/test_runner/test_runner.h"
20 #include "components/test_runner/web_test_delegate.h" 21 #include "components/test_runner/web_test_delegate.h"
22 #include "components/test_runner/web_test_proxy.h"
21 #include "third_party/WebKit/public/platform/WebString.h" 23 #include "third_party/WebKit/public/platform/WebString.h"
22 #include "third_party/WebKit/public/platform/WebURL.h" 24 #include "third_party/WebKit/public/platform/WebURL.h"
23 #include "third_party/WebKit/public/platform/WebURLRequest.h" 25 #include "third_party/WebKit/public/platform/WebURLRequest.h"
24 #include "third_party/WebKit/public/platform/WebURLResponse.h" 26 #include "third_party/WebKit/public/platform/WebURLResponse.h"
25 #include "third_party/WebKit/public/web/WebConsoleMessage.h" 27 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
26 #include "third_party/WebKit/public/web/WebElement.h" 28 #include "third_party/WebKit/public/web/WebElement.h"
27 #include "third_party/WebKit/public/web/WebFrame.h" 29 #include "third_party/WebKit/public/web/WebFrame.h"
28 #include "third_party/WebKit/public/web/WebLocalFrame.h" 30 #include "third_party/WebKit/public/web/WebLocalFrame.h"
29 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" 31 #include "third_party/WebKit/public/web/WebNavigationPolicy.h"
30 #include "third_party/WebKit/public/web/WebPluginParams.h" 32 #include "third_party/WebKit/public/web/WebPluginParams.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 return; 194 return;
193 test_runner->setTopLoadingFrame(frame, true); 195 test_runner->setTopLoadingFrame(frame, true);
194 } 196 }
195 197
196 } // namespace 198 } // namespace
197 199
198 WebFrameTestClient::WebFrameTestClient( 200 WebFrameTestClient::WebFrameTestClient(
199 TestRunner* test_runner, 201 TestRunner* test_runner,
200 WebTestDelegate* delegate, 202 WebTestDelegate* delegate,
201 AccessibilityController* accessibility_controller, 203 AccessibilityController* accessibility_controller,
202 EventSender* event_sender) 204 WebTestProxyBase* web_test_proxy_base)
203 : test_runner_(test_runner), 205 : test_runner_(test_runner),
204 delegate_(delegate), 206 delegate_(delegate),
205 accessibility_controller_(accessibility_controller), 207 accessibility_controller_(accessibility_controller),
206 event_sender_(event_sender) { 208 web_test_proxy_base_(web_test_proxy_base) {
207 DCHECK(test_runner); 209 DCHECK(test_runner);
208 DCHECK(delegate_); 210 DCHECK(delegate_);
209 DCHECK(accessibility_controller_); 211 DCHECK(accessibility_controller_);
210 DCHECK(event_sender_); 212 DCHECK(web_test_proxy_base_);
211 } 213 }
212 214
213 WebFrameTestClient::~WebFrameTestClient() {} 215 WebFrameTestClient::~WebFrameTestClient() {}
214 216
215 blink::WebColorChooser* WebFrameTestClient::createColorChooser( 217 blink::WebColorChooser* WebFrameTestClient::createColorChooser(
216 blink::WebColorChooserClient* client, 218 blink::WebColorChooserClient* client,
217 const blink::WebColor& color, 219 const blink::WebColor& color,
218 const blink::WebVector<blink::WebColorSuggestion>& suggestions) { 220 const blink::WebVector<blink::WebColorSuggestion>& suggestions) {
219 // This instance is deleted by WebCore::ColorInputType 221 // This instance is deleted by WebCore::ColorInputType
220 return new MockColorChooser(client, delegate_, test_runner_); 222 return new MockColorChooser(client, delegate_, test_runner_);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 blink::WebPlugin* WebFrameTestClient::createPlugin( 396 blink::WebPlugin* WebFrameTestClient::createPlugin(
395 blink::WebLocalFrame* frame, 397 blink::WebLocalFrame* frame,
396 const blink::WebPluginParams& params) { 398 const blink::WebPluginParams& params) {
397 if (TestPlugin::IsSupportedMimeType(params.mimeType)) 399 if (TestPlugin::IsSupportedMimeType(params.mimeType))
398 return TestPlugin::create(frame, params, delegate_); 400 return TestPlugin::create(frame, params, delegate_);
399 return delegate_->CreatePluginPlaceholder(frame, params); 401 return delegate_->CreatePluginPlaceholder(frame, params);
400 } 402 }
401 403
402 void WebFrameTestClient::showContextMenu( 404 void WebFrameTestClient::showContextMenu(
403 const blink::WebContextMenuData& context_menu_data) { 405 const blink::WebContextMenuData& context_menu_data) {
404 event_sender_->SetContextMenuData(context_menu_data); 406 web_test_proxy_base_->event_sender()->SetContextMenuData(context_menu_data);
405 } 407 }
406 408
407 blink::WebUserMediaClient* WebFrameTestClient::userMediaClient() { 409 blink::WebUserMediaClient* WebFrameTestClient::userMediaClient() {
408 return test_runner_->getMockWebUserMediaClient(); 410 return test_runner_->getMockWebUserMediaClient();
409 } 411 }
410 412
411 void WebFrameTestClient::loadURLExternally( 413 void WebFrameTestClient::loadURLExternally(
412 const blink::WebURLRequest& request, 414 const blink::WebURLRequest& request,
413 blink::WebNavigationPolicy policy, 415 blink::WebNavigationPolicy policy,
414 const blink::WebString& suggested_name, 416 const blink::WebString& suggested_name,
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 scoped_ptr<blink::WebSetSinkIdCallbacks> callback(web_callbacks); 763 scoped_ptr<blink::WebSetSinkIdCallbacks> callback(web_callbacks);
762 std::string device_id = sink_id.utf8(); 764 std::string device_id = sink_id.utf8();
763 if (device_id == "valid" || device_id.empty()) 765 if (device_id == "valid" || device_id.empty())
764 callback->onSuccess(); 766 callback->onSuccess();
765 else if (device_id == "unauthorized") 767 else if (device_id == "unauthorized")
766 callback->onError(blink::WebSetSinkIdError::NotAuthorized); 768 callback->onError(blink::WebSetSinkIdError::NotAuthorized);
767 else 769 else
768 callback->onError(blink::WebSetSinkIdError::NotFound); 770 callback->onError(blink::WebSetSinkIdError::NotFound);
769 } 771 }
770 772
773 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) {
774 web_test_proxy_base_->test_interfaces()->BindTo(frame);
775 web_test_proxy_base_->BindTo(frame);
776 }
777
771 } // namespace test_runner 778 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698