OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <set> | 5 #include <set> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "chrome/test/ui/ui_test.h" | 8 #include "chrome/test/ui/ui_test.h" |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 return false; // Some error. | 369 return false; // Some error. |
370 if (visible) | 370 if (visible) |
371 return true; // Find window is visible. | 371 return true; // Find window is visible. |
372 | 372 |
373 // Give it a chance to catch up. | 373 // Give it a chance to catch up. |
374 Sleep(kWaitForActionMaxMsec / kCycles); | 374 Sleep(kWaitForActionMaxMsec / kCycles); |
375 } | 375 } |
376 return false; | 376 return false; |
377 } | 377 } |
378 | 378 |
| 379 bool UITest::WaitForBookmarkBarVisibilityChange(BrowserProxy* browser, |
| 380 bool wait_for_open) { |
| 381 const int kCycles = 20; |
| 382 for (int i = 0; i < kCycles; i++) { |
| 383 bool visible = false; |
| 384 bool animating = true; |
| 385 if (!browser->GetBookmarkBarVisibility(&visible, &animating)) |
| 386 return false; // Some error. |
| 387 if (visible == wait_for_open && !animating) |
| 388 return true; // Bookmark bar visibility change complete. |
| 389 |
| 390 // Give it a chance to catch up. |
| 391 Sleep(kWaitForActionMaxMsec / kCycles); |
| 392 } |
| 393 return false; |
| 394 } |
| 395 |
379 GURL UITest::GetActiveTabURL() { | 396 GURL UITest::GetActiveTabURL() { |
380 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); | 397 scoped_ptr<TabProxy> tab_proxy(GetActiveTab()); |
381 if (!tab_proxy.get()) | 398 if (!tab_proxy.get()) |
382 return GURL(); | 399 return GURL(); |
383 | 400 |
384 GURL url; | 401 GURL url; |
385 if (!tab_proxy->GetCurrentURL(&url)) | 402 if (!tab_proxy->GetCurrentURL(&url)) |
386 return GURL(); | 403 return GURL(); |
387 return url; | 404 return url; |
388 } | 405 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 size_t value, | 576 size_t value, |
560 const std::wstring& units, | 577 const std::wstring& units, |
561 bool important) { | 578 bool important) { |
562 wprintf(L"%lsRESULT %ls%ls: %ls= %d %ls\n", | 579 wprintf(L"%lsRESULT %ls%ls: %ls= %d %ls\n", |
563 important ? L"*" : L"", measurement.c_str(), modifier.c_str(), | 580 important ? L"*" : L"", measurement.c_str(), modifier.c_str(), |
564 trace.c_str(), value, units.c_str()); | 581 trace.c_str(), value, units.c_str()); |
565 } | 582 } |
566 | 583 |
567 | 584 |
568 | 585 |
OLD | NEW |