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> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
17 #include "base/scoped_temp_dir.h" | 17 #include "base/scoped_temp_dir.h" |
18 #include "base/string16.h" | 18 #include "base/string16.h" |
19 #include "chrome/browser/ui/view_ids.h" | 19 #include "chrome/browser/ui/view_ids.h" |
20 #include "chrome/test/automation/dom_element_proxy.h" | 20 #include "chrome/test/automation/dom_element_proxy.h" |
| 21 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
23 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
24 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
26 #include "ui/base/keycodes/keyboard_codes.h" | 27 #include "ui/base/keycodes/keyboard_codes.h" |
27 #include "ui/gfx/native_widget_types.h" | 28 #include "ui/gfx/native_widget_types.h" |
28 #include "webkit/glue/window_open_disposition.h" | 29 #include "webkit/glue/window_open_disposition.h" |
29 | 30 |
30 class AppModalDialog; | 31 class AppModalDialog; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // to what they were originally. Prefer this over MessageLoop::Run for in | 77 // to what they were originally. Prefer this over MessageLoop::Run for in |
77 // process browser tests that need to block until a condition is met. | 78 // process browser tests that need to block until a condition is met. |
78 void RunMessageLoop(); | 79 void RunMessageLoop(); |
79 | 80 |
80 // Turns on nestable tasks, runs all pending tasks in the message loop, | 81 // Turns on nestable tasks, runs all pending tasks in the message loop, |
81 // then resets nestable tasks to what they were originally. Prefer this | 82 // then resets nestable tasks to what they were originally. Prefer this |
82 // over MessageLoop::RunAllPending for in process browser tests to run | 83 // over MessageLoop::RunAllPending for in process browser tests to run |
83 // all pending tasks. | 84 // all pending tasks. |
84 void RunAllPendingInMessageLoop(); | 85 void RunAllPendingInMessageLoop(); |
85 | 86 |
| 87 // Blocks the current thread until all the pending messages in the loop of the |
| 88 // thread |thread_id| have been processed. |
| 89 void RunAllPendingInMessageLoop(content::BrowserThread::ID thread_id); |
| 90 |
86 // Puts the current tab title in |title|. Returns true on success. | 91 // Puts the current tab title in |title|. Returns true on success. |
87 bool GetCurrentTabTitle(const Browser* browser, string16* title); | 92 bool GetCurrentTabTitle(const Browser* browser, string16* title); |
88 | 93 |
89 // Waits for a new tab to be added to |browser|. TODO(gbillock): remove this | 94 // Waits for a new tab to be added to |browser|. TODO(gbillock): remove this |
90 // race hazard. Use WindowedNotificationObserver instead. | 95 // race hazard. Use WindowedNotificationObserver instead. |
91 void WaitForNewTab(Browser* browser); | 96 void WaitForNewTab(Browser* browser); |
92 | 97 |
93 // Waits for a |browser_action| to be updated. TODO(gbillock): remove this race | 98 // Waits for a |browser_action| to be updated. TODO(gbillock): remove this race |
94 // hazard. Use WindowedNotificationObserver instead. | 99 // hazard. Use WindowedNotificationObserver instead. |
95 void WaitForBrowserActionUpdated(ExtensionAction* browser_action); | 100 void WaitForBrowserActionUpdated(ExtensionAction* browser_action); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 559 |
555 // Takes a snapshot of the entire page, according to the width and height | 560 // 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 | 561 // properties of the DOM's document. Returns true on success. DOMAutomation |
557 // must be enabled. | 562 // must be enabled. |
558 bool TakeEntirePageSnapshot(RenderViewHost* rvh, | 563 bool TakeEntirePageSnapshot(RenderViewHost* rvh, |
559 SkBitmap* bitmap) WARN_UNUSED_RESULT; | 564 SkBitmap* bitmap) WARN_UNUSED_RESULT; |
560 | 565 |
561 } // namespace ui_test_utils | 566 } // namespace ui_test_utils |
562 | 567 |
563 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 568 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
OLD | NEW |