Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: ui/base/test/scoped_fake_nswindow_focus.h

Issue 1268293002: [MacViews] Fix AccessiblePaneViewTest.SetPaneFocusAndRestore. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dependent patch. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 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.
6 #define CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ 6 #define CHROME_BROWSER_UI_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 #if defined(__OBJC__)
16 @class NSWindow; 17 @class NSWindow;
18 #else
19 class NSWindow;
20 #endif
17 21
18 // Simulates a particular NSWindow to report YES for [NSWindow isMainWindow]. 22 namespace ui {
19 // This allows test coverage of code relying on window focus changes without 23 namespace test {
24
25 // These allow test coverage of code relying on window focus changes without
20 // resorting to an interactive_ui_test. 26 // resorting to an interactive_ui_test.
27
28 // Simulates a particular NSWindow to report YES for -[NSWindow isMainWindow].
21 class ScopedFakeNSWindowMainStatus { 29 class ScopedFakeNSWindowMainStatus {
22 public: 30 public:
23 explicit ScopedFakeNSWindowMainStatus(NSWindow* window); 31 explicit ScopedFakeNSWindowMainStatus(NSWindow* window);
24 ~ScopedFakeNSWindowMainStatus(); 32 ~ScopedFakeNSWindowMainStatus();
25 33
26 private: 34 private:
27 scoped_ptr<base::mac::ScopedObjCClassSwizzler> swizzler_; 35 scoped_ptr<base::mac::ScopedObjCClassSwizzler> swizzler_;
28 36
29 DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowMainStatus); 37 DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowMainStatus);
30 }; 38 };
31 39
32 #endif // CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_MAIN_STATUS_H_ 40 // Simulates -[NSWindow isKeyWindow] by listening for -[NSWindow makeKeyWindow].
41 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.
42 public:
43 ScopedFakeNSWindowKeyStatus();
44 ~ScopedFakeNSWindowKeyStatus();
45
46 private:
47 scoped_ptr<base::mac::ScopedObjCClassSwizzler> is_key_swizzler_;
48 scoped_ptr<base::mac::ScopedObjCClassSwizzler> make_key_swizzler_;
49
50 DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowKeyStatus);
51 };
52
53 } // namespace test
54 } // namespace ui
55
56 #endif // CHROME_BROWSER_UI_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698