OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/extensions/extension_test_message_listener.h" | 7 #include "chrome/browser/extensions/extension_test_message_listener.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| 11 #include "chrome/common/chrome_notification_types.h" |
11 #include "chrome/test/ui_test_utils.h" | 12 #include "chrome/test/ui_test_utils.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 // Find a browser other than |browser|. | 16 // Find a browser other than |browser|. |
16 Browser* FindOtherBrowser(Browser* browser) { | 17 Browser* FindOtherBrowser(Browser* browser) { |
17 Browser* found = NULL; | 18 Browser* found = NULL; |
18 for (BrowserList::const_iterator it = BrowserList::begin(); | 19 for (BrowserList::const_iterator it = BrowserList::begin(); |
19 it != BrowserList::end(); ++it) { | 20 it != BrowserList::end(); ++it) { |
20 if (*it == browser) | 21 if (*it == browser) |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 Browser* app_browser = FindOtherBrowser(browser()); | 91 Browser* app_browser = FindOtherBrowser(browser()); |
91 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
92 ASSERT_TRUE(app_browser->is_type_panel()); | 93 ASSERT_TRUE(app_browser->is_type_panel()); |
93 #else | 94 #else |
94 ASSERT_TRUE(app_browser->is_type_popup()); | 95 ASSERT_TRUE(app_browser->is_type_popup()); |
95 #endif | 96 #endif |
96 ASSERT_TRUE(app_browser->is_app()); | 97 ASSERT_TRUE(app_browser->is_app()); |
97 | 98 |
98 // Close the app panel. | 99 // Close the app panel. |
99 ui_test_utils::WindowedNotificationObserver signal( | 100 ui_test_utils::WindowedNotificationObserver signal( |
100 NotificationType::BROWSER_CLOSED, | 101 chrome::NOTIFICATION_BROWSER_CLOSED, |
101 Source<Browser>(app_browser)); | 102 Source<Browser>(app_browser)); |
102 | 103 |
103 app_browser->CloseWindow(); | 104 app_browser->CloseWindow(); |
104 signal.Wait(); | 105 signal.Wait(); |
105 | 106 |
106 // Unload the extension. | 107 // Unload the extension. |
107 UninstallExtension(app_id); | 108 UninstallExtension(app_id); |
108 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); | 109 ASSERT_EQ(1u, BrowserList::GetBrowserCount(browser()->profile())); |
109 ASSERT_FALSE(service->GetExtensionById(app_id, true)); | 110 ASSERT_FALSE(service->GetExtensionById(app_id, true)); |
110 | 111 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 ASSERT_EQ(2, browser()->tab_count()); | 181 ASSERT_EQ(2, browser()->tab_count()); |
181 #else | 182 #else |
182 // Find the app's browser. Opening in a new window will create | 183 // Find the app's browser. Opening in a new window will create |
183 // a new browser. | 184 // a new browser. |
184 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); | 185 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); |
185 Browser* app_browser = FindOtherBrowser(browser()); | 186 Browser* app_browser = FindOtherBrowser(browser()); |
186 ASSERT_TRUE(app_browser->is_app()); | 187 ASSERT_TRUE(app_browser->is_app()); |
187 ASSERT_FALSE(app_browser->is_type_panel()); | 188 ASSERT_FALSE(app_browser->is_type_panel()); |
188 #endif | 189 #endif |
189 } | 190 } |
OLD | NEW |