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 #include "chrome/browser/extensions/browser_action_test_util.h" | 5 #include "chrome/browser/extensions/browser_action_test_util.h" |
6 #include "chrome/browser/extensions/extension_action.h" | 6 #include "chrome/browser/extensions/extension_action.h" |
7 #include "chrome/browser/extensions/extension_action_manager.h" | 7 #include "chrome/browser/extensions/extension_action_manager.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
11 #include "chrome/browser/extensions/extension_test_message_listener.h" | 11 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 12 #include "chrome/browser/sessions/session_tab_helper.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_commands.h" | 14 #include "chrome/browser/ui/browser_commands.h" |
14 #include "chrome/browser/ui/browser_finder.h" | 15 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/test/base/interactive_test_utils.h" | 19 #include "chrome/test/base/interactive_test_utils.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
21 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 if (!ShouldRunPopupTest()) | 196 if (!ShouldRunPopupTest()) |
196 return; | 197 return; |
197 | 198 |
198 OpenExtensionPopupViaAPI(); | 199 OpenExtensionPopupViaAPI(); |
199 ExtensionService* service = extensions::ExtensionSystem::Get( | 200 ExtensionService* service = extensions::ExtensionSystem::Get( |
200 browser()->profile())->extension_service(); | 201 browser()->profile())->extension_service(); |
201 ASSERT_FALSE( | 202 ASSERT_FALSE( |
202 service->GetExtensionById(last_loaded_extension_id(), false) | 203 service->GetExtensionById(last_loaded_extension_id(), false) |
203 ->permissions_data() | 204 ->permissions_data() |
204 ->HasAPIPermissionForTab( | 205 ->HasAPIPermissionForTab( |
205 SessionID::IdForTab( | 206 SessionTabHelper::IdForTab( |
206 browser()->tab_strip_model()->GetActiveWebContents()), | 207 browser()->tab_strip_model()->GetActiveWebContents()), |
207 APIPermission::kTab)); | 208 APIPermission::kTab)); |
208 } | 209 } |
209 | 210 |
210 // Test that the extension popup is closed when the browser window is clicked. | 211 // Test that the extension popup is closed when the browser window is clicked. |
211 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, BrowserClickClosesPopup1) { | 212 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, BrowserClickClosesPopup1) { |
212 if (!ShouldRunPopupTest()) | 213 if (!ShouldRunPopupTest()) |
213 return; | 214 return; |
214 | 215 |
215 // Open an extension popup via the chrome.browserAction.openPopup API. | 216 // Open an extension popup via the chrome.browserAction.openPopup API. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 342 |
342 // Forcibly closing the browser HWND should not cause a crash. | 343 // Forcibly closing the browser HWND should not cause a crash. |
343 EXPECT_EQ(TRUE, ::CloseWindow(hwnd)); | 344 EXPECT_EQ(TRUE, ::CloseWindow(hwnd)); |
344 EXPECT_EQ(TRUE, ::DestroyWindow(hwnd)); | 345 EXPECT_EQ(TRUE, ::DestroyWindow(hwnd)); |
345 EXPECT_EQ(FALSE, ::IsWindow(hwnd)); | 346 EXPECT_EQ(FALSE, ::IsWindow(hwnd)); |
346 } | 347 } |
347 #endif // OS_WIN | 348 #endif // OS_WIN |
348 | 349 |
349 } // namespace | 350 } // namespace |
350 } // namespace extensions | 351 } // namespace extensions |
OLD | NEW |