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_dll_resource.h" | 5 #include "chrome/app/chrome_dll_resource.h" |
6 #include "chrome/browser/bookmarks/bookmark_model.h" | 6 #include "chrome/browser/bookmarks/bookmark_model.h" |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/browser_list.h" | 8 #include "chrome/browser/browser_list.h" |
9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
10 #include "chrome/browser/tab_contents/navigation_controller.h" | 10 #include "chrome/browser/tab_contents/navigation_controller.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 ChromeThread ui_loop(ChromeThread::UI, MessageLoop::current()); | |
83 ChromeThread file_loop(ChromeThread::FILE, MessageLoop::current()); | 82 ChromeThread file_loop(ChromeThread::FILE, MessageLoop::current()); |
84 // We use profile() here, since it's a TestingProfile. | 83 // We use profile() here, since it's a TestingProfile. |
85 profile()->CreateBookmarkModel(true); | 84 profile()->CreateBookmarkModel(true); |
86 profile()->BlockUntilBookmarkModelLoaded(); | 85 profile()->BlockUntilBookmarkModelLoaded(); |
87 | 86 |
88 // Navigate to a url. | 87 // Navigate to a url. |
89 GURL url1("http://foo/1"); | 88 GURL url1("http://foo/1"); |
90 AddTab(browser(), url1); | 89 AddTab(browser(), url1); |
91 browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED); | 90 browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED); |
92 | 91 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 ASSERT_EQ(3, browser()->selected_index()); | 160 ASSERT_EQ(3, browser()->selected_index()); |
162 ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL()); | 161 ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL()); |
163 | 162 |
164 // Same thing again for forward. | 163 // Same thing again for forward. |
165 // TODO(brettw) bug 11055: see the comment above about why we need this. | 164 // TODO(brettw) bug 11055: see the comment above about why we need this. |
166 CommitPendingLoad(&browser()->GetSelectedTabContents()->controller()); | 165 CommitPendingLoad(&browser()->GetSelectedTabContents()->controller()); |
167 browser()->GoForward(NEW_FOREGROUND_TAB); | 166 browser()->GoForward(NEW_FOREGROUND_TAB); |
168 ASSERT_EQ(4, browser()->selected_index()); | 167 ASSERT_EQ(4, browser()->selected_index()); |
169 ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL()); | 168 ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL()); |
170 } | 169 } |
OLD | NEW |