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

Side by Side Diff: chrome/browser/ui/browser_command_controller_browsertest.cc

Issue 12045037: Refactor modality-specific behavior from ConstrainedWindowViews to WebContentsModalDialogManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Android link error Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_cocoa.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/browser_command_controller.h" 5 #include "chrome/browser/ui/browser_command_controller.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
10 #include "chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h" 10 #include "chrome/browser/ui/tab_modal_confirm_dialog_browsertest.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" 11 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
13 #include "content/public/test/test_utils.h"
13 14
14 typedef InProcessBrowserTest BrowserCommandControllerBrowserTest; 15 typedef InProcessBrowserTest BrowserCommandControllerBrowserTest;
15 16
16 // Verify that showing a constrained window disables find. 17 // Verify that showing a constrained window disables find.
17 IN_PROC_BROWSER_TEST_F(BrowserCommandControllerBrowserTest, DisableFind) { 18 IN_PROC_BROWSER_TEST_F(BrowserCommandControllerBrowserTest, DisableFind) {
18 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND)); 19 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
19 20
20 // Showing constrained window should disable find. 21 // Showing constrained window should disable find.
21 content::WebContents* web_contents = 22 content::WebContents* web_contents =
22 browser()->tab_strip_model()->GetActiveWebContents(); 23 browser()->tab_strip_model()->GetActiveWebContents();
23 MockTabModalConfirmDialogDelegate* delegate = 24 MockTabModalConfirmDialogDelegate* delegate =
24 new MockTabModalConfirmDialogDelegate(web_contents, NULL); 25 new MockTabModalConfirmDialogDelegate(web_contents, NULL);
25 TabModalConfirmDialog::Create(delegate, web_contents); 26 TabModalConfirmDialog::Create(delegate, web_contents);
26 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FIND)); 27 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FIND));
27 28
28 // Switching to a new (unblocked) tab should reenable it. 29 // Switching to a new (unblocked) tab should reenable it.
29 AddBlankTabAndShow(browser()); 30 AddBlankTabAndShow(browser());
30 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND)); 31 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
31 32
32 // Switching back to the blocked tab should disable it again. 33 // Switching back to the blocked tab should disable it again.
33 browser()->tab_strip_model()->ActivateTabAt(0, false); 34 browser()->tab_strip_model()->ActivateTabAt(0, false);
34 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FIND)); 35 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_FIND));
35 36
36 // Closing the constrained window should reenable it. 37 // Closing the constrained window should reenable it.
37 delegate->Cancel(); 38 delegate->Cancel();
39 content::RunAllPendingInMessageLoop();
38 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND)); 40 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FIND));
39 } 41 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698