Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / base / test / scoped_fake_nswindow_focus.h
blobaafd715afb89c1690a2d929714fd9ce308694c48
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.
5 #ifndef UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_
6 #define UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_
8 #include "base/memory/scoped_ptr.h"
10 namespace base {
11 namespace mac {
12 class ScopedObjCClassSwizzler;
16 namespace ui {
17 namespace test {
19 // Simulates key and main status by listening for -makeKeyWindow and
20 // -makeMainWindow. This allows test coverage of code relying on window focus
21 // changes without resorting to an interactive_ui_test.
22 class ScopedFakeNSWindowFocus {
23 public:
24 ScopedFakeNSWindowFocus();
25 ~ScopedFakeNSWindowFocus();
27 private:
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_;
33 DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowFocus);
36 } // namespace test
37 } // namespace ui
39 #endif // UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FOCUS_H_