| OLD | NEW |
| 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/app/chrome_command_ids.h" | 5 #include "chrome/app/chrome_command_ids.h" |
| 6 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 6 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 7 #include "chrome/browser/ui/browser_command_controller.h" | 7 #include "chrome/browser/ui/browser_command_controller.h" |
| 8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
| 9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.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 "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "components/bookmarks/browser/bookmark_model.h" | 14 #include "components/bookmarks/browser/bookmark_model.h" |
| 15 #include "components/bookmarks/test/bookmark_test_helpers.h" | 15 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 16 #include "content/public/browser/navigation_controller.h" | 16 #include "content/public/browser/navigation_controller.h" |
| 17 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
| 18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 19 | 19 |
| 20 typedef BrowserWithTestWindowTest BrowserCommandsTest; | 20 typedef BrowserWithTestWindowTest BrowserCommandsTest; |
| 21 | 21 |
| 22 using content::OpenURLParams; | 22 using content::OpenURLParams; |
| 23 using content::Referrer; | 23 using content::Referrer; |
| 24 using content::WebContents; | 24 using content::WebContents; |
| 25 | 25 |
| 26 // Tests IDC_SELECT_TAB_0, IDC_SELECT_NEXT_TAB, IDC_SELECT_PREVIOUS_TAB and | 26 // Tests IDC_SELECT_TAB_0, IDC_SELECT_NEXT_TAB, IDC_SELECT_PREVIOUS_TAB and |
| 27 // IDC_SELECT_LAST_TAB. | 27 // IDC_SELECT_LAST_TAB. |
| 28 TEST_F(BrowserCommandsTest, TabNavigationAccelerators) { | 28 TEST_F(BrowserCommandsTest, TabNavigationAccelerators) { |
| 29 GURL about_blank(content::kAboutBlankURL); | 29 GURL about_blank(url::kAboutBlankURL); |
| 30 | 30 |
| 31 // Create three tabs. | 31 // Create three tabs. |
| 32 AddTab(browser(), about_blank); | 32 AddTab(browser(), about_blank); |
| 33 AddTab(browser(), about_blank); | 33 AddTab(browser(), about_blank); |
| 34 AddTab(browser(), about_blank); | 34 AddTab(browser(), about_blank); |
| 35 | 35 |
| 36 // Select the second tab. | 36 // Select the second tab. |
| 37 browser()->tab_strip_model()->ActivateTabAt(1, false); | 37 browser()->tab_strip_model()->ActivateTabAt(1, false); |
| 38 | 38 |
| 39 CommandUpdater* updater = browser()->command_controller()->command_updater(); | 39 CommandUpdater* updater = browser()->command_controller()->command_updater(); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // Same thing again for forward. | 220 // Same thing again for forward. |
| 221 // TODO(brettw) bug 11055: see the comment above about why we need this. | 221 // TODO(brettw) bug 11055: see the comment above about why we need this. |
| 222 CommitPendingLoad(& | 222 CommitPendingLoad(& |
| 223 browser()->tab_strip_model()->GetActiveWebContents()->GetController()); | 223 browser()->tab_strip_model()->GetActiveWebContents()->GetController()); |
| 224 chrome::GoForward(browser(), NEW_FOREGROUND_TAB); | 224 chrome::GoForward(browser(), NEW_FOREGROUND_TAB); |
| 225 ASSERT_EQ(4, browser()->tab_strip_model()->active_index()); | 225 ASSERT_EQ(4, browser()->tab_strip_model()->active_index()); |
| 226 ASSERT_EQ(url2, | 226 ASSERT_EQ(url2, |
| 227 browser()->tab_strip_model()->GetActiveWebContents()-> | 227 browser()->tab_strip_model()->GetActiveWebContents()-> |
| 228 GetVisibleURL()); | 228 GetVisibleURL()); |
| 229 } | 229 } |
| OLD | NEW |