| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 return source_; | 345 return source_; |
| 346 } | 346 } |
| 347 | 347 |
| 348 const content::NotificationDetails& details() const { | 348 const content::NotificationDetails& details() const { |
| 349 return details_; | 349 return details_; |
| 350 } | 350 } |
| 351 | 351 |
| 352 // content::NotificationObserver: | 352 // content::NotificationObserver: |
| 353 virtual void Observe(int type, | 353 virtual void Observe(int type, |
| 354 const content::NotificationSource& source, | 354 const content::NotificationSource& source, |
| 355 const content::NotificationDetails& details); | 355 const content::NotificationDetails& details) OVERRIDE; |
| 356 | 356 |
| 357 private: | 357 private: |
| 358 content::NotificationSource source_; | 358 content::NotificationSource source_; |
| 359 content::NotificationDetails details_; | 359 content::NotificationDetails details_; |
| 360 }; | 360 }; |
| 361 | 361 |
| 362 // A WindowedNotificationObserver allows code to watch for a notification | 362 // A WindowedNotificationObserver allows code to watch for a notification |
| 363 // over a window of time. Typically testing code will need to do something | 363 // over a window of time. Typically testing code will need to do something |
| 364 // like this: | 364 // like this: |
| 365 // PerformAction() | 365 // PerformAction() |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 DOMMessageQueue(); | 529 DOMMessageQueue(); |
| 530 virtual ~DOMMessageQueue(); | 530 virtual ~DOMMessageQueue(); |
| 531 | 531 |
| 532 // Wait for the next message to arrive. |message| will be set to the next | 532 // Wait for the next message to arrive. |message| will be set to the next |
| 533 // message, if not null. Returns true on success. | 533 // message, if not null. Returns true on success. |
| 534 bool WaitForMessage(std::string* message) WARN_UNUSED_RESULT; | 534 bool WaitForMessage(std::string* message) WARN_UNUSED_RESULT; |
| 535 | 535 |
| 536 // Overridden content::NotificationObserver methods. | 536 // Overridden content::NotificationObserver methods. |
| 537 virtual void Observe(int type, | 537 virtual void Observe(int type, |
| 538 const content::NotificationSource& source, | 538 const content::NotificationSource& source, |
| 539 const content::NotificationDetails& details); | 539 const content::NotificationDetails& details) OVERRIDE; |
| 540 | 540 |
| 541 private: | 541 private: |
| 542 content::NotificationRegistrar registrar_; | 542 content::NotificationRegistrar registrar_; |
| 543 std::queue<std::string> message_queue_; | 543 std::queue<std::string> message_queue_; |
| 544 bool waiting_for_message_; | 544 bool waiting_for_message_; |
| 545 | 545 |
| 546 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); | 546 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); |
| 547 }; | 547 }; |
| 548 | 548 |
| 549 // Takes a snapshot of the given render widget, rendered at |page_size|. The | 549 // Takes a snapshot of the given render widget, rendered at |page_size|. The |
| 550 // snapshot is set to |bitmap|. Returns true on success. | 550 // snapshot is set to |bitmap|. Returns true on success. |
| 551 bool TakeRenderWidgetSnapshot(RenderWidgetHost* rwh, | 551 bool TakeRenderWidgetSnapshot(RenderWidgetHost* rwh, |
| 552 const gfx::Size& page_size, | 552 const gfx::Size& page_size, |
| 553 SkBitmap* bitmap) WARN_UNUSED_RESULT; | 553 SkBitmap* bitmap) WARN_UNUSED_RESULT; |
| 554 | 554 |
| 555 // Takes a snapshot of the entire page, according to the width and height | 555 // Takes a snapshot of the entire page, according to the width and height |
| 556 // properties of the DOM's document. Returns true on success. DOMAutomation | 556 // properties of the DOM's document. Returns true on success. DOMAutomation |
| 557 // must be enabled. | 557 // must be enabled. |
| 558 bool TakeEntirePageSnapshot(RenderViewHost* rvh, | 558 bool TakeEntirePageSnapshot(RenderViewHost* rvh, |
| 559 SkBitmap* bitmap) WARN_UNUSED_RESULT; | 559 SkBitmap* bitmap) WARN_UNUSED_RESULT; |
| 560 | 560 |
| 561 } // namespace ui_test_utils | 561 } // namespace ui_test_utils |
| 562 | 562 |
| 563 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 563 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| OLD | NEW |