| 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" |
| 13 #include "chrome/browser/ui/extensions/application_launch.h" | 14 #include "chrome/browser/ui/extensions/application_launch.h" |
| 14 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 15 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
| 16 #include "extensions/browser/app_window/app_window_registry.h" | 17 #include "extensions/browser/app_window/app_window_registry.h" |
| 18 #include "extensions/common/constants.h" |
| 17 | 19 |
| 18 using extensions::PlatformAppBrowserTest; | 20 using extensions::PlatformAppBrowserTest; |
| 19 | 21 |
| 20 namespace { | 22 namespace { |
| 21 | 23 |
| 22 class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest { | 24 class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest { |
| 23 protected: | 25 protected: |
| 24 NativeAppWindowCocoaBrowserTest() {} | 26 NativeAppWindowCocoaBrowserTest() {} |
| 25 | 27 |
| 26 void SetUpAppWithWindows(int num_windows) { | 28 void SetUpAppWithWindows(int num_windows) { |
| 27 app_ = InstallExtension( | 29 app_ = InstallExtension( |
| 28 test_data_dir_.AppendASCII("platform_apps").AppendASCII("minimal"), 1); | 30 test_data_dir_.AppendASCII("platform_apps").AppendASCII("minimal"), 1); |
| 29 EXPECT_TRUE(app_); | 31 EXPECT_TRUE(app_); |
| 30 | 32 |
| 31 for (int i = 0; i < num_windows; ++i) { | 33 for (int i = 0; i < num_windows; ++i) { |
| 32 content::WindowedNotificationObserver app_loaded_observer( | 34 content::WindowedNotificationObserver app_loaded_observer( |
| 33 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 35 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 34 content::NotificationService::AllSources()); | 36 content::NotificationService::AllSources()); |
| 35 OpenApplication( | 37 OpenApplication( |
| 36 AppLaunchParams(profile(), | 38 AppLaunchParams(profile(), app_, extensions::LAUNCH_CONTAINER_NONE, |
| 37 app_, | 39 NEW_WINDOW, extensions::SOURCE_UNTRACKED)); |
| 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 |