| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UI_TEST_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ | 5 #ifndef UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_ |
| 6 #define CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ | 6 #define UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| 11 namespace mac { | 11 namespace mac { |
| 12 class ScopedObjCClassSwizzler; | 12 class ScopedObjCClassSwizzler; |
| 13 } | 13 } |
| 14 } | 14 } |
| 15 | 15 |
| 16 @class NSWindow; | 16 namespace ui { |
| 17 namespace test { |
| 17 | 18 |
| 18 // Simulates a particular NSWindow to report YES for [NSWindow isMainWindow]. | 19 // Simulates key and main status by listening for -makeKeyWindow and |
| 19 // This allows test coverage of code relying on window focus changes without | 20 // -makeMainWindow. This allows test coverage of code relying on window focus |
| 20 // resorting to an interactive_ui_test. | 21 // changes without resorting to an interactive_ui_test. |
| 21 class ScopedFakeNSWindowMainStatus { | 22 class ScopedFakeNSWindowFocus { |
| 22 public: | 23 public: |
| 23 explicit ScopedFakeNSWindowMainStatus(NSWindow* window); | 24 ScopedFakeNSWindowFocus(); |
| 24 ~ScopedFakeNSWindowMainStatus(); | 25 ~ScopedFakeNSWindowFocus(); |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 scoped_ptr<base::mac::ScopedObjCClassSwizzler> swizzler_; | 28 scoped_ptr<base::mac::ScopedObjCClassSwizzler> is_main_swizzler_; |
| 29 scoped_ptr<base::mac::ScopedObjCClassSwizzler> make_main_swizzler_; |
| 30 scoped_ptr<base::mac::ScopedObjCClassSwizzler> is_key_swizzler_; |
| 31 scoped_ptr<base::mac::ScopedObjCClassSwizzler> make_key_swizzler_; |
| 28 | 32 |
| 29 DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowMainStatus); | 33 DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowFocus); |
| 30 }; | 34 }; |
| 31 | 35 |
| 32 #endif // CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ | 36 } // namespace test |
| 37 } // namespace ui |
| 38 |
| 39 #endif // UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_ |
| OLD | NEW |