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

Side by Side Diff: content/shell/test_runner/test_interfaces.cc

Issue 2738513004: TestInterfaces: support delegate clearing. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/shell/test_runner/test_interfaces.h" 5 #include "content/shell/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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 test_runner_->SetDelegate(nullptr); 44 test_runner_->SetDelegate(nullptr);
45 } 45 }
46 46
47 void TestInterfaces::SetMainView(blink::WebView* web_view) { 47 void TestInterfaces::SetMainView(blink::WebView* web_view) {
48 // gamepad_controller_ doesn't depend on WebView. 48 // gamepad_controller_ doesn't depend on WebView.
49 main_view_ = web_view; 49 main_view_ = web_view;
50 test_runner_->SetMainView(web_view); 50 test_runner_->SetMainView(web_view);
51 } 51 }
52 52
53 void TestInterfaces::SetDelegate(WebTestDelegate* delegate) { 53 void TestInterfaces::SetDelegate(WebTestDelegate* delegate) {
54 gamepad_controller_ = GamepadController::Create(delegate); 54 if (delegate)
55 gamepad_controller_ = GamepadController::Create(delegate);
56 else
57 gamepad_controller_ = nullptr;
55 test_runner_->SetDelegate(delegate); 58 test_runner_->SetDelegate(delegate);
56 delegate_ = delegate; 59 delegate_ = delegate;
57 } 60 }
58 61
59 void TestInterfaces::BindTo(blink::WebFrame* frame) { 62 void TestInterfaces::BindTo(blink::WebFrame* frame) {
60 if (gamepad_controller_) 63 if (gamepad_controller_)
61 gamepad_controller_->Install(frame); 64 gamepad_controller_->Install(frame);
62 GCController::Install(frame); 65 GCController::Install(frame);
63 } 66 }
64 67
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 155
153 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { 156 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() {
154 if (!test_runner_->UseMockTheme()) 157 if (!test_runner_->UseMockTheme())
155 return 0; 158 return 0;
156 if (!theme_engine_.get()) 159 if (!theme_engine_.get())
157 theme_engine_.reset(new MockWebThemeEngine()); 160 theme_engine_.reset(new MockWebThemeEngine());
158 return theme_engine_.get(); 161 return theme_engine_.get();
159 } 162 }
160 163
161 } // namespace test_runner 164 } // namespace test_runner
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698