| 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/shell_window_registry.h" | 9 #include "apps/app_window_registry.h" |
| 10 #include "chrome/browser/apps/app_browsertest_util.h" | 10 #include "chrome/browser/apps/app_browsertest_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/extensions/application_launch.h" | 12 #include "chrome/browser/ui/extensions/application_launch.h" |
| 12 #include "chrome/browser/profiles/profile.h" | |
| 13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
| 14 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
| 15 | 15 |
| 16 using extensions::PlatformAppBrowserTest; | 16 using extensions::PlatformAppBrowserTest; |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest { | 20 class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest { |
| 21 protected: | 21 protected: |
| 22 NativeAppWindowCocoaBrowserTest() {} | 22 NativeAppWindowCocoaBrowserTest() {} |
| (...skipping 20 matching lines...) Expand all Loading... |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoaBrowserTest); | 45 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowCocoaBrowserTest); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 // Test interaction of Hide/Show() with Hide/ShowWithApp(). | 50 // Test interaction of Hide/Show() with Hide/ShowWithApp(). |
| 51 IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, HideShowWithApp) { | 51 IN_PROC_BROWSER_TEST_F(NativeAppWindowCocoaBrowserTest, HideShowWithApp) { |
| 52 SetUpAppWithWindows(2); | 52 SetUpAppWithWindows(2); |
| 53 apps::ShellWindowRegistry::ShellWindowList windows = | 53 apps::AppWindowRegistry::AppWindowList windows = |
| 54 apps::ShellWindowRegistry::Get(profile())->shell_windows(); | 54 apps::AppWindowRegistry::Get(profile())->app_windows(); |
| 55 apps::NativeAppWindow* window = windows.front()->GetBaseWindow(); | 55 apps::NativeAppWindow* window = windows.front()->GetBaseWindow(); |
| 56 NSWindow* ns_window = window->GetNativeWindow(); | 56 NSWindow* ns_window = window->GetNativeWindow(); |
| 57 apps::NativeAppWindow* other_window = windows.back()->GetBaseWindow(); | 57 apps::NativeAppWindow* other_window = windows.back()->GetBaseWindow(); |
| 58 NSWindow* other_ns_window = other_window->GetNativeWindow(); | 58 NSWindow* other_ns_window = other_window->GetNativeWindow(); |
| 59 | 59 |
| 60 // Normal Hide/Show. | 60 // Normal Hide/Show. |
| 61 window->Hide(); | 61 window->Hide(); |
| 62 EXPECT_FALSE([ns_window isVisible]); | 62 EXPECT_FALSE([ns_window isVisible]); |
| 63 window->Show(); | 63 window->Show(); |
| 64 EXPECT_TRUE([ns_window isVisible]); | 64 EXPECT_TRUE([ns_window isVisible]); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 other_window->Hide(); | 100 other_window->Hide(); |
| 101 EXPECT_FALSE([other_ns_window isVisible]); | 101 EXPECT_FALSE([other_ns_window isVisible]); |
| 102 | 102 |
| 103 // HideWithApp, ShowWithApp does not show the other window. | 103 // HideWithApp, ShowWithApp does not show the other window. |
| 104 window->HideWithApp(); | 104 window->HideWithApp(); |
| 105 EXPECT_FALSE([ns_window isVisible]); | 105 EXPECT_FALSE([ns_window isVisible]); |
| 106 window->ShowWithApp(); | 106 window->ShowWithApp(); |
| 107 EXPECT_TRUE([ns_window isVisible]); | 107 EXPECT_TRUE([ns_window isVisible]); |
| 108 EXPECT_FALSE([other_ns_window isVisible]); | 108 EXPECT_FALSE([other_ns_window isVisible]); |
| 109 } | 109 } |
| OLD | NEW |