Chromium Code Reviews| Index: ui/base/test/scoped_fake_nswindow_focus.h |
| diff --git a/chrome/browser/ui/test/scoped_fake_nswindow_main_status.h b/ui/base/test/scoped_fake_nswindow_focus.h |
| similarity index 41% |
| rename from chrome/browser/ui/test/scoped_fake_nswindow_main_status.h |
| rename to ui/base/test/scoped_fake_nswindow_focus.h |
| index 0d4df98e61525a1931863516c289786261830b88..37db17f0fcaaa73c3a4b31e382d47f4672ebf995 100644 |
| --- a/chrome/browser/ui/test/scoped_fake_nswindow_main_status.h |
| +++ b/ui/base/test/scoped_fake_nswindow_focus.h |
| @@ -2,8 +2,8 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ |
| -#define CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ |
| +#ifndef CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_ |
|
tapted
2015/08/05 07:07:17
UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_
jackhou1
2015/08/06 00:22:30
Done.
|
| +#define CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_ |
| #include "base/memory/scoped_ptr.h" |
| @@ -13,11 +13,19 @@ class ScopedObjCClassSwizzler; |
| } |
| } |
| +#if defined(__OBJC__) |
| @class NSWindow; |
| +#else |
| +class NSWindow; |
| +#endif |
| -// Simulates a particular NSWindow to report YES for [NSWindow isMainWindow]. |
| -// This allows test coverage of code relying on window focus changes without |
| +namespace ui { |
| +namespace test { |
| + |
| +// These allow test coverage of code relying on window focus changes without |
| // resorting to an interactive_ui_test. |
| + |
| +// Simulates a particular NSWindow to report YES for -[NSWindow isMainWindow]. |
| class ScopedFakeNSWindowMainStatus { |
| public: |
| explicit ScopedFakeNSWindowMainStatus(NSWindow* window); |
| @@ -29,4 +37,20 @@ class ScopedFakeNSWindowMainStatus { |
| DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowMainStatus); |
| }; |
| -#endif // CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ |
| +// Simulates -[NSWindow isKeyWindow] by listening for -[NSWindow makeKeyWindow]. |
| +class ScopedFakeNSWindowKeyStatus { |
|
tapted
2015/08/05 07:07:17
Do we need both of these? (what happens if we merg
jackhou1
2015/08/06 00:22:30
Done.
|
| + public: |
| + ScopedFakeNSWindowKeyStatus(); |
| + ~ScopedFakeNSWindowKeyStatus(); |
| + |
| + private: |
| + scoped_ptr<base::mac::ScopedObjCClassSwizzler> is_key_swizzler_; |
| + scoped_ptr<base::mac::ScopedObjCClassSwizzler> make_key_swizzler_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowKeyStatus); |
| +}; |
| + |
| +} // namespace test |
| +} // namespace ui |
| + |
| +#endif // CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_ |