| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_test_utils.h" | 5 #include "chrome/test/ui_test_utils.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 RegisterAndWait(&observer, NotificationType::TAB_ADDED, | 437 RegisterAndWait(&observer, NotificationType::TAB_ADDED, |
| 438 Source<Browser>(browser)); | 438 Source<Browser>(browser)); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void WaitForBrowserActionUpdated(ExtensionAction* browser_action) { | 441 void WaitForBrowserActionUpdated(ExtensionAction* browser_action) { |
| 442 TestNotificationObserver observer; | 442 TestNotificationObserver observer; |
| 443 RegisterAndWait(&observer, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, | 443 RegisterAndWait(&observer, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, |
| 444 Source<ExtensionAction>(browser_action)); | 444 Source<ExtensionAction>(browser_action)); |
| 445 } | 445 } |
| 446 | 446 |
| 447 void WaitForLoadStop(NavigationController* controller) { | 447 void WaitForLoadStop(TabContents* tab) { |
| 448 // In many cases, the load may have finished before we get here. Only wait if |
| 449 // the tab still has a pending navigation. |
| 450 if (!tab->is_loading() && !tab->render_manager()->pending_render_view_host()) |
| 451 return; |
| 448 TestNotificationObserver observer; | 452 TestNotificationObserver observer; |
| 449 RegisterAndWait(&observer, NotificationType::LOAD_STOP, | 453 RegisterAndWait(&observer, NotificationType::LOAD_STOP, |
| 450 Source<NavigationController>(controller)); | 454 Source<NavigationController>(&tab->controller())); |
| 451 } | 455 } |
| 452 | 456 |
| 453 Browser* WaitForNewBrowser() { | 457 Browser* WaitForNewBrowser() { |
| 454 TestNotificationObserver observer; | 458 TestNotificationObserver observer; |
| 455 RegisterAndWait(&observer, NotificationType::BROWSER_WINDOW_READY, | 459 RegisterAndWait(&observer, NotificationType::BROWSER_WINDOW_READY, |
| 456 NotificationService::AllSources()); | 460 NotificationService::AllSources()); |
| 457 return Source<Browser>(observer.source()).ptr(); | 461 return Source<Browser>(observer.source()).ptr(); |
| 458 } | 462 } |
| 459 | 463 |
| 460 Browser* WaitForBrowserNotInSet(std::set<Browser*> excluded_browsers) { | 464 Browser* WaitForBrowserNotInSet(std::set<Browser*> excluded_browsers) { |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 1074 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
| 1071 } | 1075 } |
| 1072 | 1076 |
| 1073 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 1077 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
| 1074 DCHECK(bitmap); | 1078 DCHECK(bitmap); |
| 1075 SnapshotTaker taker; | 1079 SnapshotTaker taker; |
| 1076 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 1080 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
| 1077 } | 1081 } |
| 1078 | 1082 |
| 1079 } // namespace ui_test_utils | 1083 } // namespace ui_test_utils |
| OLD | NEW |