| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 frame_observer.Wait(); | 283 frame_observer.Wait(); |
| 284 EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); | 284 EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); |
| 285 | 285 |
| 286 // Close the browser window, this should not cause a crash. | 286 // Close the browser window, this should not cause a crash. |
| 287 chrome::CloseWindow(browser()); | 287 chrome::CloseWindow(browser()); |
| 288 } | 288 } |
| 289 #endif // TOOLKIT_VIEWS | 289 #endif // TOOLKIT_VIEWS |
| 290 | 290 |
| 291 #if defined(OS_WIN) | 291 #if defined(OS_WIN) |
| 292 // Test that forcibly closing the browser and popup HWND does not cause a crash. | 292 // Test that forcibly closing the browser and popup HWND does not cause a crash. |
| 293 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, DestroyHWNDDoesNotCrash) { | 293 // http://crbug.com/400646 |
| 294 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, |
| 295 DISABLED_DestroyHWNDDoesNotCrash) { |
| 294 if (!ShouldRunPopupTest()) | 296 if (!ShouldRunPopupTest()) |
| 295 return; | 297 return; |
| 296 | 298 |
| 297 OpenExtensionPopupViaAPI(); | 299 OpenExtensionPopupViaAPI(); |
| 298 BrowserActionTestUtil test_util(browser()); | 300 BrowserActionTestUtil test_util(browser()); |
| 299 const gfx::NativeView view = test_util.GetPopupNativeView(); | 301 const gfx::NativeView view = test_util.GetPopupNativeView(); |
| 300 EXPECT_NE(static_cast<gfx::NativeView>(NULL), view); | 302 EXPECT_NE(static_cast<gfx::NativeView>(NULL), view); |
| 301 const HWND hwnd = views::HWNDForNativeView(view); | 303 const HWND hwnd = views::HWNDForNativeView(view); |
| 302 EXPECT_EQ(hwnd, | 304 EXPECT_EQ(hwnd, |
| 303 views::HWNDForNativeView(browser()->window()->GetNativeWindow())); | 305 views::HWNDForNativeView(browser()->window()->GetNativeWindow())); |
| 304 EXPECT_EQ(TRUE, ::IsWindow(hwnd)); | 306 EXPECT_EQ(TRUE, ::IsWindow(hwnd)); |
| 305 | 307 |
| 306 // Create a new browser window to prevent the message loop from terminating. | 308 // Create a new browser window to prevent the message loop from terminating. |
| 307 Browser* new_browser = chrome::FindBrowserWithWebContents( | 309 Browser* new_browser = chrome::FindBrowserWithWebContents( |
| 308 browser()->OpenURL(content::OpenURLParams( | 310 browser()->OpenURL(content::OpenURLParams( |
| 309 GURL("about:"), content::Referrer(), NEW_WINDOW, | 311 GURL("about:"), content::Referrer(), NEW_WINDOW, |
| 310 content::PAGE_TRANSITION_TYPED, false))); | 312 content::PAGE_TRANSITION_TYPED, false))); |
| 311 | 313 |
| 312 // Forcibly closing the browser HWND should not cause a crash. | 314 // Forcibly closing the browser HWND should not cause a crash. |
| 313 EXPECT_EQ(TRUE, ::CloseWindow(hwnd)); | 315 EXPECT_EQ(TRUE, ::CloseWindow(hwnd)); |
| 314 EXPECT_EQ(TRUE, ::DestroyWindow(hwnd)); | 316 EXPECT_EQ(TRUE, ::DestroyWindow(hwnd)); |
| 315 EXPECT_EQ(FALSE, ::IsWindow(hwnd)); | 317 EXPECT_EQ(FALSE, ::IsWindow(hwnd)); |
| 316 } | 318 } |
| 317 #endif // OS_WIN | 319 #endif // OS_WIN |
| 318 | 320 |
| 319 } // namespace | 321 } // namespace |
| 320 } // namespace extensions | 322 } // namespace extensions |
| OLD | NEW |