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

Side by Side Diff: content/public/test/browser_test_utils.cc

Issue 1934703002: Fix keyboard focus for OOPIF-<webview>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test flakiness and comments in PS 7,8. Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 uint32_t InputMsgWatcher::WaitForAck() { 1289 uint32_t InputMsgWatcher::WaitForAck() {
1290 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1290 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1291 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) 1291 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN)
1292 return ack_result_; 1292 return ack_result_;
1293 base::RunLoop run_loop; 1293 base::RunLoop run_loop;
1294 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); 1294 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure());
1295 run_loop.Run(); 1295 run_loop.Run();
1296 return ack_result_; 1296 return ack_result_;
1297 } 1297 }
1298 1298
1299 struct FrameFocusedObserver::FrameTreeNodeObserverImpl
alexmos 2016/06/24 01:38:50 Any reason why this is a struct and not a class?
alexmos 2016/07/26 21:08:30 Still have this question. :)
avallee 2016/07/27 21:35:01 Good point, it's not a POD and should be a class.
1300 : public FrameTreeNode::Observer {
1301 explicit FrameTreeNodeObserverImpl(FrameTreeNode* owner)
1302 : owner_(owner), message_loop_runner_(new MessageLoopRunner) {
1303 owner->AddObserver(this);
1304 }
1305 ~FrameTreeNodeObserverImpl() override { owner_->RemoveObserver(this); }
1306
1307 void Run() { message_loop_runner_->Run(); }
1308
1309 void OnFrameTreeNodeFocused(FrameTreeNode* node) override {
1310 if (node == owner_)
1311 message_loop_runner_->Quit();
1312 }
1313
1314 FrameTreeNode* owner_;
1315 scoped_refptr<MessageLoopRunner> message_loop_runner_;
1316 };
1317
1318 FrameFocusedObserver::FrameFocusedObserver(RenderFrameHost* owner_host)
1319 : impl_(new FrameTreeNodeObserverImpl(
1320 static_cast<RenderFrameHostImpl*>(owner_host)->frame_tree_node())) {}
1321
1322 FrameFocusedObserver::~FrameFocusedObserver() {}
1323
1324 void FrameFocusedObserver::Wait() {
1325 impl_->Run();
1326 }
1327
1299 } // namespace content 1328 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698