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_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ |
7 #pragma once | |
8 | 7 |
9 #include "content/public/browser/notification_service.h" | 8 #include "content/public/browser/notification_service.h" |
10 #include "chrome/common/chrome_notification_types.h" | 9 #include "chrome/common/chrome_notification_types.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
12 | 11 |
13 // Helper class to wait for a lazy background page to load and close again. | 12 // Helper class to wait for a lazy background page to load and close again. |
14 class LazyBackgroundObserver { | 13 class LazyBackgroundObserver { |
15 public: | 14 public: |
16 LazyBackgroundObserver() | 15 LazyBackgroundObserver() |
17 : page_created_(chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, | 16 : page_created_(chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, |
(...skipping 18 matching lines...) Expand all Loading... |
36 void WaitUntilClosed() { | 35 void WaitUntilClosed() { |
37 page_closed_.Wait(); | 36 page_closed_.Wait(); |
38 } | 37 } |
39 | 38 |
40 private: | 39 private: |
41 ui_test_utils::WindowedNotificationObserver page_created_; | 40 ui_test_utils::WindowedNotificationObserver page_created_; |
42 ui_test_utils::WindowedNotificationObserver page_closed_; | 41 ui_test_utils::WindowedNotificationObserver page_closed_; |
43 }; | 42 }; |
44 | 43 |
45 #endif // CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ | 44 #endif // CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_PAGE_TEST_UTIL_H_ |
OLD | NEW |