| 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 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 InputEventAckState ack_state = std::get<0>(params).state; | 1520 InputEventAckState ack_state = std::get<0>(params).state; |
| 1521 InputEventAckSource ack_source = std::get<0>(params).source; | 1521 InputEventAckSource ack_source = std::get<0>(params).source; |
| 1522 BrowserThread::PostTask( | 1522 BrowserThread::PostTask( |
| 1523 BrowserThread::UI, FROM_HERE, | 1523 BrowserThread::UI, FROM_HERE, |
| 1524 base::Bind(&InputMsgWatcher::ReceivedAck, this, ack_type, ack_state, | 1524 base::Bind(&InputMsgWatcher::ReceivedAck, this, ack_type, ack_state, |
| 1525 static_cast<uint32_t>(ack_source))); | 1525 static_cast<uint32_t>(ack_source))); |
| 1526 } | 1526 } |
| 1527 return false; | 1527 return false; |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 bool InputMsgWatcher::HasReceivedAck() const { |
| 1531 return ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN; |
| 1532 } |
| 1533 |
| 1530 uint32_t InputMsgWatcher::WaitForAck() { | 1534 uint32_t InputMsgWatcher::WaitForAck() { |
| 1531 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1535 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1532 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) | 1536 if (HasReceivedAck()) |
| 1533 return ack_result_; | 1537 return ack_result_; |
| 1534 base::RunLoop run_loop; | 1538 base::RunLoop run_loop; |
| 1535 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); | 1539 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); |
| 1536 run_loop.Run(); | 1540 run_loop.Run(); |
| 1537 return ack_result_; | 1541 return ack_result_; |
| 1538 } | 1542 } |
| 1539 | 1543 |
| 1540 #if defined(OS_WIN) | 1544 #if defined(OS_WIN) |
| 1541 static void RunTaskAndSignalCompletion(const base::Closure& task, | 1545 static void RunTaskAndSignalCompletion(const base::Closure& task, |
| 1542 base::WaitableEvent* completion) { | 1546 base::WaitableEvent* completion) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 IPC::IpcSecurityTestUtil::PwnMessageReceived( | 1841 IPC::IpcSecurityTestUtil::PwnMessageReceived( |
| 1838 process->GetChannel(), | 1842 process->GetChannel(), |
| 1839 FileSystemHostMsg_Write(request_id, file_path, blob_uuid, position)); | 1843 FileSystemHostMsg_Write(request_id, file_path, blob_uuid, position)); |
| 1840 | 1844 |
| 1841 // If this started an async operation, wait for it to complete. | 1845 // If this started an async operation, wait for it to complete. |
| 1842 if (waiter.did_start_update()) | 1846 if (waiter.did_start_update()) |
| 1843 waiter.WaitForEndUpdate(); | 1847 waiter.WaitForEndUpdate(); |
| 1844 } | 1848 } |
| 1845 | 1849 |
| 1846 } // namespace content | 1850 } // namespace content |
| OLD | NEW |