| OLD | NEW |
| 1 // Copyright (c) 2006-2009 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" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 ASSERT_TRUE(tab_proxy.get()); | 498 ASSERT_TRUE(tab_proxy.get()); |
| 499 if (!tab_proxy.get()) | 499 if (!tab_proxy.get()) |
| 500 return; | 500 return; |
| 501 | 501 |
| 502 bool is_timeout = true; | 502 bool is_timeout = true; |
| 503 ASSERT_TRUE(tab_proxy->NavigateToURLWithTimeout( | 503 ASSERT_TRUE(tab_proxy->NavigateToURLWithTimeout( |
| 504 url, command_execution_timeout_ms(), &is_timeout)) << url.spec(); | 504 url, command_execution_timeout_ms(), &is_timeout)) << url.spec(); |
| 505 ASSERT_FALSE(is_timeout) << url.spec(); | 505 ASSERT_FALSE(is_timeout) << url.spec(); |
| 506 } | 506 } |
| 507 | 507 |
| 508 bool UITest::WaitForDownloadShelfVisible(TabProxy* tab) { | 508 bool UITest::WaitForDownloadShelfVisible(BrowserProxy* browser) { |
| 509 return WaitForDownloadShelfVisibilityChange(browser, true); |
| 510 } |
| 511 |
| 512 bool UITest::WaitForDownloadShelfInvisible(BrowserProxy* browser) { |
| 513 return WaitForDownloadShelfVisibilityChange(browser, false); |
| 514 } |
| 515 |
| 516 bool UITest::WaitForDownloadShelfVisibilityChange(BrowserProxy* browser, |
| 517 bool wait_for_open) { |
| 509 const int kCycles = 10; | 518 const int kCycles = 10; |
| 510 for (int i = 0; i < kCycles; i++) { | 519 for (int i = 0; i < kCycles; i++) { |
| 511 // Give it a chance to catch up. | 520 // Give it a chance to catch up. |
| 512 PlatformThread::Sleep(sleep_timeout_ms() / kCycles); | 521 PlatformThread::Sleep(sleep_timeout_ms() / kCycles); |
| 513 | 522 |
| 514 bool visible = false; | 523 bool visible = !wait_for_open; |
| 515 if (!tab->IsShelfVisible(&visible)) | 524 if (!browser->IsShelfVisible(&visible)) |
| 516 continue; | 525 continue; |
| 517 if (visible) | 526 if (visible == wait_for_open) |
| 518 return true; // Got the download shelf. | 527 return true; // Got the download shelf. |
| 519 } | 528 } |
| 520 return false; | 529 return false; |
| 521 } | 530 } |
| 522 | 531 |
| 523 // TODO(port): this #if effectively cuts out half of this file on | 532 // TODO(port): this #if effectively cuts out half of this file on |
| 524 // non-Windows platforms, and is a temporary hack to get things | 533 // non-Windows platforms, and is a temporary hack to get things |
| 525 // building. | 534 // building. |
| 526 #if defined(OS_WIN) | 535 #if defined(OS_WIN) |
| 527 bool UITest::WaitForFindWindowVisibilityChange(BrowserProxy* browser, | 536 bool UITest::WaitForFindWindowVisibilityChange(BrowserProxy* browser, |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 } | 878 } |
| 870 | 879 |
| 871 bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) { | 880 bool UITest::EvictFileFromSystemCacheWrapper(const FilePath& path) { |
| 872 for (int i = 0; i < 10; i++) { | 881 for (int i = 0; i < 10; i++) { |
| 873 if (file_util::EvictFileFromSystemCache(path)) | 882 if (file_util::EvictFileFromSystemCache(path)) |
| 874 return true; | 883 return true; |
| 875 PlatformThread::Sleep(sleep_timeout_ms() / 10); | 884 PlatformThread::Sleep(sleep_timeout_ms() / 10); |
| 876 } | 885 } |
| 877 return false; | 886 return false; |
| 878 } | 887 } |
| OLD | NEW |