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 "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/mac/sdk_forward_declarations.h" | 10 #include "base/mac/sdk_forward_declarations.h" |
11 #include "chrome/browser/apps/app_browsertest_util.h" | 11 #include "chrome/browser/apps/app_browsertest_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/extensions/app_launch_params.h" | |
14 #include "chrome/browser/ui/extensions/application_launch.h" | 13 #include "chrome/browser/ui/extensions/application_launch.h" |
15 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
16 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
17 #include "extensions/browser/app_window/app_window_registry.h" | 16 #include "extensions/browser/app_window/app_window_registry.h" |
18 #include "extensions/common/constants.h" | |
19 | 17 |
20 using extensions::PlatformAppBrowserTest; | 18 using extensions::PlatformAppBrowserTest; |
21 | 19 |
22 namespace { | 20 namespace { |
23 | 21 |
24 class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest { | 22 class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest { |
25 protected: | 23 protected: |
26 NativeAppWindowCocoaBrowserTest() {} | 24 NativeAppWindowCocoaBrowserTest() {} |
27 | 25 |
28 void SetUpAppWithWindows(int num_windows) { | 26 void SetUpAppWithWindows(int num_windows) { |
29 app_ = InstallExtension( | 27 app_ = InstallExtension( |
30 test_data_dir_.AppendASCII("platform_apps").AppendASCII("minimal"), 1); | 28 test_data_dir_.AppendASCII("platform_apps").AppendASCII("minimal"), 1); |
31 EXPECT_TRUE(app_); | 29 EXPECT_TRUE(app_); |
32 | 30 |
33 for (int i = 0; i < num_windows; ++i) { | 31 for (int i = 0; i < num_windows; ++i) { |
34 content::WindowedNotificationObserver app_loaded_observer( | 32 content::WindowedNotificationObserver app_loaded_observer( |
35 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 33 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
36 content::NotificationService::AllSources()); | 34 content::NotificationService::AllSources()); |
37 OpenApplication( | 35 OpenApplication( |
38 AppLaunchParams(profile(), app_, extensions::LAUNCH_CONTAINER_NONE, | 36 AppLaunchParams(profile(), |
39 NEW_WINDOW, extensions::SOURCE_UNTRACKED)); | 37 app_, |
| 38 extensions::LAUNCH_CONTAINER_NONE, |
| 39 NEW_WINDOW)); |
40 app_loaded_observer.Wait(); | 40 app_loaded_observer.Wait(); |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 const extensions::Extension* app_; | 44 const extensions::Extension* app_; |
45 | 45 |
46 private: | 46 private: |
47 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoaBrowserTest); | 47 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoaBrowserTest); |
48 }; | 48 }; |
49 | 49 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 watcher.reset([[ScopedNotificationWatcher alloc] | 203 watcher.reset([[ScopedNotificationWatcher alloc] |
204 initWithNotification:NSWindowDidExitFullScreenNotification | 204 initWithNotification:NSWindowDidExitFullScreenNotification |
205 andObject:ns_window]); | 205 andObject:ns_window]); |
206 [ns_window toggleFullScreen:nil]; | 206 [ns_window toggleFullScreen:nil]; |
207 [watcher waitForNotification]; | 207 [watcher waitForNotification]; |
208 EXPECT_EQ(extensions::AppWindow::FULLSCREEN_TYPE_NONE, | 208 EXPECT_EQ(extensions::AppWindow::FULLSCREEN_TYPE_NONE, |
209 app_window->fullscreen_types_for_test()); | 209 app_window->fullscreen_types_for_test()); |
210 EXPECT_FALSE(window->IsFullscreen()); | 210 EXPECT_FALSE(window->IsFullscreen()); |
211 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); | 211 EXPECT_FALSE([ns_window styleMask] & NSFullScreenWindowMask); |
212 } | 212 } |
OLD | NEW |