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

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

Issue 1903043002: Use correct WebView from AccessibilityController. (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
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/json/string_escape.h" 12 #include "base/json/string_escape.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "components/test_runner/accessibility_controller.h"
17 #include "components/test_runner/app_banner_client.h" 16 #include "components/test_runner/app_banner_client.h"
18 #include "components/test_runner/gamepad_controller.h" 17 #include "components/test_runner/gamepad_controller.h"
19 #include "components/test_runner/gc_controller.h" 18 #include "components/test_runner/gc_controller.h"
20 #include "components/test_runner/test_runner.h" 19 #include "components/test_runner/test_runner.h"
21 #include "components/test_runner/text_input_controller.h" 20 #include "components/test_runner/text_input_controller.h"
22 #include "components/test_runner/web_test_proxy.h" 21 #include "components/test_runner/web_test_proxy.h"
23 #include "third_party/WebKit/public/platform/WebURL.h" 22 #include "third_party/WebKit/public/platform/WebURL.h"
24 #include "third_party/WebKit/public/web/WebCache.h" 23 #include "third_party/WebKit/public/web/WebCache.h"
25 #include "third_party/WebKit/public/web/WebKit.h" 24 #include "third_party/WebKit/public/web/WebKit.h"
26 #include "third_party/WebKit/public/web/WebView.h" 25 #include "third_party/WebKit/public/web/WebView.h"
27 26
28 namespace test_runner { 27 namespace test_runner {
29 28
30 TestInterfaces::TestInterfaces() 29 TestInterfaces::TestInterfaces()
31 : accessibility_controller_(new AccessibilityController()), 30 : test_runner_(new TestRunner(this)),
32 test_runner_(new TestRunner(this)),
33 delegate_(nullptr), 31 delegate_(nullptr),
34 app_banner_client_(nullptr) { 32 app_banner_client_(nullptr) {
35 blink::setLayoutTestMode(true); 33 blink::setLayoutTestMode(true);
36 // NOTE: please don't put feature specific enable flags here, 34 // NOTE: please don't put feature specific enable flags here,
37 // instead add them to RuntimeEnabledFeatures.in 35 // instead add them to RuntimeEnabledFeatures.in
38 36
39 ResetAll(); 37 ResetAll();
40 } 38 }
41 39
42 TestInterfaces::~TestInterfaces() { 40 TestInterfaces::~TestInterfaces() {
43 accessibility_controller_->SetWebView(nullptr);
44 // gamepad_controller_ doesn't depend on WebView. 41 // gamepad_controller_ doesn't depend on WebView.
45 test_runner_->SetWebView(nullptr); 42 test_runner_->SetWebView(nullptr);
46 43
47 accessibility_controller_->SetDelegate(nullptr);
48 // gamepad_controller_ ignores SetDelegate(nullptr) 44 // gamepad_controller_ ignores SetDelegate(nullptr)
49 test_runner_->SetDelegate(nullptr); 45 test_runner_->SetDelegate(nullptr);
50 } 46 }
51 47
52 void TestInterfaces::SetWebView(blink::WebView* web_view, 48 void TestInterfaces::SetWebView(blink::WebView* web_view,
53 WebTestProxyBase* proxy) { 49 WebTestProxyBase* proxy) {
54 accessibility_controller_->SetWebView(web_view);
55 // gamepad_controller_ doesn't depend on WebView. 50 // gamepad_controller_ doesn't depend on WebView.
56 test_runner_->SetWebView(web_view); 51 test_runner_->SetWebView(web_view);
57 } 52 }
58 53
59 void TestInterfaces::SetDelegate(WebTestDelegate* delegate) { 54 void TestInterfaces::SetDelegate(WebTestDelegate* delegate) {
60 accessibility_controller_->SetDelegate(delegate);
61 gamepad_controller_ = GamepadController::Create(delegate); 55 gamepad_controller_ = GamepadController::Create(delegate);
62 test_runner_->SetDelegate(delegate); 56 test_runner_->SetDelegate(delegate);
63 delegate_ = delegate; 57 delegate_ = delegate;
64 } 58 }
65 59
66 void TestInterfaces::BindTo(blink::WebFrame* frame) { 60 void TestInterfaces::BindTo(blink::WebFrame* frame) {
67 accessibility_controller_->Install(frame);
68 if (gamepad_controller_) 61 if (gamepad_controller_)
69 gamepad_controller_->Install(frame); 62 gamepad_controller_->Install(frame);
70 test_runner_->Install(frame); 63 test_runner_->Install(frame);
71 GCController::Install(frame); 64 GCController::Install(frame);
72 } 65 }
73 66
74 void TestInterfaces::ResetTestHelperControllers() { 67 void TestInterfaces::ResetTestHelperControllers() {
75 accessibility_controller_->Reset();
76 if (gamepad_controller_) 68 if (gamepad_controller_)
77 gamepad_controller_->Reset(); 69 gamepad_controller_->Reset();
78 blink::WebCache::clear(); 70 blink::WebCache::clear();
79 71
80 for (WebTestProxyBase* web_test_proxy_base : window_list_) 72 for (WebTestProxyBase* web_test_proxy_base : window_list_)
81 web_test_proxy_base->Reset(); 73 web_test_proxy_base->Reset();
82 } 74 }
83 75
84 void TestInterfaces::ResetAll() { 76 void TestInterfaces::ResetAll() {
85 ResetTestHelperControllers(); 77 ResetTestHelperControllers();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void TestInterfaces::WindowClosed(WebTestProxyBase* proxy) { 125 void TestInterfaces::WindowClosed(WebTestProxyBase* proxy) {
134 std::vector<WebTestProxyBase*>::iterator pos = 126 std::vector<WebTestProxyBase*>::iterator pos =
135 std::find(window_list_.begin(), window_list_.end(), proxy); 127 std::find(window_list_.begin(), window_list_.end(), proxy);
136 if (pos == window_list_.end()) { 128 if (pos == window_list_.end()) {
137 NOTREACHED(); 129 NOTREACHED();
138 return; 130 return;
139 } 131 }
140 window_list_.erase(pos); 132 window_list_.erase(pos);
141 } 133 }
142 134
143 AccessibilityController* TestInterfaces::GetAccessibilityController() {
144 return accessibility_controller_.get();
145 }
146
147 TestRunner* TestInterfaces::GetTestRunner() { 135 TestRunner* TestInterfaces::GetTestRunner() {
148 return test_runner_.get(); 136 return test_runner_.get();
149 } 137 }
150 138
151 WebTestDelegate* TestInterfaces::GetDelegate() { 139 WebTestDelegate* TestInterfaces::GetDelegate() {
152 return delegate_; 140 return delegate_;
153 } 141 }
154 142
155 const std::vector<WebTestProxyBase*>& TestInterfaces::GetWindowList() { 143 const std::vector<WebTestProxyBase*>& TestInterfaces::GetWindowList() {
156 return window_list_; 144 return window_list_;
157 } 145 }
158 146
159 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { 147 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() {
160 if (!test_runner_->UseMockTheme()) 148 if (!test_runner_->UseMockTheme())
161 return 0; 149 return 0;
162 if (!theme_engine_.get()) 150 if (!theme_engine_.get())
163 theme_engine_.reset(new MockWebThemeEngine()); 151 theme_engine_.reset(new MockWebThemeEngine());
164 return theme_engine_.get(); 152 return theme_engine_.get();
165 } 153 }
166 154
167 AppBannerClient* TestInterfaces::GetAppBannerClient() { 155 AppBannerClient* TestInterfaces::GetAppBannerClient() {
168 return app_banner_client_; 156 return app_banner_client_;
169 } 157 }
170 158
171 } // namespace test_runner 159 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/test_interfaces.h ('k') | components/test_runner/web_frame_test_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698