OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" | 5 #import "chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "apps/app_window_registry.h" | 9 #include "apps/app_window_registry.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 // Test interaction of Hide/Show() with Hide/ShowWithApp(). | 52 // Test interaction of Hide/Show() with Hide/ShowWithApp(). |
53 IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, HideShowWithApp) { | 53 IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, HideShowWithApp) { |
54 SetUpAppWithWindows(2); | 54 SetUpAppWithWindows(2); |
55 apps::AppWindowRegistry::AppWindowList windows = | 55 apps::AppWindowRegistry::AppWindowList windows = |
56 apps::AppWindowRegistry::Get(profile())->app_windows(); | 56 apps::AppWindowRegistry::Get(profile())->app_windows(); |
57 | 57 |
58 apps::AppWindow* app_window = windows.front(); | 58 apps::AppWindow* app_window = windows.front(); |
59 apps::NativeAppWindow* native_window = app_window->GetBaseWindow(); | 59 extensions::NativeAppWindow* native_window = app_window->GetBaseWindow(); |
60 NSWindow* ns_window = native_window->GetNativeWindow(); | 60 NSWindow* ns_window = native_window->GetNativeWindow(); |
61 | 61 |
62 apps::AppWindow* other_app_window = windows.back(); | 62 apps::AppWindow* other_app_window = windows.back(); |
63 apps::NativeAppWindow* other_native_window = | 63 extensions::NativeAppWindow* other_native_window = |
64 other_app_window->GetBaseWindow(); | 64 other_app_window->GetBaseWindow(); |
65 NSWindow* other_ns_window = other_native_window->GetNativeWindow(); | 65 NSWindow* other_ns_window = other_native_window->GetNativeWindow(); |
66 | 66 |
67 // Normal Hide/Show. | 67 // Normal Hide/Show. |
68 app_window->Hide(); | 68 app_window->Hide(); |
69 EXPECT_FALSE([ns_window isVisible]); | 69 EXPECT_FALSE([ns_window isVisible]); |
70 app_window->Show(apps::AppWindow::SHOW_ACTIVE); | 70 app_window->Show(apps::AppWindow::SHOW_ACTIVE); |
71 EXPECT_TRUE([ns_window isVisible]); | 71 EXPECT_TRUE([ns_window isVisible]); |
72 | 72 |
73 // Normal Hide/ShowWithApp. | 73 // Normal Hide/ShowWithApp. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 @end | 164 @end |
165 | 165 |
166 // Test that NativeAppWindow and AppWindow fullscreen state is updated when | 166 // Test that NativeAppWindow and AppWindow fullscreen state is updated when |
167 // the window is fullscreened natively. | 167 // the window is fullscreened natively. |
168 IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, Fullscreen) { | 168 IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, Fullscreen) { |
169 if (!base::mac::IsOSLionOrLater()) | 169 if (!base::mac::IsOSLionOrLater()) |
170 return; | 170 return; |
171 | 171 |
172 SetUpAppWithWindows(1); | 172 SetUpAppWithWindows(1); |
173 apps::AppWindow* app_window = GetFirstAppWindow(); | 173 apps::AppWindow* app_window = GetFirstAppWindow(); |
174 apps::NativeAppWindow* window = app_window->GetBaseWindow(); | 174 extensions::NativeAppWindow* window = app_window->GetBaseWindow(); |
175 NSWindow* ns_window = app_window->GetNativeWindow(); | 175 NSWindow* ns_window = app_window->GetNativeWindow(); |
176 base::scoped_nsobject<ScopedNotificationWatcher> watcher; | 176 base::scoped_nsobject<ScopedNotificationWatcher> watcher; |
177 | 177 |
178 EXPECT_EQ(apps::AppWindow::FULLSCREEN_TYPE_NONE, | 178 EXPECT_EQ(apps::AppWindow::FULLSCREEN_TYPE_NONE, |
179 app_window->fullscreen_types_for_test()); | 179 app_window->fullscreen_types_for_test()); |
180 EXPECT_FALSE(window->IsFullscreen()); | 180 EXPECT_FALSE(window->IsFullscreen()); |
181 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); | 181 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); |
182 | 182 |
183 watcher.reset([[ScopedNotificationWatcher alloc] | 183 watcher.reset([[ScopedNotificationWatcher alloc] |
184 initWithNotification:NSWindowDidEnterFullScreenNotification | 184 initWithNotification:NSWindowDidEnterFullScreenNotification |
(...skipping 30 matching lines...) Expand all Loading... |
215 watcher.reset([[ScopedNotificationWatcher alloc] | 215 watcher.reset([[ScopedNotificationWatcher alloc] |
216 initWithNotification:NSWindowDidExitFullScreenNotification | 216 initWithNotification:NSWindowDidExitFullScreenNotification |
217 andObject:ns_window]); | 217 andObject:ns_window]); |
218 [ns_window toggleFullScreen:nil]; | 218 [ns_window toggleFullScreen:nil]; |
219 [watcher waitForNotification]; | 219 [watcher waitForNotification]; |
220 EXPECT_EQ(apps::AppWindow::FULLSCREEN_TYPE_NONE, | 220 EXPECT_EQ(apps::AppWindow::FULLSCREEN_TYPE_NONE, |
221 app_window->fullscreen_types_for_test()); | 221 app_window->fullscreen_types_for_test()); |
222 EXPECT_FALSE(window->IsFullscreen()); | 222 EXPECT_FALSE(window->IsFullscreen()); |
223 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); | 223 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); |
224 } | 224 } |
OLD | NEW |