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

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

Issue 2019423005: Move //components/ui/zoom to top-level under //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
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 "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/ui/browser_command_controller.h" 9 #include "chrome/browser/ui/browser_command_controller.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.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/browser_with_test_window_test.h" 12 #include "chrome/test/base/browser_with_test_window_test.h"
13 #include "components/ui/zoom/zoom_controller.h" 13 #include "components/zoom/zoom_controller.h"
14 #include "content/public/browser/site_instance.h" 14 #include "content/public/browser/site_instance.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/test/web_contents_tester.h" 16 #include "content/public/test/web_contents_tester.h"
17 17
18 using content::SiteInstance; 18 using content::SiteInstance;
19 using content::WebContents; 19 using content::WebContents;
20 using content::WebContentsTester; 20 using content::WebContentsTester;
21 21
22 class BrowserUnitTest : public BrowserWithTestWindowTest { 22 class BrowserUnitTest : public BrowserWithTestWindowTest {
23 public: 23 public:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_FALSE(chrome::CanPrint(browser())); 88 EXPECT_FALSE(chrome::CanPrint(browser()));
89 } 89 }
90 90
91 // Ensure the zoom-in and zoom-out commands get disabled when a tab crashes. 91 // Ensure the zoom-in and zoom-out commands get disabled when a tab crashes.
92 TEST_F(BrowserUnitTest, DisableZoomOnCrashedTab) { 92 TEST_F(BrowserUnitTest, DisableZoomOnCrashedTab) {
93 TabStripModel* tab_strip_model = browser()->tab_strip_model(); 93 TabStripModel* tab_strip_model = browser()->tab_strip_model();
94 94
95 WebContents* contents = CreateTestWebContents(); 95 WebContents* contents = CreateTestWebContents();
96 tab_strip_model->AppendWebContents(contents, true); 96 tab_strip_model->AppendWebContents(contents, true);
97 WebContentsTester::For(contents)->NavigateAndCommit(GURL("about:blank")); 97 WebContentsTester::For(contents)->NavigateAndCommit(GURL("about:blank"));
98 ui_zoom::ZoomController* zoom_controller = 98 zoom::ZoomController* zoom_controller =
99 ui_zoom::ZoomController::FromWebContents(contents); 99 zoom::ZoomController::FromWebContents(contents);
100 EXPECT_TRUE(zoom_controller->SetZoomLevel(zoom_controller-> 100 EXPECT_TRUE(zoom_controller->SetZoomLevel(zoom_controller->
101 GetDefaultZoomLevel())); 101 GetDefaultZoomLevel()));
102 102
103 CommandUpdater* command_updater = 103 CommandUpdater* command_updater =
104 browser()->command_controller()->command_updater(); 104 browser()->command_controller()->command_updater();
105 105
106 EXPECT_TRUE(zoom_controller->IsAtDefaultZoom()); 106 EXPECT_TRUE(zoom_controller->IsAtDefaultZoom());
107 EXPECT_FALSE(contents->IsCrashed()); 107 EXPECT_FALSE(contents->IsCrashed());
108 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ZOOM_PLUS)); 108 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ZOOM_PLUS));
109 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ZOOM_MINUS)); 109 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_ZOOM_MINUS));
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // Activate the 1st tab which is NTP. 218 // Activate the 1st tab which is NTP.
219 browser()->tab_strip_model()->ActivateTabAt(0, true); 219 browser()->tab_strip_model()->ActivateTabAt(0, true);
220 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); 220 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state());
221 EXPECT_EQ(BookmarkBar::SHOW, window_bookmark_bar_state()); 221 EXPECT_EQ(BookmarkBar::SHOW, window_bookmark_bar_state());
222 222
223 // Activate the 2nd tab which is non-NTP. 223 // Activate the 2nd tab which is non-NTP.
224 browser()->tab_strip_model()->ActivateTabAt(1, true); 224 browser()->tab_strip_model()->ActivateTabAt(1, true);
225 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state()); 225 EXPECT_EQ(BookmarkBar::SHOW, browser()->bookmark_bar_state());
226 EXPECT_EQ(BookmarkBar::SHOW, window_bookmark_bar_state()); 226 EXPECT_EQ(BookmarkBar::SHOW, window_bookmark_bar_state());
227 } 227 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_commands.cc ('k') | chrome/browser/ui/cocoa/app_menu/app_menu_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698