blob: d9ca97424de7f736d6dc3386c7d1c96e3b028404 [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]d93dbd12014-08-04 23:42:5312#include "chrome/browser/ui/zoom/zoom_controller.h"
[email protected]9423d9412009-04-14 22:13:5513#include "chrome/common/url_constants.h"
[email protected]a4ff9eae2011-08-01 19:58:1614#include "chrome/test/base/browser_with_test_window_test.h"
15#include "chrome/test/base/testing_profile.h"
[email protected]a90c8ca2014-05-20 17:16:0416#include "components/bookmarks/browser/bookmark_model.h"
17#include "components/bookmarks/test/bookmark_test_helpers.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
[email protected]e5d549d2011-12-28 01:29:2024using content::OpenURLParams;
25using content::Referrer;
[email protected]6acde6352012-01-04 16:52:2026using content::WebContents;
[email protected]e5d549d2011-12-28 01:29:2027
[email protected]be3877f2009-01-14 15:51:1028// Tests IDC_SELECT_TAB_0, IDC_SELECT_NEXT_TAB, IDC_SELECT_PREVIOUS_TAB and
29// IDC_SELECT_LAST_TAB.
[email protected]6df642082009-08-13 22:31:3730TEST_F(BrowserCommandsTest, TabNavigationAccelerators) {
[email protected]8e09c7af2014-06-10 11:46:1731 GURL about_blank(url::kAboutBlankURL);
[email protected]9423d9412009-04-14 22:13:5532
[email protected]be3877f2009-01-14 15:51:1033 // Create three tabs.
[email protected]9423d9412009-04-14 22:13:5534 AddTab(browser(), about_blank);
35 AddTab(browser(), about_blank);
36 AddTab(browser(), about_blank);
[email protected]be3877f2009-01-14 15:51:1037
38 // Select the second tab.
[email protected]57892182012-12-03 19:15:3939 browser()->tab_strip_model()->ActivateTabAt(1, false);
[email protected]be3877f2009-01-14 15:51:1040
[email protected]5d98294912012-06-27 22:57:4041 CommandUpdater* updater = browser()->command_controller()->command_updater();
42
[email protected]be3877f2009-01-14 15:51:1043 // Navigate to the first tab using an accelerator.
[email protected]5d98294912012-06-27 22:57:4044 updater->ExecuteCommand(IDC_SELECT_TAB_0);
[email protected]57892182012-12-03 19:15:3945 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
[email protected]be3877f2009-01-14 15:51:1046
47 // Navigate to the second tab using the next accelerators.
[email protected]5d98294912012-06-27 22:57:4048 updater->ExecuteCommand(IDC_SELECT_NEXT_TAB);
[email protected]57892182012-12-03 19:15:3949 ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
[email protected]be3877f2009-01-14 15:51:1050
51 // Navigate back to the first tab using the previous accelerators.
[email protected]5d98294912012-06-27 22:57:4052 updater->ExecuteCommand(IDC_SELECT_PREVIOUS_TAB);
[email protected]57892182012-12-03 19:15:3953 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
[email protected]be3877f2009-01-14 15:51:1054
55 // Navigate to the last tab using the select last accelerator.
[email protected]5d98294912012-06-27 22:57:4056 updater->ExecuteCommand(IDC_SELECT_LAST_TAB);
[email protected]57892182012-12-03 19:15:3957 ASSERT_EQ(2, browser()->tab_strip_model()->active_index());
[email protected]be3877f2009-01-14 15:51:1058}
59
60// Tests IDC_DUPLICATE_TAB.
61TEST_F(BrowserCommandsTest, DuplicateTab) {
[email protected]9423d9412009-04-14 22:13:5562 GURL url1("http://foo/1");
63 GURL url2("http://foo/2");
64 GURL url3("http://foo/3");
[email protected]8fcc7bf2012-08-14 18:14:5065 GURL url4("http://foo/4");
[email protected]be3877f2009-01-14 15:51:1066
[email protected]8fcc7bf2012-08-14 18:14:5067 // Navigate to three urls, plus a pending URL that hasn't committed.
[email protected]9423d9412009-04-14 22:13:5568 AddTab(browser(), url1);
[email protected]0683cf62009-04-10 19:31:4069 NavigateAndCommitActiveTab(url2);
70 NavigateAndCommitActiveTab(url3);
[email protected]8fcc7bf2012-08-14 18:14:5071 content::NavigationController& orig_controller =
[email protected]57892182012-12-03 19:15:3972 browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
[email protected]8fcc7bf2012-08-14 18:14:5073 orig_controller.LoadURL(
Sylvain Defresnec6ccc77d2014-09-19 10:19:3574 url4, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
[email protected]8fcc7bf2012-08-14 18:14:5075 EXPECT_EQ(3, orig_controller.GetEntryCount());
76 EXPECT_TRUE(orig_controller.GetPendingEntry());
[email protected]be3877f2009-01-14 15:51:1077
[email protected]0665ebe2013-02-13 09:53:1978 size_t initial_window_count = chrome::GetTotalBrowserCount();
[email protected]be3877f2009-01-14 15:51:1079
80 // Duplicate the tab.
[email protected]5d98294912012-06-27 22:57:4081 chrome::ExecuteCommand(browser(), IDC_DUPLICATE_TAB);
[email protected]be3877f2009-01-14 15:51:1082
83 // The duplicated tab should not end up in a new window.
[email protected]0665ebe2013-02-13 09:53:1984 size_t window_count = chrome::GetTotalBrowserCount();
[email protected]be3877f2009-01-14 15:51:1085 ASSERT_EQ(initial_window_count, window_count);
86
87 // And we should have a newly duplicated tab.
[email protected]57892182012-12-03 19:15:3988 ASSERT_EQ(2, browser()->tab_strip_model()->count());
[email protected]be3877f2009-01-14 15:51:1089
90 // Verify the stack of urls.
[email protected]cdcb1dee2012-01-04 00:46:2091 content::NavigationController& controller =
[email protected]57892182012-12-03 19:15:3992 browser()->tab_strip_model()->GetWebContentsAt(1)->GetController();
[email protected]8fcc7bf2012-08-14 18:14:5093 EXPECT_EQ(3, controller.GetEntryCount());
94 EXPECT_EQ(2, controller.GetCurrentEntryIndex());
95 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
96 EXPECT_EQ(url2, controller.GetEntryAtIndex(1)->GetURL());
97 EXPECT_EQ(url3, controller.GetEntryAtIndex(2)->GetURL());
98 EXPECT_FALSE(controller.GetPendingEntry());
99}
100
101// Tests IDC_VIEW_SOURCE (See http://crbug.com/138140).
102TEST_F(BrowserCommandsTest, ViewSource) {
103 GURL url1("http://foo/1");
104 GURL url2("http://foo/2");
105
106 // Navigate to a URL, plus a pending URL that hasn't committed.
107 AddTab(browser(), url1);
108 content::NavigationController& orig_controller =
[email protected]57892182012-12-03 19:15:39109 browser()->tab_strip_model()->GetWebContentsAt(0)->GetController();
[email protected]8fcc7bf2012-08-14 18:14:50110 orig_controller.LoadURL(
Sylvain Defresnec6ccc77d2014-09-19 10:19:35111 url2, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
[email protected]8fcc7bf2012-08-14 18:14:50112 EXPECT_EQ(1, orig_controller.GetEntryCount());
113 EXPECT_TRUE(orig_controller.GetPendingEntry());
114
[email protected]0665ebe2013-02-13 09:53:19115 size_t initial_window_count = chrome::GetTotalBrowserCount();
[email protected]8fcc7bf2012-08-14 18:14:50116
117 // View Source.
118 chrome::ExecuteCommand(browser(), IDC_VIEW_SOURCE);
119
120 // The view source tab should not end up in a new window.
[email protected]0665ebe2013-02-13 09:53:19121 size_t window_count = chrome::GetTotalBrowserCount();
[email protected]8fcc7bf2012-08-14 18:14:50122 ASSERT_EQ(initial_window_count, window_count);
123
124 // And we should have a newly duplicated tab.
[email protected]57892182012-12-03 19:15:39125 ASSERT_EQ(2, browser()->tab_strip_model()->count());
[email protected]8fcc7bf2012-08-14 18:14:50126
127 // Verify we are viewing the source of the last committed entry.
128 GURL view_source_url("view-source:http://foo/1");
129 content::NavigationController& controller =
[email protected]57892182012-12-03 19:15:39130 browser()->tab_strip_model()->GetWebContentsAt(1)->GetController();
[email protected]8fcc7bf2012-08-14 18:14:50131 EXPECT_EQ(1, controller.GetEntryCount());
132 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
133 EXPECT_EQ(url1, controller.GetEntryAtIndex(0)->GetURL());
134 EXPECT_EQ(view_source_url, controller.GetEntryAtIndex(0)->GetVirtualURL());
135 EXPECT_FALSE(controller.GetPendingEntry());
[email protected]be3877f2009-01-14 15:51:10136}
[email protected]b7ca4e62009-01-23 20:37:29137
138TEST_F(BrowserCommandsTest, BookmarkCurrentPage) {
139 // We use profile() here, since it's a TestingProfile.
140 profile()->CreateBookmarkModel(true);
[email protected]1f9c74192013-03-25 23:04:35141
142 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile());
tfarina8f4aae22014-10-23 17:46:11143 bookmarks::test::WaitForBookmarkModelToLoad(model);
[email protected]b7ca4e62009-01-23 20:37:29144
145 // Navigate to a url.
[email protected]9423d9412009-04-14 22:13:55146 GURL url1("http://foo/1");
147 AddTab(browser(), url1);
[email protected]e5d549d2011-12-28 01:29:20148 browser()->OpenURL(OpenURLParams(
Sylvain Defresnec6ccc77d2014-09-19 10:19:35149 url1, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false));
[email protected]b7ca4e62009-01-23 20:37:29150
[email protected]5d98294912012-06-27 22:57:40151 chrome::BookmarkCurrentPage(browser());
[email protected]b7ca4e62009-01-23 20:37:29152
153 // It should now be bookmarked in the bookmark model.
154 EXPECT_EQ(profile(), browser()->profile());
[email protected]1f9c74192013-03-25 23:04:35155 EXPECT_TRUE(model->IsBookmarked(url1));
[email protected]b7ca4e62009-01-23 20:37:29156}
[email protected]e21e8c92009-04-29 02:42:09157
158// Tests back/forward in new tab (Control + Back/Forward button in the UI).
159TEST_F(BrowserCommandsTest, BackForwardInNewTab) {
160 GURL url1("http://foo/1");
161 GURL url2("http://foo/2");
162
163 // Make a tab with the two pages navigated in it.
164 AddTab(browser(), url1);
165 NavigateAndCommitActiveTab(url2);
166
167 // Go back in a new background tab.
[email protected]a37d4b02012-06-25 21:56:10168 chrome::GoBack(browser(), NEW_BACKGROUND_TAB);
[email protected]57892182012-12-03 19:15:39169 EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
170 ASSERT_EQ(2, browser()->tab_strip_model()->count());
[email protected]e21e8c92009-04-29 02:42:09171
[email protected]57892182012-12-03 19:15:39172 WebContents* zeroth = browser()->tab_strip_model()->GetWebContentsAt(0);
[email protected]e022aca2013-07-18 19:10:18173 WebContents* first = browser()->tab_strip_model()->GetWebContentsAt(1);
174
175 // The original tab should be unchanged.
176 EXPECT_EQ(url2, zeroth->GetLastCommittedURL());
[email protected]f5fa20e2011-12-21 22:35:56177 EXPECT_TRUE(zeroth->GetController().CanGoBack());
178 EXPECT_FALSE(zeroth->GetController().CanGoForward());
[email protected]e21e8c92009-04-29 02:42:09179
[email protected]e022aca2013-07-18 19:10:18180 // The new tab should be like the first one but navigated back. Since we
181 // didn't wait for the load to complete, we can't use GetLastCommittedURL.
[email protected]a093ce02013-07-22 20:53:14182 EXPECT_EQ(url1, first->GetVisibleURL());
[email protected]f5fa20e2011-12-21 22:35:56183 EXPECT_FALSE(first->GetController().CanGoBack());
184 EXPECT_TRUE(first->GetController().CanGoForward());
[email protected]e21e8c92009-04-29 02:42:09185
186 // Select the second tab and make it go forward in a new background tab.
[email protected]57892182012-12-03 19:15:39187 browser()->tab_strip_model()->ActivateTabAt(1, true);
[email protected]e21e8c92009-04-29 02:42:09188 // TODO(brettw) bug 11055: It should not be necessary to commit the load here,
189 // but because of this bug, it will assert later if we don't. When the bug is
190 // fixed, one of the three commits here related to this bug should be removed
191 // (to test both codepaths).
[email protected]f5fa20e2011-12-21 22:35:56192 CommitPendingLoad(&first->GetController());
[email protected]57892182012-12-03 19:15:39193 EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
[email protected]a37d4b02012-06-25 21:56:10194 chrome::GoForward(browser(), NEW_BACKGROUND_TAB);
[email protected]e21e8c92009-04-29 02:42:09195
196 // The previous tab should be unchanged and still in the foreground.
[email protected]e022aca2013-07-18 19:10:18197 EXPECT_EQ(url1, first->GetLastCommittedURL());
[email protected]f5fa20e2011-12-21 22:35:56198 EXPECT_FALSE(first->GetController().CanGoBack());
199 EXPECT_TRUE(first->GetController().CanGoForward());
[email protected]57892182012-12-03 19:15:39200 EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
[email protected]e21e8c92009-04-29 02:42:09201
202 // There should be a new tab navigated forward.
[email protected]57892182012-12-03 19:15:39203 ASSERT_EQ(3, browser()->tab_strip_model()->count());
204 WebContents* second = browser()->tab_strip_model()->GetWebContentsAt(2);
[email protected]e022aca2013-07-18 19:10:18205 // Since we didn't wait for load to complete, we can't use
206 // GetLastCommittedURL.
[email protected]a093ce02013-07-22 20:53:14207 EXPECT_EQ(url2, second->GetVisibleURL());
[email protected]f5fa20e2011-12-21 22:35:56208 EXPECT_TRUE(second->GetController().CanGoBack());
209 EXPECT_FALSE(second->GetController().CanGoForward());
[email protected]e21e8c92009-04-29 02:42:09210
211 // Now do back in a new foreground tab. Don't bother re-checking every sngle
212 // thing above, just validate that it's opening properly.
[email protected]57892182012-12-03 19:15:39213 browser()->tab_strip_model()->ActivateTabAt(2, true);
[email protected]e21e8c92009-04-29 02:42:09214 // TODO(brettw) bug 11055: see the comment above about why we need this.
[email protected]f5fa20e2011-12-21 22:35:56215 CommitPendingLoad(&second->GetController());
[email protected]a37d4b02012-06-25 21:56:10216 chrome::GoBack(browser(), NEW_FOREGROUND_TAB);
[email protected]57892182012-12-03 19:15:39217 ASSERT_EQ(3, browser()->tab_strip_model()->active_index());
218 ASSERT_EQ(url1,
[email protected]e022aca2013-07-18 19:10:18219 browser()->tab_strip_model()->GetActiveWebContents()->
[email protected]a093ce02013-07-22 20:53:14220 GetVisibleURL());
[email protected]e21e8c92009-04-29 02:42:09221
222 // Same thing again for forward.
223 // TODO(brettw) bug 11055: see the comment above about why we need this.
[email protected]57892182012-12-03 19:15:39224 CommitPendingLoad(&
225 browser()->tab_strip_model()->GetActiveWebContents()->GetController());
[email protected]a37d4b02012-06-25 21:56:10226 chrome::GoForward(browser(), NEW_FOREGROUND_TAB);
[email protected]57892182012-12-03 19:15:39227 ASSERT_EQ(4, browser()->tab_strip_model()->active_index());
228 ASSERT_EQ(url2,
[email protected]e022aca2013-07-18 19:10:18229 browser()->tab_strip_model()->GetActiveWebContents()->
[email protected]a093ce02013-07-22 20:53:14230 GetVisibleURL());
[email protected]e21e8c92009-04-29 02:42:09231}
[email protected]d93dbd12014-08-04 23:42:53232
233TEST_F(BrowserCommandsTest, OnMaxZoomIn) {
234 TabStripModel* tab_strip_model = browser()->tab_strip_model();
235
236 GURL url("http://www.google.com");
237 AddTab(browser(), url);
238 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
239
240 // Continue to zoom in until zoom percent reaches 500.
241 for (int i = 0; i < 9; ++i) {
242 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_IN);
243 }
244
245 // TODO([email protected]): Figure out why Zoom-In menu item is not
246 // disabled after Max-zoom is reached. Force disable Zoom-In menu item
247 // from the context menu since it breaks try jobs on bots.
248 if (chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS))
249 chrome::UpdateCommandEnabled(browser(), IDC_ZOOM_PLUS, false);
250
251 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
252 EXPECT_EQ(zoom_controller->GetZoomPercent(), 500.0f);
253 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
254 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
255 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
256}
257
258TEST_F(BrowserCommandsTest, OnMaxZoomOut) {
259 TabStripModel* tab_strip_model = browser()->tab_strip_model();
260
261 GURL url("http://www.google.com");
262 AddTab(browser(), url);
263 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
264
265 // Continue to zoom out until zoom percent reaches 25.
266 for (int i = 0; i < 7; ++i) {
267 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_OUT);
268 }
269
270 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
271 EXPECT_EQ(zoom_controller->GetZoomPercent(), 25.0f);
272 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
273 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
274 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
275}
276
277TEST_F(BrowserCommandsTest, OnZoomReset) {
278 TabStripModel* tab_strip_model = browser()->tab_strip_model();
279
280 GURL url("http://www.google.com");
281 AddTab(browser(), url);
282 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
283
284 // Change the zoom percentage to 100.
285 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_RESET);
286
287 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
288 EXPECT_EQ(zoom_controller->GetZoomPercent(), 100.0f);
289 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
290 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
291 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
292}
293
294TEST_F(BrowserCommandsTest, OnZoomLevelChanged) {
295 TabStripModel* tab_strip_model = browser()->tab_strip_model();
296
297 GURL url("http://www.google.com");
298 AddTab(browser(), url);
299 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
300
301 // Changing zoom percentage from default should enable all the zoom
302 // NSMenuItems.
303 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_IN);
304
305 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
306 EXPECT_EQ(zoom_controller->GetZoomPercent(), 110.0f);
307 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
308 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
309 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
310}
311
312TEST_F(BrowserCommandsTest, OnZoomChangedForActiveTab) {
313 TabStripModel* tab_strip_model = browser()->tab_strip_model();
314
315 GURL url("http://www.google.com");
316 GURL url1("http://code.google.com");
317
318 // Add First tab.
319 AddTab(browser(), url);
320 AddTab(browser(), url1);
321 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0);
322
323 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1);
324 EXPECT_EQ(zoom_controller->GetZoomPercent(), 100.0f);
325 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
326 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
327 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
328
329 // Add Second tab.
330 content::WebContents* contents2 = tab_strip_model->GetWebContentsAt(1);
331
332 tab_strip_model->ActivateTabAt(1, true);
333 EXPECT_TRUE(tab_strip_model->IsTabSelected(1));
334 chrome_page_zoom::Zoom(contents2, content::PAGE_ZOOM_OUT);
335
336 zoom_controller = ZoomController::FromWebContents(contents2);
337 EXPECT_EQ(zoom_controller->GetZoomPercent(), 90.0f);
338 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
339 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
340 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
341}