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

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

Issue 1886013002: Track focused view in TestRunner instead of in BlinkTestRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_test_runner.h » ('j') | 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 "components/test_runner/test_runner.h" 5 #include "components/test_runner/test_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 intercept_post_message_(false), 1573 intercept_post_message_(false),
1574 test_interfaces_(interfaces), 1574 test_interfaces_(interfaces),
1575 delegate_(nullptr), 1575 delegate_(nullptr),
1576 web_view_(nullptr), 1576 web_view_(nullptr),
1577 mock_content_settings_client_( 1577 mock_content_settings_client_(
1578 new MockContentSettingsClient(&layout_test_runtime_flags_)), 1578 new MockContentSettingsClient(&layout_test_runtime_flags_)),
1579 credential_manager_client_(new MockCredentialManagerClient), 1579 credential_manager_client_(new MockCredentialManagerClient),
1580 mock_screen_orientation_client_(new MockScreenOrientationClient), 1580 mock_screen_orientation_client_(new MockScreenOrientationClient),
1581 spellcheck_(new SpellCheckClient(this)), 1581 spellcheck_(new SpellCheckClient(this)),
1582 chooser_count_(0), 1582 chooser_count_(0),
1583 previously_focused_view_(nullptr),
1583 weak_factory_(this) {} 1584 weak_factory_(this) {}
1584 1585
1585 TestRunner::~TestRunner() {} 1586 TestRunner::~TestRunner() {}
1586 1587
1587 void TestRunner::Install(WebFrame* frame) { 1588 void TestRunner::Install(WebFrame* frame) {
1588 TestRunnerBindings::Install(weak_factory_.GetWeakPtr(), frame); 1589 TestRunnerBindings::Install(weak_factory_.GetWeakPtr(), frame);
1589 } 1590 }
1590 1591
1591 void TestRunner::SetDelegate(WebTestDelegate* delegate) { 1592 void TestRunner::SetDelegate(WebTestDelegate* delegate) {
1592 delegate_ = delegate; 1593 delegate_ = delegate;
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2877 2878
2878 void TestRunner::SetDatabaseQuota(int quota) { 2879 void TestRunner::SetDatabaseQuota(int quota) {
2879 delegate_->SetDatabaseQuota(quota); 2880 delegate_->SetDatabaseQuota(quota);
2880 } 2881 }
2881 2882
2882 void TestRunner::SetAlwaysAcceptCookies(bool accept) { 2883 void TestRunner::SetAlwaysAcceptCookies(bool accept) {
2883 delegate_->SetAcceptAllCookies(accept); 2884 delegate_->SetAcceptAllCookies(accept);
2884 } 2885 }
2885 2886
2886 void TestRunner::SetWindowIsKey(bool value) { 2887 void TestRunner::SetWindowIsKey(bool value) {
2887 delegate_->SetFocus(proxy_->web_view(), value); 2888 SetFocus(proxy_->web_view(), value);
2889 }
2890
2891 void TestRunner::SetFocus(blink::WebView* web_view, bool focus) {
2892 if (focus) {
2893 if (previously_focused_view_ != web_view) {
2894 delegate_->SetFocus(previously_focused_view_, false);
2895 delegate_->SetFocus(web_view, true);
2896 previously_focused_view_ = web_view;
2897 }
2898 } else {
2899 if (previously_focused_view_ == web_view) {
2900 delegate_->SetFocus(web_view, false);
2901 previously_focused_view_ = nullptr;
2902 }
2903 }
2888 } 2904 }
2889 2905
2890 std::string TestRunner::PathToLocalResource(const std::string& path) { 2906 std::string TestRunner::PathToLocalResource(const std::string& path) {
2891 return delegate_->PathToLocalResource(path); 2907 return delegate_->PathToLocalResource(path);
2892 } 2908 }
2893 2909
2894 void TestRunner::SetBackingScaleFactor(double value, 2910 void TestRunner::SetBackingScaleFactor(double value,
2895 v8::Local<v8::Function> callback) { 2911 v8::Local<v8::Function> callback) {
2896 delegate_->SetDeviceScaleFactor(value); 2912 delegate_->SetDeviceScaleFactor(value);
2897 PostV8Callback(callback); 2913 PostV8Callback(callback);
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
3257 } 3273 }
3258 3274
3259 void TestRunner::DidLosePointerLockInternal() { 3275 void TestRunner::DidLosePointerLockInternal() {
3260 bool was_locked = pointer_locked_; 3276 bool was_locked = pointer_locked_;
3261 pointer_locked_ = false; 3277 pointer_locked_ = false;
3262 if (was_locked) 3278 if (was_locked)
3263 web_view_->didLosePointerLock(); 3279 web_view_->didLosePointerLock();
3264 } 3280 }
3265 3281
3266 } // namespace test_runner 3282 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698