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

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

Issue 1896413003: Use correct WebView from TextInputController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@event-sender-per-view
Patch Set: Rebasing... 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 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/test_interfaces.h" 5 #include "components/test_runner/test_interfaces.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 11 matching lines...) Expand all
22 #include "components/test_runner/web_test_proxy.h" 22 #include "components/test_runner/web_test_proxy.h"
23 #include "third_party/WebKit/public/platform/WebURL.h" 23 #include "third_party/WebKit/public/platform/WebURL.h"
24 #include "third_party/WebKit/public/web/WebCache.h" 24 #include "third_party/WebKit/public/web/WebCache.h"
25 #include "third_party/WebKit/public/web/WebKit.h" 25 #include "third_party/WebKit/public/web/WebKit.h"
26 #include "third_party/WebKit/public/web/WebView.h" 26 #include "third_party/WebKit/public/web/WebView.h"
27 27
28 namespace test_runner { 28 namespace test_runner {
29 29
30 TestInterfaces::TestInterfaces() 30 TestInterfaces::TestInterfaces()
31 : accessibility_controller_(new AccessibilityController()), 31 : accessibility_controller_(new AccessibilityController()),
32 text_input_controller_(new TextInputController()),
33 test_runner_(new TestRunner(this)), 32 test_runner_(new TestRunner(this)),
34 delegate_(nullptr), 33 delegate_(nullptr),
35 app_banner_client_(nullptr) { 34 app_banner_client_(nullptr) {
36 blink::setLayoutTestMode(true); 35 blink::setLayoutTestMode(true);
37 // NOTE: please don't put feature specific enable flags here, 36 // NOTE: please don't put feature specific enable flags here,
38 // instead add them to RuntimeEnabledFeatures.in 37 // instead add them to RuntimeEnabledFeatures.in
39 38
40 ResetAll(); 39 ResetAll();
41 } 40 }
42 41
43 TestInterfaces::~TestInterfaces() { 42 TestInterfaces::~TestInterfaces() {
44 accessibility_controller_->SetWebView(nullptr); 43 accessibility_controller_->SetWebView(nullptr);
45 // gamepad_controller_ doesn't depend on WebView. 44 // gamepad_controller_ doesn't depend on WebView.
46 text_input_controller_->SetWebView(nullptr);
47 test_runner_->SetWebView(nullptr); 45 test_runner_->SetWebView(nullptr);
48 46
49 accessibility_controller_->SetDelegate(nullptr); 47 accessibility_controller_->SetDelegate(nullptr);
50 // gamepad_controller_ ignores SetDelegate(nullptr) 48 // gamepad_controller_ ignores SetDelegate(nullptr)
51 // text_input_controller_ doesn't depend on WebTestDelegate.
52 test_runner_->SetDelegate(nullptr); 49 test_runner_->SetDelegate(nullptr);
53 } 50 }
54 51
55 void TestInterfaces::SetWebView(blink::WebView* web_view, 52 void TestInterfaces::SetWebView(blink::WebView* web_view,
56 WebTestProxyBase* proxy) { 53 WebTestProxyBase* proxy) {
57 accessibility_controller_->SetWebView(web_view); 54 accessibility_controller_->SetWebView(web_view);
58 // gamepad_controller_ doesn't depend on WebView. 55 // gamepad_controller_ doesn't depend on WebView.
59 text_input_controller_->SetWebView(web_view);
60 test_runner_->SetWebView(web_view); 56 test_runner_->SetWebView(web_view);
61 } 57 }
62 58
63 void TestInterfaces::SetDelegate(WebTestDelegate* delegate) { 59 void TestInterfaces::SetDelegate(WebTestDelegate* delegate) {
64 accessibility_controller_->SetDelegate(delegate); 60 accessibility_controller_->SetDelegate(delegate);
65 gamepad_controller_ = GamepadController::Create(delegate); 61 gamepad_controller_ = GamepadController::Create(delegate);
66 // text_input_controller_ doesn't depend on WebTestDelegate.
67 test_runner_->SetDelegate(delegate); 62 test_runner_->SetDelegate(delegate);
68 delegate_ = delegate; 63 delegate_ = delegate;
69 } 64 }
70 65
71 void TestInterfaces::BindTo(blink::WebFrame* frame) { 66 void TestInterfaces::BindTo(blink::WebFrame* frame) {
72 accessibility_controller_->Install(frame); 67 accessibility_controller_->Install(frame);
73 if (gamepad_controller_) 68 if (gamepad_controller_)
74 gamepad_controller_->Install(frame); 69 gamepad_controller_->Install(frame);
75 text_input_controller_->Install(frame);
76 test_runner_->Install(frame); 70 test_runner_->Install(frame);
77 GCController::Install(frame); 71 GCController::Install(frame);
78 } 72 }
79 73
80 void TestInterfaces::ResetTestHelperControllers() { 74 void TestInterfaces::ResetTestHelperControllers() {
81 accessibility_controller_->Reset(); 75 accessibility_controller_->Reset();
82 if (gamepad_controller_) 76 if (gamepad_controller_)
83 gamepad_controller_->Reset(); 77 gamepad_controller_->Reset();
84 // text_input_controller_ doesn't have any state to reset.
85 blink::WebCache::clear(); 78 blink::WebCache::clear();
86 79
87 for (WebTestProxyBase* web_test_proxy_base : window_list_) 80 for (WebTestProxyBase* web_test_proxy_base : window_list_)
88 web_test_proxy_base->Reset(); 81 web_test_proxy_base->Reset();
89 } 82 }
90 83
91 void TestInterfaces::ResetAll() { 84 void TestInterfaces::ResetAll() {
92 ResetTestHelperControllers(); 85 ResetTestHelperControllers();
93 test_runner_->Reset(); 86 test_runner_->Reset();
94 } 87 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (!theme_engine_.get()) 162 if (!theme_engine_.get())
170 theme_engine_.reset(new MockWebThemeEngine()); 163 theme_engine_.reset(new MockWebThemeEngine());
171 return theme_engine_.get(); 164 return theme_engine_.get();
172 } 165 }
173 166
174 AppBannerClient* TestInterfaces::GetAppBannerClient() { 167 AppBannerClient* TestInterfaces::GetAppBannerClient() {
175 return app_banner_client_; 168 return app_banner_client_;
176 } 169 }
177 170
178 } // namespace test_runner 171 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/test_interfaces.h ('k') | components/test_runner/text_input_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698