| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 6 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 7 #include "chrome/browser/ui/browser_list.h" | 7 #include "chrome/browser/ui/browser_list.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/test/base/browser_with_test_window_test.h" | 9 #include "chrome/test/base/browser_with_test_window_test.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 TEST_F(BrowserCommandsTest, BookmarkCurrentPage) { | 81 TEST_F(BrowserCommandsTest, BookmarkCurrentPage) { |
| 82 // We use profile() here, since it's a TestingProfile. | 82 // We use profile() here, since it's a TestingProfile. |
| 83 profile()->CreateBookmarkModel(true); | 83 profile()->CreateBookmarkModel(true); |
| 84 profile()->BlockUntilBookmarkModelLoaded(); | 84 profile()->BlockUntilBookmarkModelLoaded(); |
| 85 | 85 |
| 86 // Navigate to a url. | 86 // Navigate to a url. |
| 87 GURL url1("http://foo/1"); | 87 GURL url1("http://foo/1"); |
| 88 AddTab(browser(), url1); | 88 AddTab(browser(), url1); |
| 89 browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED); | 89 browser()->OpenURL(url1, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); |
| 90 | 90 |
| 91 // TODO(beng): remove this once we can use TabContentses directly in testing | 91 // TODO(beng): remove this once we can use TabContentses directly in testing |
| 92 // instead of the TestTabContents which causes this command not to | 92 // instead of the TestTabContents which causes this command not to |
| 93 // be enabled when the tab is added (and selected). | 93 // be enabled when the tab is added (and selected). |
| 94 browser()->command_updater()->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, true); | 94 browser()->command_updater()->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, true); |
| 95 | 95 |
| 96 // Star it. | 96 // Star it. |
| 97 browser()->ExecuteCommand(IDC_BOOKMARK_PAGE); | 97 browser()->ExecuteCommand(IDC_BOOKMARK_PAGE); |
| 98 | 98 |
| 99 // It should now be bookmarked in the bookmark model. | 99 // It should now be bookmarked in the bookmark model. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 // Pressing it a second time while the NTP is open shouldn't change anything. | 187 // Pressing it a second time while the NTP is open shouldn't change anything. |
| 188 browser()->Search(); | 188 browser()->Search(); |
| 189 ASSERT_EQ(2, browser()->tab_count()); | 189 ASSERT_EQ(2, browser()->tab_count()); |
| 190 ASSERT_EQ(1, browser()->active_index()); | 190 ASSERT_EQ(1, browser()->active_index()); |
| 191 current_url = browser()->GetSelectedTabContents()->GetURL(); | 191 current_url = browser()->GetSelectedTabContents()->GetURL(); |
| 192 EXPECT_TRUE(current_url.SchemeIs(chrome::kChromeUIScheme)); | 192 EXPECT_TRUE(current_url.SchemeIs(chrome::kChromeUIScheme)); |
| 193 EXPECT_EQ(chrome::kChromeUINewTabHost, current_url.host()); | 193 EXPECT_EQ(chrome::kChromeUINewTabHost, current_url.host()); |
| 194 } | 194 } |
| 195 #endif | 195 #endif |
| OLD | NEW |