| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); | 289 DISALLOW_COPY_AND_ASSIGN(HistoryEnumerator); |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 // Use in browser interactive uitests to wait until a browser is set to active. | 292 // Use in browser interactive uitests to wait until a browser is set to active. |
| 293 // To use create and call WaitForActivation(). | 293 // To use create and call WaitForActivation(). |
| 294 // TODO(warx): check if code base exists the requirement for deactivation sync, | 294 // TODO(warx): check if code base exists the requirement for deactivation sync, |
| 295 // this class can be modified to support that. | 295 // this class can be modified to support that. |
| 296 class BrowserActivationWaiter : public chrome::BrowserListObserver { | 296 class BrowserActivationWaiter : public chrome::BrowserListObserver { |
| 297 public: | 297 public: |
| 298 explicit BrowserActivationWaiter(Browser* browser); | 298 explicit BrowserActivationWaiter(const Browser* browser); |
| 299 ~BrowserActivationWaiter() override; | 299 ~BrowserActivationWaiter() override; |
| 300 | 300 |
| 301 // Returns when the |browser_| which is supplied by the constructor becomes | 301 // Returns when the |browser_| which is supplied by the constructor becomes |
| 302 // activated. If it is not activated, a message loop is used until the | 302 // activated. If it is not activated, a message loop is used until the |
| 303 // |browser_| is activated, otherwise this returns immediately. | 303 // |browser_| is activated, otherwise this returns immediately. |
| 304 void WaitForActivation(); | 304 void WaitForActivation(); |
| 305 | 305 |
| 306 private: | 306 private: |
| 307 // chrome::BrowserListObserver override: | 307 // chrome::BrowserListObserver override: |
| 308 void OnBrowserSetLastActive(Browser* browser) override; | 308 void OnBrowserSetLastActive(Browser* browser) override; |
| 309 | 309 |
| 310 Browser* browser_; | 310 const Browser* browser_; |
| 311 bool observed_; | 311 bool observed_; |
| 312 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 312 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| 313 | 313 |
| 314 DISALLOW_COPY_AND_ASSIGN(BrowserActivationWaiter); | 314 DISALLOW_COPY_AND_ASSIGN(BrowserActivationWaiter); |
| 315 }; | 315 }; |
| 316 | 316 |
| 317 } // namespace ui_test_utils | 317 } // namespace ui_test_utils |
| 318 | 318 |
| 319 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ | 319 #endif // CHROME_TEST_BASE_UI_TEST_UTILS_H_ |
| OLD | NEW |