OLD | NEW |
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 Loading... |
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 | |
1537 uint32_t InputMsgWatcher::WaitForAck() { | 1533 uint32_t InputMsgWatcher::WaitForAck() { |
1538 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1534 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1539 if (HasReceivedAck()) | 1535 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) |
1540 return ack_result_; | 1536 return ack_result_; |
1541 base::RunLoop run_loop; | 1537 base::RunLoop run_loop; |
1542 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); | 1538 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); |
1543 run_loop.Run(); | 1539 run_loop.Run(); |
1544 return ack_result_; | 1540 return ack_result_; |
1545 } | 1541 } |
1546 | 1542 |
1547 #if defined(OS_WIN) | 1543 #if defined(OS_WIN) |
1548 static void RunTaskAndSignalCompletion(const base::Closure& task, | 1544 static void RunTaskAndSignalCompletion(const base::Closure& task, |
1549 base::WaitableEvent* completion) { | 1545 base::WaitableEvent* completion) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 IPC::IpcSecurityTestUtil::PwnMessageReceived( | 1840 IPC::IpcSecurityTestUtil::PwnMessageReceived( |
1845 process->GetChannel(), | 1841 process->GetChannel(), |
1846 FileSystemHostMsg_Write(request_id, file_path, blob_uuid, position)); | 1842 FileSystemHostMsg_Write(request_id, file_path, blob_uuid, position)); |
1847 | 1843 |
1848 // If this started an async operation, wait for it to complete. | 1844 // If this started an async operation, wait for it to complete. |
1849 if (waiter.did_start_update()) | 1845 if (waiter.did_start_update()) |
1850 waiter.WaitForEndUpdate(); | 1846 waiter.WaitForEndUpdate(); |
1851 } | 1847 } |
1852 | 1848 |
1853 } // namespace content | 1849 } // namespace content |
OLD | NEW |