| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ui/views/widget/native_widget_mac.h" | 5 #include "ui/views/widget/native_widget_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #import "base/mac/mac_util.h" | 9 #import "base/mac/mac_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/base/test/ui_controls.h" |
| 12 #import "ui/base/test/windowed_nsnotification_observer.h" | 13 #import "ui/base/test/windowed_nsnotification_observer.h" |
| 13 #include "ui/views/test/test_widget_observer.h" | 14 #include "ui/views/test/test_widget_observer.h" |
| 14 #include "ui/views/test/widget_test.h" | 15 #include "ui/views/test/widget_test.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 namespace test { | 18 namespace test { |
| 18 | 19 |
| 19 // Tests for NativeWidgetMac that rely on global window manager state, and can | 20 // Tests for NativeWidgetMac that rely on global window manager state, and can |
| 20 // not be parallelized. | 21 // not be parallelized. |
| 21 class NativeWidgetMacInteractiveUITest | 22 class NativeWidgetMacInteractiveUITest |
| 22 : public WidgetTest, | 23 : public WidgetTest, |
| 23 public ::testing::WithParamInterface<bool> { | 24 public ::testing::WithParamInterface<bool> { |
| 24 public: | 25 public: |
| 25 class Observer; | 26 class Observer; |
| 26 | 27 |
| 27 NativeWidgetMacInteractiveUITest() | 28 NativeWidgetMacInteractiveUITest() |
| 28 : activationCount_(0), deactivationCount_(0) {} | 29 : activationCount_(0), deactivationCount_(0) { |
| 30 // TODO(tapted): Remove this when these are absorbed into Chrome's |
| 31 // interactive_ui_tests target. See http://crbug.com/403679. |
| 32 ui_controls::EnableUIControls(); |
| 33 } |
| 29 | 34 |
| 30 Widget* MakeWidget() { | 35 Widget* MakeWidget() { |
| 31 return GetParam() ? CreateTopLevelFramelessPlatformWidget() | 36 return GetParam() ? CreateTopLevelFramelessPlatformWidget() |
| 32 : CreateTopLevelPlatformWidget(); | 37 : CreateTopLevelPlatformWidget(); |
| 33 } | 38 } |
| 34 | 39 |
| 35 protected: | 40 protected: |
| 36 scoped_ptr<Observer> observer_; | 41 scoped_ptr<Observer> observer_; |
| 37 int activationCount_; | 42 int activationCount_; |
| 38 int deactivationCount_; | 43 int deactivationCount_; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 other_widget->CloseNow(); | 215 other_widget->CloseNow(); |
| 211 parent_widget->CloseNow(); | 216 parent_widget->CloseNow(); |
| 212 } | 217 } |
| 213 | 218 |
| 214 INSTANTIATE_TEST_CASE_P(NativeWidgetMacInteractiveUITestInstance, | 219 INSTANTIATE_TEST_CASE_P(NativeWidgetMacInteractiveUITestInstance, |
| 215 NativeWidgetMacInteractiveUITest, | 220 NativeWidgetMacInteractiveUITest, |
| 216 ::testing::Bool()); | 221 ::testing::Bool()); |
| 217 | 222 |
| 218 } // namespace test | 223 } // namespace test |
| 219 } // namespace views | 224 } // namespace views |
| OLD | NEW |