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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/test_runner.cc
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc
index 9e21c8f44070986010ee14907d2d3f8fd073fcc3..e6413cc17977ddf2506fe71e860a2538a2787e77 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -1580,6 +1580,7 @@ TestRunner::TestRunner(TestInterfaces* interfaces)
mock_screen_orientation_client_(new MockScreenOrientationClient),
spellcheck_(new SpellCheckClient(this)),
chooser_count_(0),
+ previously_focused_view_(nullptr),
weak_factory_(this) {}
TestRunner::~TestRunner() {}
@@ -2884,7 +2885,22 @@ void TestRunner::SetAlwaysAcceptCookies(bool accept) {
}
void TestRunner::SetWindowIsKey(bool value) {
- delegate_->SetFocus(proxy_->web_view(), value);
+ SetFocus(proxy_->web_view(), value);
+}
+
+void TestRunner::SetFocus(blink::WebView* web_view, bool focus) {
+ if (focus) {
+ if (previously_focused_view_ != web_view) {
+ delegate_->SetFocus(previously_focused_view_, false);
+ delegate_->SetFocus(web_view, true);
+ previously_focused_view_ = web_view;
+ }
+ } else {
+ if (previously_focused_view_ == web_view) {
+ delegate_->SetFocus(web_view, false);
+ previously_focused_view_ = nullptr;
+ }
+ }
}
std::string TestRunner::PathToLocalResource(const std::string& path) {
« 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