Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc

Issue 1799223002: [Extensions] Fix BrowserActionInteractiveTest.TabSwitchClosesPopup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 281 }
282 282
283 // Test that the extension popup is closed on browser tab switches. 283 // Test that the extension popup is closed on browser tab switches.
284 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, TabSwitchClosesPopup) { 284 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, TabSwitchClosesPopup) {
285 if (!ShouldRunPopupTest()) 285 if (!ShouldRunPopupTest())
286 return; 286 return;
287 287
288 // Add a second tab to the browser and open an extension popup. 288 // Add a second tab to the browser and open an extension popup.
289 chrome::NewTab(browser()); 289 chrome::NewTab(browser());
290 ASSERT_EQ(2, browser()->tab_strip_model()->count()); 290 ASSERT_EQ(2, browser()->tab_strip_model()->count());
291 EXPECT_EQ(browser()->tab_strip_model()->GetWebContentsAt(1),
292 browser()->tab_strip_model()->GetActiveWebContents());
291 OpenExtensionPopupViaAPI(); 293 OpenExtensionPopupViaAPI();
292 294
293 // Press CTRL+TAB to change active tabs, the extension popup should close. 295 content::WindowedNotificationObserver observer(
294 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 296 extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED,
Devlin 2016/03/14 21:21:34 This strikes me as wrong in case this shortcut is
295 browser(), ui::VKEY_TAB, true, false, false, false)); 297 content::NotificationService::AllSources());
298 // Change active tabs, the extension popup should close.
299 browser()->tab_strip_model()->ActivateTabAt(0, true);
300 observer.Wait();
301
asargent_no_longer_on_chrome 2016/03/14 23:11:24 Is there any easy way to verify that the actual NO
Devlin 2016/03/15 00:07:04 Not an easy one. The source is a browser context
296 EXPECT_FALSE(BrowserActionTestUtil(browser()).HasPopup()); 302 EXPECT_FALSE(BrowserActionTestUtil(browser()).HasPopup());
297 } 303 }
298 304
299 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest, 305 IN_PROC_BROWSER_TEST_F(BrowserActionInteractiveTest,
300 DeleteBrowserActionWithPopupOpen) { 306 DeleteBrowserActionWithPopupOpen) {
301 if (!ShouldRunPopupTest()) 307 if (!ShouldRunPopupTest())
302 return; 308 return;
303 309
304 // First, we open a popup. 310 // First, we open a popup.
305 OpenExtensionPopupViaAPI(); 311 OpenExtensionPopupViaAPI();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 376
371 // Forcibly closing the browser HWND should not cause a crash. 377 // Forcibly closing the browser HWND should not cause a crash.
372 EXPECT_EQ(TRUE, ::CloseWindow(hwnd)); 378 EXPECT_EQ(TRUE, ::CloseWindow(hwnd));
373 EXPECT_EQ(TRUE, ::DestroyWindow(hwnd)); 379 EXPECT_EQ(TRUE, ::DestroyWindow(hwnd));
374 EXPECT_EQ(FALSE, ::IsWindow(hwnd)); 380 EXPECT_EQ(FALSE, ::IsWindow(hwnd));
375 } 381 }
376 #endif // OS_WIN 382 #endif // OS_WIN
377 383
378 } // namespace 384 } // namespace
379 } // namespace extensions 385 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698