OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "apps/shell_window_registry.h" | 7 #include "apps/shell_window_registry.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 const BrowserList* active_browser_list_; | 41 const BrowserList* active_browser_list_; |
42 }; | 42 }; |
43 | 43 |
44 // Test that if only a platform app window is open and no browser windows are | 44 // Test that if only a platform app window is open and no browser windows are |
45 // open then a reopen event does nothing. | 45 // open then a reopen event does nothing. |
46 IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest, | 46 IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest, |
47 PlatformAppReopenWithWindows) { | 47 PlatformAppReopenWithWindows) { |
48 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); | 48 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); |
49 NSUInteger old_window_count = [[NSApp windows] count]; | 49 NSUInteger old_window_count = [[NSApp windows] count]; |
50 EXPECT_EQ(1u, active_browser_list_->size()); | 50 EXPECT_EQ(1u, active_browser_list_->size()); |
51 BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:YES]; | 51 [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:YES]; |
| 52 // We do not EXPECT_TRUE the result here because the method |
| 53 // deminiaturizes windows manually rather than return YES and have |
| 54 // AppKit do it. |
52 | 55 |
53 EXPECT_TRUE(result); | |
54 EXPECT_EQ(old_window_count, [[NSApp windows] count]); | 56 EXPECT_EQ(old_window_count, [[NSApp windows] count]); |
55 EXPECT_EQ(1u, active_browser_list_->size()); | 57 EXPECT_EQ(1u, active_browser_list_->size()); |
56 } | 58 } |
57 | 59 |
58 IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest, | 60 IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest, |
59 ActivationFocusesBrowserWindow) { | 61 ActivationFocusesBrowserWindow) { |
60 base::scoped_nsobject<AppController> app_controller( | 62 base::scoped_nsobject<AppController> app_controller( |
61 [[AppController alloc] init]); | 63 [[AppController alloc] init]); |
62 | 64 |
63 ExtensionTestMessageListener listener("Launched", false); | 65 ExtensionTestMessageListener listener("Launched", false); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 EXPECT_FALSE(result); | 107 EXPECT_FALSE(result); |
106 EXPECT_EQ(2u, active_browser_list_->size()); | 108 EXPECT_EQ(2u, active_browser_list_->size()); |
107 | 109 |
108 Browser* browser = active_browser_list_->get(0); | 110 Browser* browser = active_browser_list_->get(0); |
109 GURL current_url = | 111 GURL current_url = |
110 browser->tab_strip_model()->GetActiveWebContents()->GetURL(); | 112 browser->tab_strip_model()->GetActiveWebContents()->GetURL(); |
111 EXPECT_EQ(GetAppURL(), current_url.spec()); | 113 EXPECT_EQ(GetAppURL(), current_url.spec()); |
112 } | 114 } |
113 | 115 |
114 } // namespace | 116 } // namespace |
OLD | NEW |