| 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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 | 853 |
| 854 WindowedNotificationObserver::WindowedNotificationObserver( | 854 WindowedNotificationObserver::WindowedNotificationObserver( |
| 855 int notification_type, | 855 int notification_type, |
| 856 const NotificationSource& source) | 856 const NotificationSource& source) |
| 857 : seen_(false), | 857 : seen_(false), |
| 858 running_(false), | 858 running_(false), |
| 859 waiting_for_(source) { | 859 waiting_for_(source) { |
| 860 registrar_.Add(this, notification_type, waiting_for_); | 860 registrar_.Add(this, notification_type, waiting_for_); |
| 861 } | 861 } |
| 862 | 862 |
| 863 WindowedNotificationObserver::WindowedNotificationObserver( |
| 864 const NavigationController& controller) |
| 865 : seen_(false), |
| 866 running_(false), |
| 867 waiting_for_(Source<NavigationController>(&controller)) { |
| 868 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, waiting_for_); |
| 869 } |
| 870 |
| 871 WindowedNotificationObserver::WindowedNotificationObserver( |
| 872 const Browser& browser) |
| 873 : seen_(false), |
| 874 running_(false), |
| 875 waiting_for_(Source<NavigationController>( |
| 876 &browser.GetSelectedTabContentsWrapper()->controller())) { |
| 877 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, waiting_for_); |
| 878 } |
| 879 |
| 863 WindowedNotificationObserver::~WindowedNotificationObserver() {} | 880 WindowedNotificationObserver::~WindowedNotificationObserver() {} |
| 864 | 881 |
| 865 void WindowedNotificationObserver::Wait() { | 882 void WindowedNotificationObserver::Wait() { |
| 866 if (seen_ || (waiting_for_ == NotificationService::AllSources() && | 883 if (seen_ || (waiting_for_ == NotificationService::AllSources() && |
| 867 !sources_seen_.empty())) { | 884 !sources_seen_.empty())) { |
| 868 return; | 885 return; |
| 869 } | 886 } |
| 870 | 887 |
| 871 running_ = true; | 888 running_ = true; |
| 872 ui_test_utils::RunMessageLoop(); | 889 ui_test_utils::RunMessageLoop(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 1060 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
| 1044 } | 1061 } |
| 1045 | 1062 |
| 1046 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 1063 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
| 1047 DCHECK(bitmap); | 1064 DCHECK(bitmap); |
| 1048 SnapshotTaker taker; | 1065 SnapshotTaker taker; |
| 1049 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 1066 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
| 1050 } | 1067 } |
| 1051 | 1068 |
| 1052 } // namespace ui_test_utils | 1069 } // namespace ui_test_utils |
| OLD | NEW |