[Mac] Fake -[NSWindow toggleFullScreen:] to de-flake tests.
[chromium-blink-merge.git] / ui / base / test / scoped_fake_nswindow_fullscreen.h
blobe4bdca39fe546eacb3b3ce572740320fddd29613
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_FULLSCREEN_H_
6 #define UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FULLSCREEN_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
11 namespace ui {
12 namespace test {
14 // Simulates fullscreen transitions on NSWindows. This allows testing fullscreen
15 // logic without relying on the OS's fullscreen behavior as that tends to be
16 // flaky, even in interactive tests. We only allow one NSWindow per process to
17 // be fullscreen at a time, which should be sufficient for tests.
18 class ScopedFakeNSWindowFullscreen {
19 public:
20 // Impl class to hide Obj-C implementation from this header.
21 class Impl;
23 ScopedFakeNSWindowFullscreen();
24 ~ScopedFakeNSWindowFullscreen();
26 private:
27 scoped_ptr<Impl> impl_;
29 DISALLOW_COPY_AND_ASSIGN(ScopedFakeNSWindowFullscreen);
32 } // namespace test
33 } // namespace ui
35 #endif // UI_BASE_TEST_SCOPED_FAKE_NSWINDOW_FULLSCREEN_H_