Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_APPS_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ | |
|
tapted
2015/05/12 06:15:43
This needs to be in a /test folder, or at the very
jackhou1
2015/05/14 02:59:13
Done. Moved to chrome/browser/ui/test.
| |
| 6 #define CHROME_BROWSER_UI_COCOA_APPS_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ | |
| 7 | |
| 8 #import "base/mac/scoped_objc_class_swizzler.h" | |
| 9 | |
| 10 @class NSWindow; | |
| 11 | |
| 12 // Simulates a particular NSWindow to report YES for [NSWindow isMainWindow]. | |
| 13 // This allows test coverage of code relying on window focus changes without | |
| 14 // resorting to an interactive_ui_test. | |
| 15 class ScopedFakeNSWindowMainStatus { | |
| 16 public: | |
| 17 explicit ScopedFakeNSWindowMainStatus(NSWindow* window); | |
| 18 ~ScopedFakeNSWindowMainStatus(); | |
| 19 | |
| 20 static NSWindow* GetMainWindow() { return window_; } | |
| 21 | |
| 22 private: | |
| 23 static NSWindow* window_; | |
|
tapted
2015/05/12 06:15:43
can this be moved to an anonymous namespace like g
jackhou1
2015/05/14 02:59:13
Done.
| |
| 24 base::mac::ScopedObjCClassSwizzler swizzler_; | |
| 25 | |
| 26 DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowMainStatus); | |
| 27 }; | |
| 28 | |
| 29 #endif // CHROME_BROWSER_UI_COCOA_APPS_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ | |
| OLD | NEW |