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 "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
10 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 10 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
11 #include "chrome/browser/ui/panels/panel.h" | 11 #include "chrome/browser/ui/panels/panel.h" |
12 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
13 #include "content/public/test/test_utils.h" | 13 #include "content/public/test/test_utils.h" |
14 | 14 |
15 typedef BasePanelBrowserTest PanelCocoaBrowserTest; | 15 typedef BasePanelBrowserTest PanelCocoaBrowserTest; |
16 | 16 |
17 IN_PROC_BROWSER_TEST_F(PanelCocoaBrowserTest, MenuItems) { | 17 IN_PROC_BROWSER_TEST_F(PanelCocoaBrowserTest, MenuItems) { |
18 Panel* panel = CreatePanel("Panel"); | 18 Panel* panel = CreatePanel("Panel"); |
19 | 19 |
20 // Close main tabbed window. | 20 // Close main tabbed window. |
21 content::WindowedNotificationObserver signal( | 21 content::WindowedNotificationObserver signal( |
22 chrome::NOTIFICATION_BROWSER_CLOSED, | 22 chrome::NOTIFICATION_BROWSER_CLOSED, |
23 content::Source<Browser>(browser())); | 23 content::Source<Browser>(browser())); |
24 chrome::CloseWindow(browser()); | 24 chrome::CloseWindow(browser()); |
25 signal.Wait(); | 25 signal.Wait(); |
26 | 26 |
27 // There should be no browser windows. | 27 // There should be no browser windows. |
28 EXPECT_EQ(0u, BrowserList::size()); | 28 EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); |
29 | 29 |
30 // There should be one panel. | 30 // There should be one panel. |
31 EXPECT_EQ(1, PanelManager::GetInstance()->num_panels()); | 31 EXPECT_EQ(1, PanelManager::GetInstance()->num_panels()); |
32 | 32 |
33 NSMenu* mainMenu = [NSApp mainMenu]; | 33 NSMenu* mainMenu = [NSApp mainMenu]; |
34 EXPECT_TRUE(mainMenu); | 34 EXPECT_TRUE(mainMenu); |
35 | 35 |
36 // Chrome(0) File(1) .... | 36 // Chrome(0) File(1) .... |
37 // Get File submenu. It doesn't have a command id, fetch it by index. | 37 // Get File submenu. It doesn't have a command id, fetch it by index. |
38 NSMenu* fileSubmenu = [[[mainMenu itemArray] objectAtIndex:1] submenu]; | 38 NSMenu* fileSubmenu = [[[mainMenu itemArray] objectAtIndex:1] submenu]; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if ([i action] == @selector(performClose:)) { | 76 if ([i action] == @selector(performClose:)) { |
77 item = i; | 77 item = i; |
78 break; | 78 break; |
79 } | 79 } |
80 } | 80 } |
81 EXPECT_TRUE(item); | 81 EXPECT_TRUE(item); |
82 EXPECT_TRUE([item isEnabled]); | 82 EXPECT_TRUE([item isEnabled]); |
83 | 83 |
84 panel->Close(); | 84 panel->Close(); |
85 } | 85 } |
OLD | NEW |