Chromium Code Reviews| 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 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 5 #ifndef CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 6 #define CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 bool case_sensitive, | 222 bool case_sensitive, |
| 223 int* ordinal); | 223 int* ordinal); |
| 224 | 224 |
| 225 // Returns true if the View is focused. | 225 // Returns true if the View is focused. |
| 226 bool IsViewFocused(const Browser* browser, ViewID vid); | 226 bool IsViewFocused(const Browser* browser, ViewID vid); |
| 227 | 227 |
| 228 // Simulates a mouse click on a View in the browser. | 228 // Simulates a mouse click on a View in the browser. |
| 229 void ClickOnView(const Browser* browser, ViewID vid); | 229 void ClickOnView(const Browser* browser, ViewID vid); |
| 230 | 230 |
| 231 // Blocks until a notification for given |type| is received. | 231 // Blocks until a notification for given |type| is received. |
| 232 // TODO(gbillock): remove this race hazard. | |
| 233 // Use WindowedNotificationObserver instead. | |
| 232 void WaitForNotification(int type); | 234 void WaitForNotification(int type); |
| 233 | 235 |
| 234 // Blocks until a notification for given |type| from the specified |source| | 236 // Blocks until a notification for given |type| from the specified |source| |
| 235 // is received. | 237 // is received. |
| 238 // TODO(gbillock): remove this race hazard. | |
| 239 // Use WindowedNotificationObserver instead. | |
| 236 void WaitForNotificationFrom(int type, | 240 void WaitForNotificationFrom(int type, |
| 237 const NotificationSource& source); | 241 const NotificationSource& source); |
| 238 | 242 |
| 239 // Register |observer| for the given |type| and |source| and run | 243 // Register |observer| for the given |type| and |source| and run |
| 240 // the message loop until the observer posts a quit task. | 244 // the message loop until the observer posts a quit task. |
| 241 void RegisterAndWait(NotificationObserver* observer, | 245 void RegisterAndWait(NotificationObserver* observer, |
| 242 int type, | 246 int type, |
| 243 const NotificationSource& source); | 247 const NotificationSource& source); |
| 244 | 248 |
| 245 // Blocks until |model| finishes loading. | 249 // Blocks until |model| finishes loading. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 // WindowedNotificationObserver signal(...) | 401 // WindowedNotificationObserver signal(...) |
| 398 // PerformAction() | 402 // PerformAction() |
| 399 // signal.Wait() | 403 // signal.Wait() |
| 400 class WindowedNotificationObserver : public NotificationObserver { | 404 class WindowedNotificationObserver : public NotificationObserver { |
| 401 public: | 405 public: |
| 402 // Register to listen for notifications of the given type from either a | 406 // Register to listen for notifications of the given type from either a |
| 403 // specific source, or from all sources if |source| is | 407 // specific source, or from all sources if |source| is |
| 404 // NotificationService::AllSources(). | 408 // NotificationService::AllSources(). |
| 405 WindowedNotificationObserver(int notification_type, | 409 WindowedNotificationObserver(int notification_type, |
| 406 const NotificationSource& source); | 410 const NotificationSource& source); |
| 411 | |
|
Paweł Hajdan Jr.
2011/08/04 17:56:48
nit: I'd prefer not to add an empty line here.
Greg Billock
2011/08/11 22:57:45
Done.
| |
| 407 virtual ~WindowedNotificationObserver(); | 412 virtual ~WindowedNotificationObserver(); |
| 408 | 413 |
| 409 // Wait until the specified notification occurs. If the notification was | 414 // Wait until the specified notification occurs. If the notification was |
| 410 // emitted between the construction of this object and this call then it | 415 // emitted between the construction of this object and this call then it |
| 411 // returns immediately. | 416 // returns immediately. |
| 412 void Wait(); | 417 void Wait(); |
| 413 | 418 |
| 414 // WaitFor waits until the given notification type is received from the | 419 // WaitFor waits until the given notification type is received from the |
| 415 // given object. If the notification was emitted between the construction of | 420 // given object. If the notification was emitted between the construction of |
| 416 // this object and this call then it returns immediately. | 421 // this object and this call then it returns immediately. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 591 | 596 |
| 592 // Takes a snapshot of the entire page, according to the width and height | 597 // Takes a snapshot of the entire page, according to the width and height |
| 593 // properties of the DOM's document. Returns true on success. DOMAutomation | 598 // properties of the DOM's document. Returns true on success. DOMAutomation |
| 594 // must be enabled. | 599 // must be enabled. |
| 595 bool TakeEntirePageSnapshot(RenderViewHost* rvh, | 600 bool TakeEntirePageSnapshot(RenderViewHost* rvh, |
| 596 SkBitmap* bitmap) WARN_UNUSED_RESULT; | 601 SkBitmap* bitmap) WARN_UNUSED_RESULT; |
| 597 | 602 |
| 598 } // namespace ui_test_utils | 603 } // namespace ui_test_utils |
| 599 | 604 |
| 600 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 605 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| OLD | NEW |