blob: f6cd8056ffeff308d856beb48053c207f587aa4a [file] [log] [blame]
[email protected]93cc27b2012-03-21 12:44:321// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]be3877f2009-01-14 15:51:102// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]1a3aba82010-11-08 23:52:545#include "chrome/app/chrome_command_ids.h"
[email protected]fa50dea02012-08-01 23:20:376#include "chrome/browser/bookmarks/bookmark_model_factory.h"
[email protected]d93dbd12014-08-04 23:42:537#include "chrome/browser/chrome_page_zoom.h"
[email protected]5d98294912012-06-27 22:57:408#include "chrome/browser/ui/browser_command_controller.h"
[email protected]a37d4b02012-06-25 21:56:109#include "chrome/browser/ui/browser_commands.h"
[email protected]0665ebe2013-02-13 09:53:1910#include "chrome/browser/ui/browser_finder.h"
[email protected]57892182012-12-03 19:15:3911#include "chrome/browser/ui/tabs/tab_strip_model.h"
[email protected]9423d9412009-04-14 22:13:5512#include "chrome/common/url_constants.h"
[email protected]a4ff9eae2011-08-01 19:58:1613#include "chrome/test/base/browser_with_test_window_test.h"
14#include "chrome/test/base/testing_profile.h"
[email protected]a90c8ca2014-05-20 17:16:0415#include "components/bookmarks/browser/bookmark_model.h"
16#include "components/bookmarks/test/bookmark_test_helpers.h"
wjmaclean7f63c6b2014-12-09 14:59:5517#include "components/ui/zoom/zoom_controller.h"
[email protected]cdcb1dee2012-01-04 00:46:2018#include "content/public/browser/navigation_controller.h"
[email protected]022af742011-12-28 18:37:2519#include "content/public/browser/navigation_entry.h"
[email protected]6acde6352012-01-04 16:52:2020#include "content/public/browser/web_contents.h"
[email protected]be3877f2009-01-14 15:51:1021
22typedef BrowserWithTestWindowTest BrowserCommandsTest;
23
tfarinaa0ec34e2015-01-12 18:46:4824using bookmarks::BookmarkModel;
[email protected]e5d549d2011-12-28 01:29:2025using content::OpenURLParams;
26using content::Referrer;
[email protected]6acde6352012-01-04 16:52:2027using content::WebContents;
wjmaclean7f63c6b2014-12-09 14:59:5528using ui_zoom::ZoomController;
[email protected]e5d549d2011-12-28 01:29:2029
[email protected]be3877f2009-01-14 15:51:1030// Tests IDC_SELECT_TAB_0, IDC_SELECT_NEXT_TAB, IDC_SELECT_PREVIOUS_TAB and
31// IDC_SELECT_LAST_TAB.
[email protected]6df642082009-08-13 22:31:3732TEST_F(BrowserCommandsTest, TabNavigationAccelerators) {
[email protected]8e09c7af2014-06-10 11:46:1733 GURL about_blank(url::kAboutBlankURL);
[email protected]9423d9412009-04-14 22:13:5534
[email protected]be3877f2009-01-14 15:51:1035 // Create three tabs.
[email protected]9423d9412009-04-14 22:13:5536 AddTab(browser(), about_blank);
37 AddTab(browser(), about_blank);
38 AddTab(browser(), about_blank);
[email protected]be3877f2009-01-14 15:51:1039
40 // Select the second tab.
[email protected]57892182012-12-03 19:15:3941 browser()->tab_strip_model()->ActivateTabAt(1, false);
[email protected]be3877f2009-01-14 15:51:1042
[email protected]5d98294912012-06-27 22:57:4043 CommandUpdater* updater = browser()->command_controller()->command_updater();
44
[email protected]be3877f2009-01-14 15:51:1045 // Navigate to the first tab using an accelerator.
[email protected]5d98294912012-06-27 22:57:4046 updater->ExecuteCommand(IDC_SELECT_TAB_0);
[email protected]57892182012-12-03 19:15:3947 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
[email protected]be3877f2009-01-14 15:51:1048
49 // Navigate to the second tab using the next accelerators.
[email protected]5d98294912012-06-27 22:57:4050 updater->ExecuteCommand(IDC_SELECT_NEXT_TAB);
[email protected]57892182012-12-03 19:15:3951 ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
[email protected]be3877f2009-01-14 15:51:1052
53 // Navigate back to the first tab using the previous accelerators.
[email protected]5d98294912012-06-27 22:57:4054 updater->ExecuteCommand(IDC_SELECT_PREVIOUS_TAB);
[email protected]57892182012-12-03 19:15:3955 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
[email protected]be3877f2009-01-14 15:51:1056
57 // Navigate to the last tab using the select last accelerator.
[email protected]5d98294912012-06-27 22:57:4058 updater->ExecuteCommand(IDC_SELECT_LAST_TAB);
[email protected]57892182012-12-03 19:15:3959 ASSERT_EQ(2, browser()->tab_strip_model()->active_index());
[email protected]be3877f2009-01-14 15:51:1060}
61
62// Tests IDC_DUPLICATE_TAB.
63TEST_F(BrowserCommandsTest, DuplicateTab) {
[email protected]9423d9412009-04-14 22:13:5564 GURL url1("http://foo/1");
65 GURL url2("http://foo/2");
66 GURL url3("http://foo/3");
[email protected]8fcc7bf2012-08-14 18:14:5067 GURL url4("http://foo/4");
[email protected]be3877f2009-01-14 15:51:1068
[email protected]8fcc7bf2012-08-14 18:14:5069 // Navigate to three urls, plus a pending URL that hasn't committed.
[email protected]9423d9412009-04-14 22:13:5570 AddTab(browser(), url1);
[email protected]0683cf62009-04-10 19:31:4071 NavigateAndCommitActiveTab(url2);
72 NavigateAndCommitActiveTab(url3);
[email protected]8fcc7bf2012-08-14 18:14:5073 content::NavigationController& orig_controller =
[email protected]57892182012-12-03 19:15:3974 browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
[email protected]8fcc7bf2012-08-14 18:14:5075 orig_controller.LoadURL(
Sylvain Defresnec6ccc77d2014-09-19 10:19:3576 url4, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
[email protected]8fcc7bf2012-08-14 18:14:5077 EXPECT_EQ(3, orig_controller.GetEntryCount());
78 EXPECT_TRUE(orig_controller.GetPendingEntry());
[email protected]be3877f2009-01-14 15:51:1079
[email protected]0665ebe2013-02-13 09:53:1980 size_t initial_window_count = chrome::GetTotalBrowserCount();
[email protected]be3877f2009-01-14 15:51:1081
82 // Duplicate the tab.
[email protected]5d98294912012-06-27 22:57:4083 chrome::ExecuteCommand(browser(), IDC_DUPLICATE_TAB);
[email protected]be3877f2009-01-14 15:51:1084
85 // The duplicated tab should not end up in a new window.
[email protected]0665ebe2013-02-13 09:53:1986 size_t window_count = chrome::GetTotalBrowserCount();
[email protected]be3877f2009-01-14 15:51:1087 ASSERT_EQ(initial_window_count, window_count);
88
89 // And we should have a newly duplicated tab.
[email protected]57892182012-12-03 19:15:3990 ASSERT_EQ(2, browser()->tab_strip_model()->count());
[email protected]be3877f2009-01-14 15:51:1091
92 // Verify the stack of urls.
[email protected]cdcb1dee2012-01-04 00:46:2093 content::NavigationController& controller =
[email protected]57892182012-12-03 19:15:3994 browser()->tab_strip_model()->GetWebContentsAt(1)->GetController();
[email protected]8fcc7bf2012-08-14 18:14:5095 EXPECT_EQ(3, controller.GetEntryCount());
96 EXPECT_EQ(2, controller.GetCurrentEntryIndex());
97 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
98 EXPECT_EQ(url2, controller.GetEntryAtIndex(1)->GetURL());
99 EXPECT_EQ(url3, controller.GetEntryAtIndex(2)->GetURL());
100 EXPECT_FALSE(controller.GetPendingEntry());
101}
102
103// Tests IDC_VIEW_SOURCE (See http://crbug.com/138140).
104TEST_F(BrowserCommandsTest, ViewSource) {
105 GURL url1("http://foo/1");
106 GURL url2("http://foo/2");
107
108 // Navigate to a URL, plus a pending URL that hasn't committed.
109 AddTab(browser(), url1);
110 content::NavigationController& orig_controller =
[email protected]57892182012-12-03 19:15:39111 browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
[email protected]8fcc7bf2012-08-14 18:14:50112 orig_controller.LoadURL(
Sylvain Defresnec6ccc77d2014-09-19 10:19:35113 url2, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
[email protected]8fcc7bf2012-08-14 18:14:50114 EXPECT_EQ(1, orig_controller.GetEntryCount());
115 EXPECT_TRUE(orig_controller.GetPendingEntry());
116
[email protected]0665ebe2013-02-13 09:53:19117 size_t initial_window_count = chrome::GetTotalBrowserCount();
[email protected]8fcc7bf2012-08-14 18:14:50118
119 // View Source.
120 chrome::ExecuteCommand(browser(), IDC_VIEW_SOURCE);
121
122 // The view source tab should not end up in a new window.
[email protected]0665ebe2013-02-13 09:53:19123 size_t window_count = chrome::GetTotalBrowserCount();
[email protected]8fcc7bf2012-08-14 18:14:50124 ASSERT_EQ(initial_window_count, window_count);
125
126 // And we should have a newly duplicated tab.
[email protected]57892182012-12-03 19:15:39127 ASSERT_EQ(2, browser()->tab_strip_model()->count());
[email protected]8fcc7bf2012-08-14 18:14:50128
129 // Verify we are viewing the source of the last committed entry.
130 GURL view_source_url("view-source:http://foo/1");
131 content::NavigationController& controller =
[email protected]57892182012-12-03 19:15:39132 browser()->tab_strip_model()->GetWebContentsAt(1)->GetController();
[email protected]8fcc7bf2012-08-14 18:14:50133 EXPECT_EQ(1, controller.GetEntryCount());
134 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
135 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
136 EXPECT_EQ(view_source_url, controller.GetEntryAtIndex(0)->GetVirtualURL());
137 EXPECT_FALSE(controller.GetPendingEntry());
[email protected]be3877f2009-01-14 15:51:10138}
[email protected]b7ca4e62009-01-23 20:37:29139
140TEST_F(BrowserCommandsTest, BookmarkCurrentPage) {
141 // We use profile() here, since it's a TestingProfile.
142 profile()->CreateBookmarkModel(true);
[email protected]1f9c74192013-03-25 23:04:35143
144 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
tfarina8f4aae22014-10-23 17:46:11145 bookmarks::test::WaitForBookmarkModelToLoad(model);
[email protected]b7ca4e62009-01-23 20:37:29146
147 // Navigate to a url.
[email protected]9423d9412009-04-14 22:13:55148 GURL url1("http://foo/1");
149 AddTab(browser(), url1);
[email protected]e5d549d2011-12-28 01:29:20150 browser()->OpenURL(OpenURLParams(
Sylvain Defresnec6ccc77d2014-09-19 10:19:35151 url1, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false));
[email protected]b7ca4e62009-01-23 20:37:29152
deepak.m154a7f392014-12-15 04:41:43153 chrome::BookmarkCurrentPageAllowingExtensionOverrides(browser());
[email protected]b7ca4e62009-01-23 20:37:29154
155 // It should now be bookmarked in the bookmark model.
156 EXPECT_EQ(profile(), browser()->profile());
[email protected]1f9c74192013-03-25 23:04:35157 EXPECT_TRUE(model->IsBookmarked(url1));
[email protected]b7ca4e62009-01-23 20:37:29158}
[email protected]e21e8c92009-04-29 02:42:09159
160// Tests back/forward in new tab (Control + Back/Forward button in the UI).
161TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
162 GURL url1("http://foo/1");
163 GURL url2("http://foo/2");
164
165 // Make a tab with the two pages navigated in it.
166 AddTab(browser(), url1);
167 NavigateAndCommitActiveTab(url2);
168
169 // Go back in a new background tab.
[email protected]a37d4b02012-06-25 21:56:10170 chrome::GoBack(browser(), NEW_BACKGROUND_TAB);
[email protected]57892182012-12-03 19:15:39171 EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
172 ASSERT_EQ(2, browser()->tab_strip_model()->count());
[email protected]e21e8c92009-04-29 02:42:09173
[email protected]57892182012-12-03 19:15:39174 WebContents* zeroth = browser()->tab_strip_model()->GetWebContentsAt(0);
[email protected]e022aca2013-07-18 19:10:18175 WebContents* first = browser()->tab_strip_model()->GetWebContentsAt(1);
176
177 // The original tab should be unchanged.
178 EXPECT_EQ(url2, zeroth->GetLastCommittedURL());
[email protected]f5fa20e2011-12-21 22:35:56179 EXPECT_TRUE(zeroth->GetController().CanGoBack());
180 EXPECT_FALSE(zeroth->GetController().CanGoForward());
[email protected]e21e8c92009-04-29 02:42:09181
[email protected]e022aca2013-07-18 19:10:18182 // The new tab should be like the first one but navigated back. Since we
183 // didn't wait for the load to complete, we can't use GetLastCommittedURL.
[email protected]a093ce02013-07-22 20:53:14184 EXPECT_EQ(url1, first->GetVisibleURL());
[email protected]f5fa20e2011-12-21 22:35:56185 EXPECT_FALSE(first->GetController().CanGoBack());
186 EXPECT_TRUE(first->GetController().CanGoForward());
[email protected]e21e8c92009-04-29 02:42:09187
188 // Select the second tab and make it go forward in a new background tab.
[email protected]57892182012-12-03 19:15:39189 browser()->tab_strip_model()->ActivateTabAt(1, true);
[email protected]e21e8c92009-04-29 02:42:09190 // TODO(brettw) bug 11055: It should not be necessary to commit the load here,
191 // but because of this bug, it will assert later if we don't. When the bug is
192 // fixed, one of the three commits here related to this bug should be removed
193 // (to test both codepaths).
[email protected]f5fa20e2011-12-21 22:35:56194 CommitPendingLoad(&first->GetController());
[email protected]57892182012-12-03 19:15:39195 EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
[email protected]a37d4b02012-06-25 21:56:10196 chrome::GoForward(browser(), NEW_BACKGROUND_TAB);
[email protected]e21e8c92009-04-29 02:42:09197
198 // The previous tab should be unchanged and still in the foreground.
[email protected]e022aca2013-07-18 19:10:18199 EXPECT_EQ(url1, first->GetLastCommittedURL());
[email protected]f5fa20e2011-12-21 22:35:56200 EXPECT_FALSE(first->GetController().CanGoBack());
201 EXPECT_TRUE(first->GetController().CanGoForward());
[email protected]57892182012-12-03 19:15:39202 EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
[email protected]e21e8c92009-04-29 02:42:09203
204 // There should be a new tab navigated forward.
[email protected]57892182012-12-03 19:15:39205 ASSERT_EQ(3, browser()->tab_strip_model()->count());
206 WebContents* second = browser()->tab_strip_model()->GetWebContentsAt(2);
[email protected]e022aca2013-07-18 19:10:18207 // Since we didn't wait for load to complete, we can't use
208 // GetLastCommittedURL.
[email protected]a093ce02013-07-22 20:53:14209 EXPECT_EQ(url2, second->GetVisibleURL());
[email protected]f5fa20e2011-12-21 22:35:56210 EXPECT_TRUE(second->GetController().CanGoBack());
211 EXPECT_FALSE(second->GetController().CanGoForward());
[email protected]e21e8c92009-04-29 02:42:09212
213 // Now do back in a new foreground tab. Don't bother re-checking every sngle
214 // thing above, just validate that it's opening properly.
[email protected]57892182012-12-03 19:15:39215 browser()->tab_strip_model()->ActivateTabAt(2, true);
[email protected]e21e8c92009-04-29 02:42:09216 // TODO(brettw) bug 11055: see the comment above about why we need this.
[email protected]f5fa20e2011-12-21 22:35:56217 CommitPendingLoad(&second->GetController());
[email protected]a37d4b02012-06-25 21:56:10218 chrome::GoBack(browser(), NEW_FOREGROUND_TAB);
[email protected]57892182012-12-03 19:15:39219 ASSERT_EQ(3, browser()->tab_strip_model()->active_index());
220 ASSERT_EQ(url1,
[email protected]e022aca2013-07-18 19:10:18221 browser()->tab_strip_model()->GetActiveWebContents()->
[email protected]a093ce02013-07-22 20:53:14222 GetVisibleURL());
[email protected]e21e8c92009-04-29 02:42:09223
224 // Same thing again for forward.
225 // TODO(brettw) bug 11055: see the comment above about why we need this.
[email protected]57892182012-12-03 19:15:39226 CommitPendingLoad(&
227 browser()->tab_strip_model()->GetActiveWebContents()->GetController());
[email protected]a37d4b02012-06-25 21:56:10228 chrome::GoForward(browser(), NEW_FOREGROUND_TAB);
[email protected]57892182012-12-03 19:15:39229 ASSERT_EQ(4, browser()->tab_strip_model()->active_index());
230 ASSERT_EQ(url2,
[email protected]e022aca2013-07-18 19:10:18231 browser()->tab_strip_model()->GetActiveWebContents()->
[email protected]a093ce02013-07-22 20:53:14232 GetVisibleURL());
[email protected]e21e8c92009-04-29 02:42:09233}
[email protected]d93dbd12014-08-04 23:42:53234
235TEST_F(BrowserCommandsTest, OnMaxZoomIn) {
236 TabStripModel* tab_strip_model = browser()->tab_strip_model();
237
238 GURL url("http://www.google.com");
239 AddTab(browser(), url);
240 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
241
242 // Continue to zoom in until zoom percent reaches 500.
243 for (int i = 0; i < 9; ++i) {
244 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_IN);
245 }
246
247 // TODO([email protected]): Figure out why Zoom-In menu item is not
248 // disabled after Max-zoom is reached. Force disable Zoom-In menu item
249 // from the context menu since it breaks try jobs on bots.
250 if (chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS))
251 chrome::UpdateCommandEnabled(browser(), IDC_ZOOM_PLUS, false);
252
253 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
254 EXPECT_EQ(zoom_controller->GetZoomPercent(), 500.0f);
255 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
256 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
257 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
258}
259
260TEST_F(BrowserCommandsTest, OnMaxZoomOut) {
261 TabStripModel* tab_strip_model = browser()->tab_strip_model();
262
263 GURL url("http://www.google.com");
264 AddTab(browser(), url);
265 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
266
267 // Continue to zoom out until zoom percent reaches 25.
268 for (int i = 0; i < 7; ++i) {
269 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_OUT);
270 }
271
272 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
273 EXPECT_EQ(zoom_controller->GetZoomPercent(), 25.0f);
274 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
275 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
276 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
277}
278
279TEST_F(BrowserCommandsTest, OnZoomReset) {
280 TabStripModel* tab_strip_model = browser()->tab_strip_model();
281
282 GURL url("http://www.google.com");
283 AddTab(browser(), url);
284 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
285
286 // Change the zoom percentage to 100.
287 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_RESET);
288
289 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
290 EXPECT_EQ(zoom_controller->GetZoomPercent(), 100.0f);
291 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
292 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
293 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
294}
295
296TEST_F(BrowserCommandsTest, OnZoomLevelChanged) {
297 TabStripModel* tab_strip_model = browser()->tab_strip_model();
298
299 GURL url("http://www.google.com");
300 AddTab(browser(), url);
301 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
302
303 // Changing zoom percentage from default should enable all the zoom
304 // NSMenuItems.
305 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_IN);
306
307 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
308 EXPECT_EQ(zoom_controller->GetZoomPercent(), 110.0f);
309 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
310 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
311 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
312}
313
314TEST_F(BrowserCommandsTest, OnZoomChangedForActiveTab) {
315 TabStripModel* tab_strip_model = browser()->tab_strip_model();
316
317 GURL url("http://www.google.com");
318 GURL url1("http://code.google.com");
319
320 // Add First tab.
321 AddTab(browser(), url);
322 AddTab(browser(), url1);
323 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
324
325 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
326 EXPECT_EQ(zoom_controller->GetZoomPercent(), 100.0f);
327 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
328 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
329 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
330
331 // Add Second tab.
332 content::WebContents* contents2 = tab_strip_model->GetWebContentsAt(1);
333
334 tab_strip_model->ActivateTabAt(1, true);
335 EXPECT_TRUE(tab_strip_model->IsTabSelected(1));
336 chrome_page_zoom::Zoom(contents2, content::PAGE_ZOOM_OUT);
337
338 zoom_controller = ZoomController::FromWebContents(contents2);
339 EXPECT_EQ(zoom_controller->GetZoomPercent(), 90.0f);
340 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
341 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
342 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
343}