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

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

Issue 2581153003: Reland of Delay Input.dispatchKeyEvent response until after key event ack. (Closed)
Patch Set: rebase and resolve merge conflicts Created 4 years 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 | « content/public/test/browser_test_utils.h ('k') | 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 (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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 InputEventAckState ack_state = std::get<0>(params).state; 1523 InputEventAckState ack_state = std::get<0>(params).state;
1524 InputEventAckSource ack_source = std::get<0>(params).source; 1524 InputEventAckSource ack_source = std::get<0>(params).source;
1525 BrowserThread::PostTask( 1525 BrowserThread::PostTask(
1526 BrowserThread::UI, FROM_HERE, 1526 BrowserThread::UI, FROM_HERE,
1527 base::Bind(&InputMsgWatcher::ReceivedAck, this, ack_type, ack_state, 1527 base::Bind(&InputMsgWatcher::ReceivedAck, this, ack_type, ack_state,
1528 static_cast<uint32_t>(ack_source))); 1528 static_cast<uint32_t>(ack_source)));
1529 } 1529 }
1530 return false; 1530 return false;
1531 } 1531 }
1532 1532
1533 bool InputMsgWatcher::HasReceivedAck() const {
1534 return ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN;
1535 }
1536
1533 uint32_t InputMsgWatcher::WaitForAck() { 1537 uint32_t InputMsgWatcher::WaitForAck() {
1534 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1538 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1535 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) 1539 if (HasReceivedAck())
1536 return ack_result_; 1540 return ack_result_;
1537 base::RunLoop run_loop; 1541 base::RunLoop run_loop;
1538 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); 1542 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure());
1539 run_loop.Run(); 1543 run_loop.Run();
1540 return ack_result_; 1544 return ack_result_;
1541 } 1545 }
1542 1546
1543 #if defined(OS_WIN) 1547 #if defined(OS_WIN)
1544 static void RunTaskAndSignalCompletion(const base::Closure& task, 1548 static void RunTaskAndSignalCompletion(const base::Closure& task,
1545 base::WaitableEvent* completion) { 1549 base::WaitableEvent* completion) {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 IPC::IpcSecurityTestUtil::PwnMessageReceived( 1844 IPC::IpcSecurityTestUtil::PwnMessageReceived(
1841 process->GetChannel(), 1845 process->GetChannel(),
1842 FileSystemHostMsg_Write(request_id, file_path, blob_uuid, position)); 1846 FileSystemHostMsg_Write(request_id, file_path, blob_uuid, position));
1843 1847
1844 // If this started an async operation, wait for it to complete. 1848 // If this started an async operation, wait for it to complete.
1845 if (waiter.did_start_update()) 1849 if (waiter.did_start_update())
1846 waiter.WaitForEndUpdate(); 1850 waiter.WaitForEndUpdate();
1847 } 1851 }
1848 1852
1849 } // namespace content 1853 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698