| 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 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 InputEventAckState ack_state = std::get<0>(params).state; | 1512 InputEventAckState ack_state = std::get<0>(params).state; |
| 1513 InputEventAckSource ack_source = std::get<0>(params).source; | 1513 InputEventAckSource ack_source = std::get<0>(params).source; |
| 1514 BrowserThread::PostTask( | 1514 BrowserThread::PostTask( |
| 1515 BrowserThread::UI, FROM_HERE, | 1515 BrowserThread::UI, FROM_HERE, |
| 1516 base::Bind(&InputMsgWatcher::ReceivedAck, this, ack_type, ack_state, | 1516 base::Bind(&InputMsgWatcher::ReceivedAck, this, ack_type, ack_state, |
| 1517 static_cast<uint32_t>(ack_source))); | 1517 static_cast<uint32_t>(ack_source))); |
| 1518 } | 1518 } |
| 1519 return false; | 1519 return false; |
| 1520 } | 1520 } |
| 1521 | 1521 |
| 1522 bool InputMsgWatcher::HasReceivedAck() { |
| 1523 return ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN; |
| 1524 } |
| 1525 |
| 1522 uint32_t InputMsgWatcher::WaitForAck() { | 1526 uint32_t InputMsgWatcher::WaitForAck() { |
| 1523 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1527 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1524 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) | 1528 if (HasReceivedAck()) |
| 1525 return ack_result_; | 1529 return ack_result_; |
| 1526 base::RunLoop run_loop; | 1530 base::RunLoop run_loop; |
| 1527 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); | 1531 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); |
| 1528 run_loop.Run(); | 1532 run_loop.Run(); |
| 1529 return ack_result_; | 1533 return ack_result_; |
| 1530 } | 1534 } |
| 1531 | 1535 |
| 1532 #if defined(OS_WIN) | 1536 #if defined(OS_WIN) |
| 1533 static void RunTaskAndSignalCompletion(const base::Closure& task, | 1537 static void RunTaskAndSignalCompletion(const base::Closure& task, |
| 1534 base::WaitableEvent* completion) { | 1538 base::WaitableEvent* completion) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 | 1771 |
| 1768 std::string ascii_message = base::UTF16ToASCII(message); | 1772 std::string ascii_message = base::UTF16ToASCII(message); |
| 1769 if (base::MatchPattern(ascii_message, filter_)) { | 1773 if (base::MatchPattern(ascii_message, filter_)) { |
| 1770 message_ = ascii_message; | 1774 message_ = ascii_message; |
| 1771 message_loop_runner_->Quit(); | 1775 message_loop_runner_->Quit(); |
| 1772 } | 1776 } |
| 1773 return false; | 1777 return false; |
| 1774 } | 1778 } |
| 1775 | 1779 |
| 1776 } // namespace content | 1780 } // namespace content |
| OLD | NEW |