scoped_fake_nswindow_fullscreen.mm 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  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. #import "ui/base/test/scoped_fake_nswindow_fullscreen.h"
  5. #import <Cocoa/Cocoa.h>
  6. #include "base/bind.h"
  7. #import "base/mac/foundation_util.h"
  8. #import "base/mac/mac_util.h"
  9. #import "base/mac/scoped_nsobject.h"
  10. #import "base/mac/scoped_objc_class_swizzler.h"
  11. #include "base/run_loop.h"
  12. #include "base/task/current_thread.h"
  13. #include "base/threading/thread_task_runner_handle.h"
  14. #include "ui/base/cocoa/nswindow_test_util.h"
  15. namespace ui {
  16. namespace test {
  17. ScopedFakeNSWindowFullscreen::ScopedFakeNSWindowFullscreen() {
  18. instance_count_ += 1;
  19. ui::NSWindowFakedForTesting::SetEnabled(instance_count_ > 0);
  20. }
  21. ScopedFakeNSWindowFullscreen::~ScopedFakeNSWindowFullscreen() {
  22. instance_count_ -= 1;
  23. ui::NSWindowFakedForTesting::SetEnabled(instance_count_ > 0);
  24. }
  25. // static
  26. int ScopedFakeNSWindowFullscreen::instance_count_ = 0;
  27. } // namespace test
  28. } // namespace ui