| 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/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 bool wait_for_open) { | 530 bool wait_for_open) { |
| 531 const int kCycles = 20; | 531 const int kCycles = 20; |
| 532 for (int i = 0; i < kCycles; i++) { | 532 for (int i = 0; i < kCycles; i++) { |
| 533 bool visible = false; | 533 bool visible = false; |
| 534 if (!browser->IsFindWindowFullyVisible(&visible)) | 534 if (!browser->IsFindWindowFullyVisible(&visible)) |
| 535 return false; // Some error. | 535 return false; // Some error. |
| 536 if (visible == wait_for_open) | 536 if (visible == wait_for_open) |
| 537 return true; // Find window visibility change complete. | 537 return true; // Find window visibility change complete. |
| 538 | 538 |
| 539 // Give it a chance to catch up. | 539 // Give it a chance to catch up. |
| 540 Sleep(sleep_timeout_ms() / kCycles); | 540 PlatformThread::Sleep(sleep_timeout_ms() / kCycles); |
| 541 } | 541 } |
| 542 return false; | 542 return false; |
| 543 } | 543 } |
| 544 | 544 |
| 545 bool UITest::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, | 545 bool UITest::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, |
| 546 bool wait_for_open) { | 546 bool wait_for_open) { |
| 547 const int kCycles = 20; | 547 const int kCycles = 20; |
| 548 for (int i = 0; i < kCycles; i++) { | 548 for (int i = 0; i < kCycles; i++) { |
| 549 bool visible = false; | 549 bool visible = false; |
| 550 bool animating = true; | 550 bool animating = true; |
| 551 if (!browser->GetBookmarkBarVisibility(&visible, &animating)) | 551 if (!browser->GetBookmarkBarVisibility(&visible, &animating)) |
| 552 return false; // Some error. | 552 return false; // Some error. |
| 553 if (visible == wait_for_open && !animating) | 553 if (visible == wait_for_open && !animating) |
| 554 return true; // Bookmark bar visibility change complete. | 554 return true; // Bookmark bar visibility change complete. |
| 555 | 555 |
| 556 // Give it a chance to catch up. | 556 // Give it a chance to catch up. |
| 557 Sleep(sleep_timeout_ms() / kCycles); | 557 PlatformThread::Sleep(sleep_timeout_ms() / kCycles); |
| 558 } | 558 } |
| 559 return false; | 559 return false; |
| 560 } | 560 } |
| 561 #endif // defined(OS_WIN) | 561 #endif // defined(OS_WIN) |
| 562 | 562 |
| 563 GURL UITest::GetActiveTabURL() { | 563 GURL UITest::GetActiveTabURL() { |
| 564 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); | 564 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); |
| 565 if (!tab_proxy.get()) | 565 if (!tab_proxy.get()) |
| 566 return GURL(); | 566 return GURL(); |
| 567 | 567 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 } | 862 } |
| 863 | 863 |
| 864 bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) { | 864 bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) { |
| 865 for (int i = 0; i < 10; i++) { | 865 for (int i = 0; i < 10; i++) { |
| 866 if (file_util::EvictFileFromSystemCache(path)) | 866 if (file_util::EvictFileFromSystemCache(path)) |
| 867 return true; | 867 return true; |
| 868 PlatformThread::Sleep(1000); | 868 PlatformThread::Sleep(1000); |
| 869 } | 869 } |
| 870 return false; | 870 return false; |
| 871 } | 871 } |
| OLD | NEW |