OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "chrome/test/automation/autocomplete_edit_proxy.h" | 5 #include "chrome/test/automation/autocomplete_edit_proxy.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chrome/test/automation/automation_constants.h" | 9 #include "chrome/test/automation/automation_constants.h" |
10 #include "chrome/test/automation/automation_messages.h" | 10 #include "chrome/test/automation/automation_messages.h" |
11 #include "chrome/test/automation/automation_proxy.h" | 11 #include "chrome/test/automation/automation_proxy.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 bool AutocompleteEditProxy::WaitForQuery(int wait_timeout_ms) const { | 61 bool AutocompleteEditProxy::WaitForQuery(int wait_timeout_ms) const { |
62 const TimeTicks start = TimeTicks::Now(); | 62 const TimeTicks start = TimeTicks::Now(); |
63 const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout_ms); | 63 const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout_ms); |
64 bool query_in_progress; | 64 bool query_in_progress; |
65 while (TimeTicks::Now() - start < timeout) { | 65 while (TimeTicks::Now() - start < timeout) { |
66 if (IsQueryInProgress(&query_in_progress) && !query_in_progress) | 66 if (IsQueryInProgress(&query_in_progress) && !query_in_progress) |
67 return true; | 67 return true; |
68 Sleep(automation::kSleepTime); | 68 PlatformThread::Sleep(automation::kSleepTime); |
69 } | 69 } |
70 // If we get here the query is still in progress. | 70 // If we get here the query is still in progress. |
71 return false; | 71 return false; |
72 } | 72 } |
73 | 73 |
74 bool AutocompleteEditProxy::GetAutocompleteMatches(Matches* matches) const { | 74 bool AutocompleteEditProxy::GetAutocompleteMatches(Matches* matches) const { |
75 if (!is_valid()) | 75 if (!is_valid()) |
76 return false; | 76 return false; |
77 if (!matches) { | 77 if (!matches) { |
78 NOTREACHED(); | 78 NOTREACHED(); |
79 return false; | 79 return false; |
80 } | 80 } |
81 | 81 |
82 bool edit_exists = false; | 82 bool edit_exists = false; |
83 | 83 |
84 sender_->Send(new AutomationMsg_AutocompleteEditGetMatches( | 84 sender_->Send(new AutomationMsg_AutocompleteEditGetMatches( |
85 0, handle_, &edit_exists, matches)); | 85 0, handle_, &edit_exists, matches)); |
86 | 86 |
87 return edit_exists; | 87 return edit_exists; |
88 } | 88 } |
OLD | NEW |