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" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 "open_popup_succeeds.html")) << message_; | 256 "open_popup_succeeds.html")) << message_; |
257 frame_observer.Wait(); | 257 frame_observer.Wait(); |
258 EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); | 258 EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); |
259 | 259 |
260 // Press CTRL+TAB to change active tabs, the extension popup should close. | 260 // Press CTRL+TAB to change active tabs, the extension popup should close. |
261 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 261 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
262 browser(), ui::VKEY_TAB, true, false, false, false)); | 262 browser(), ui::VKEY_TAB, true, false, false, false)); |
263 EXPECT_FALSE(BrowserActionTestUtil(browser()).HasPopup()); | 263 EXPECT_FALSE(BrowserActionTestUtil(browser()).HasPopup()); |
264 } | 264 } |
265 | 265 |
| 266 #if defined(TOOLKIT_VIEWS) |
| 267 // Test closing the browser while inspecting an extension popup with dev tools. |
| 268 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, CloseBrowserWithDevTools) { |
| 269 if (!ShouldRunPopupTest()) |
| 270 return; |
| 271 |
| 272 // Load a first extension that can open a popup. |
| 273 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII( |
| 274 "browser_action/popup"))); |
| 275 const Extension* extension = GetSingleLoadedExtension(); |
| 276 ASSERT_TRUE(extension) << message_; |
| 277 |
| 278 // Open an extension popup by clicking the browser action button. |
| 279 content::WindowedNotificationObserver frame_observer( |
| 280 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 281 content::NotificationService::AllSources()); |
| 282 BrowserActionTestUtil(browser()).InspectPopup(0); |
| 283 frame_observer.Wait(); |
| 284 EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); |
| 285 |
| 286 // Close the browser window, this should not cause a crash. |
| 287 chrome::CloseWindow(browser()); |
| 288 } |
| 289 #endif // TOOLKIT_VIEWS |
| 290 |
266 } // namespace | 291 } // namespace |
267 } // namespace extensions | 292 } // namespace extensions |
OLD | NEW |