| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser_proxy.h" | 5 #include "chrome/test/automation/browser_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "chrome/common/automation_constants.h" | 13 #include "chrome/common/automation_constants.h" |
| 14 #include "chrome/common/automation_messages.h" | 14 #include "chrome/common/automation_messages.h" |
| 15 #include "chrome/test/automation/autocomplete_edit_proxy.h" | 15 #include "chrome/test/automation/autocomplete_edit_proxy.h" |
| 16 #include "chrome/test/automation/automation_proxy.h" | 16 #include "chrome/test/automation/automation_proxy.h" |
| 17 #include "chrome/test/automation/tab_proxy.h" | 17 #include "chrome/test/automation/tab_proxy.h" |
| 18 #include "chrome/test/automation/window_proxy.h" | 18 #include "chrome/test/automation/window_proxy.h" |
| 19 #include "gfx/point.h" | 19 #include "gfx/point.h" |
| 20 | 20 |
| 21 using base::TimeDelta; | 21 using base::TimeDelta; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 return success; | 201 return success; |
| 202 } | 202 } |
| 203 | 203 |
| 204 bool BrowserProxy::WaitForTabToBecomeActive(int tab, | 204 bool BrowserProxy::WaitForTabToBecomeActive(int tab, |
| 205 int wait_timeout) { | 205 int wait_timeout) { |
| 206 const TimeTicks start = TimeTicks::Now(); | 206 const TimeTicks start = TimeTicks::Now(); |
| 207 const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout); | 207 const TimeDelta timeout = TimeDelta::FromMilliseconds(wait_timeout); |
| 208 while (TimeTicks::Now() - start < timeout) { | 208 while (TimeTicks::Now() - start < timeout) { |
| 209 PlatformThread::Sleep(automation::kSleepTime); | 209 base::PlatformThread::Sleep(automation::kSleepTime); |
| 210 int active_tab; | 210 int active_tab; |
| 211 if (GetActiveTabIndex(&active_tab) && active_tab == tab) | 211 if (GetActiveTabIndex(&active_tab) && active_tab == tab) |
| 212 return true; | 212 return true; |
| 213 } | 213 } |
| 214 // If we get here, the active tab hasn't changed. | 214 // If we get here, the active tab hasn't changed. |
| 215 return false; | 215 return false; |
| 216 } | 216 } |
| 217 | 217 |
| 218 bool BrowserProxy::OpenFindInPage() { | 218 bool BrowserProxy::OpenFindInPage() { |
| 219 if (!is_valid()) | 219 if (!is_valid()) |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 if (i == 0) | 639 if (i == 0) |
| 640 *min_start_time = start_ms; | 640 *min_start_time = start_ms; |
| 641 | 641 |
| 642 *min_start_time = std::min(start_ms, *min_start_time); | 642 *min_start_time = std::min(start_ms, *min_start_time); |
| 643 *max_stop_time = std::max(stop_ms, *max_stop_time); | 643 *max_stop_time = std::max(stop_ms, *max_stop_time); |
| 644 stop_times->push_back(stop_ms); | 644 stop_times->push_back(stop_ms); |
| 645 } | 645 } |
| 646 std::sort(stop_times->begin(), stop_times->end()); | 646 std::sort(stop_times->begin(), stop_times->end()); |
| 647 return true; | 647 return true; |
| 648 } | 648 } |
| OLD | NEW |