OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/browser_with_test_window_test.h" | 9 #include "chrome/test/browser_with_test_window_test.h" |
10 #include "chrome/test/testing_profile.h" | 10 #include "chrome/test/testing_profile.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 NavigationController& controller = | 72 NavigationController& controller = |
73 browser()->GetTabContentsAt(1)->controller(); | 73 browser()->GetTabContentsAt(1)->controller(); |
74 ASSERT_EQ(3, controller.entry_count()); | 74 ASSERT_EQ(3, controller.entry_count()); |
75 ASSERT_EQ(2, controller.GetCurrentEntryIndex()); | 75 ASSERT_EQ(2, controller.GetCurrentEntryIndex()); |
76 ASSERT_TRUE(url1 == controller.GetEntryAtIndex(0)->url()); | 76 ASSERT_TRUE(url1 == controller.GetEntryAtIndex(0)->url()); |
77 ASSERT_TRUE(url2 == controller.GetEntryAtIndex(1)->url()); | 77 ASSERT_TRUE(url2 == controller.GetEntryAtIndex(1)->url()); |
78 ASSERT_TRUE(url3 == controller.GetEntryAtIndex(2)->url()); | 78 ASSERT_TRUE(url3 == controller.GetEntryAtIndex(2)->url()); |
79 } | 79 } |
80 | 80 |
81 TEST_F(BrowserCommandsTest, BookmarkCurrentPage) { | 81 TEST_F(BrowserCommandsTest, BookmarkCurrentPage) { |
82 BrowserThread file_loop(BrowserThread::FILE, MessageLoop::current()); | |
83 // We use profile() here, since it's a TestingProfile. | 82 // We use profile() here, since it's a TestingProfile. |
84 profile()->CreateBookmarkModel(true); | 83 profile()->CreateBookmarkModel(true); |
85 profile()->BlockUntilBookmarkModelLoaded(); | 84 profile()->BlockUntilBookmarkModelLoaded(); |
86 | 85 |
87 // Navigate to a url. | 86 // Navigate to a url. |
88 GURL url1("http://foo/1"); | 87 GURL url1("http://foo/1"); |
89 AddTab(browser(), url1); | 88 AddTab(browser(), url1); |
90 browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED); | 89 browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED); |
91 | 90 |
92 // 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 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 ASSERT_EQ(3, browser()->selected_index()); | 159 ASSERT_EQ(3, browser()->selected_index()); |
161 ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL()); | 160 ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL()); |
162 | 161 |
163 // Same thing again for forward. | 162 // Same thing again for forward. |
164 // TODO(brettw) bug 11055: see the comment above about why we need this. | 163 // TODO(brettw) bug 11055: see the comment above about why we need this. |
165 CommitPendingLoad(&browser()->GetSelectedTabContents()->controller()); | 164 CommitPendingLoad(&browser()->GetSelectedTabContents()->controller()); |
166 browser()->GoForward(NEW_FOREGROUND_TAB); | 165 browser()->GoForward(NEW_FOREGROUND_TAB); |
167 ASSERT_EQ(4, browser()->selected_index()); | 166 ASSERT_EQ(4, browser()->selected_index()); |
168 ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL()); | 167 ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL()); |
169 } | 168 } |
OLD | NEW |