| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "chrome/browser/extensions/browser_action_test_util.h" | 6 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 7 #include "chrome/browser/extensions/extension_action.h" | 7 #include "chrome/browser/extensions/extension_action.h" |
| 8 #include "chrome/browser/extensions/extension_action_manager.h" | 8 #include "chrome/browser/extensions/extension_action_manager.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 EXPECT_TRUE(new_browser != NULL); | 110 EXPECT_TRUE(new_browser != NULL); |
| 111 | 111 |
| 112 // Flaky on non-aura linux http://crbug.com/309749 | 112 // Flaky on non-aura linux http://crbug.com/309749 |
| 113 #if !(defined(OS_LINUX) && !defined(USE_AURA)) | 113 #if !(defined(OS_LINUX) && !defined(USE_AURA)) |
| 114 ResultCatcher catcher; | 114 ResultCatcher catcher; |
| 115 { | 115 { |
| 116 content::WindowedNotificationObserver frame_observer( | 116 content::WindowedNotificationObserver frame_observer( |
| 117 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 117 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 118 content::NotificationService::AllSources()); | 118 content::NotificationService::AllSources()); |
| 119 // Show second popup in new window. | 119 // Show second popup in new window. |
| 120 listener.Reply(""); | 120 listener.Reply("show another"); |
| 121 frame_observer.Wait(); | 121 frame_observer.Wait(); |
| 122 EXPECT_TRUE(BrowserActionTestUtil(new_browser).HasPopup()); | 122 EXPECT_TRUE(BrowserActionTestUtil(new_browser).HasPopup()); |
| 123 } | 123 } |
| 124 ASSERT_TRUE(catcher.GetNextResult()) << message_; | 124 ASSERT_TRUE(catcher.GetNextResult()) << message_; |
| 125 #endif | 125 #endif |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Tests opening a popup in an incognito window. | 128 // Tests opening a popup in an incognito window. |
| 129 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, TestOpenPopupIncognito) { | 129 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, TestOpenPopupIncognito) { |
| 130 if (!ShouldRunPopupTest()) | 130 if (!ShouldRunPopupTest()) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 content::WindowedNotificationObserver frame_observer( | 207 content::WindowedNotificationObserver frame_observer( |
| 208 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 208 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 209 content::NotificationService::AllSources()); | 209 content::NotificationService::AllSources()); |
| 210 // Open popup in the first extension. | 210 // Open popup in the first extension. |
| 211 BrowserActionTestUtil(browser()).Press(0); | 211 BrowserActionTestUtil(browser()).Press(0); |
| 212 frame_observer.Wait(); | 212 frame_observer.Wait(); |
| 213 EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); | 213 EXPECT_TRUE(BrowserActionTestUtil(browser()).HasPopup()); |
| 214 | 214 |
| 215 ResultCatcher catcher; | 215 ResultCatcher catcher; |
| 216 // Return control to javascript to validate that opening a popup fails now. | 216 // Return control to javascript to validate that opening a popup fails now. |
| 217 listener.Reply(""); | 217 listener.Reply("show another"); |
| 218 ASSERT_TRUE(catcher.GetNextResult()) << message_; | 218 ASSERT_TRUE(catcher.GetNextResult()) << message_; |
| 219 } | 219 } |
| 220 | 220 |
| 221 // Test that openPopup does not grant tab permissions like for browser action | 221 // Test that openPopup does not grant tab permissions like for browser action |
| 222 // clicks if the activeTab permission is set. | 222 // clicks if the activeTab permission is set. |
| 223 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, | 223 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, |
| 224 TestOpenPopupDoesNotGrantTabPermissions) { | 224 TestOpenPopupDoesNotGrantTabPermissions) { |
| 225 if (!ShouldRunPopupTest()) | 225 if (!ShouldRunPopupTest()) |
| 226 return; | 226 return; |
| 227 | 227 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 | 376 |
| 377 // Forcibly closing the browser HWND should not cause a crash. | 377 // Forcibly closing the browser HWND should not cause a crash. |
| 378 EXPECT_EQ(TRUE, ::CloseWindow(hwnd)); | 378 EXPECT_EQ(TRUE, ::CloseWindow(hwnd)); |
| 379 EXPECT_EQ(TRUE, ::DestroyWindow(hwnd)); | 379 EXPECT_EQ(TRUE, ::DestroyWindow(hwnd)); |
| 380 EXPECT_EQ(FALSE, ::IsWindow(hwnd)); | 380 EXPECT_EQ(FALSE, ::IsWindow(hwnd)); |
| 381 } | 381 } |
| 382 #endif // OS_WIN | 382 #endif // OS_WIN |
| 383 | 383 |
| 384 } // namespace | 384 } // namespace |
| 385 } // namespace extensions | 385 } // namespace extensions |
| OLD | NEW |