Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: chrome/browser/browser_commands_unittest.cc

Issue 342068: Third patch in getting rid of caching MessageLoop pointers and always using C... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tab_contents/navigation_controller.h" 10 #include "chrome/browser/tab_contents/navigation_controller.h"
10 #include "chrome/browser/tab_contents/navigation_entry.h" 11 #include "chrome/browser/tab_contents/navigation_entry.h"
11 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
12 #include "chrome/test/browser_with_test_window_test.h" 13 #include "chrome/test/browser_with_test_window_test.h"
13 #include "chrome/test/testing_profile.h" 14 #include "chrome/test/testing_profile.h"
14 15
15 typedef BrowserWithTestWindowTest BrowserCommandsTest; 16 typedef BrowserWithTestWindowTest BrowserCommandsTest;
16 17
17 // Tests IDC_SELECT_TAB_0, IDC_SELECT_NEXT_TAB, IDC_SELECT_PREVIOUS_TAB and 18 // Tests IDC_SELECT_TAB_0, IDC_SELECT_NEXT_TAB, IDC_SELECT_PREVIOUS_TAB and
18 // IDC_SELECT_LAST_TAB. 19 // IDC_SELECT_LAST_TAB.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 NavigationController& controller = 72 NavigationController& controller =
72 browser()->GetTabContentsAt(1)->controller(); 73 browser()->GetTabContentsAt(1)->controller();
73 ASSERT_EQ(3, controller.entry_count()); 74 ASSERT_EQ(3, controller.entry_count());
74 ASSERT_EQ(2, controller.GetCurrentEntryIndex()); 75 ASSERT_EQ(2, controller.GetCurrentEntryIndex());
75 ASSERT_TRUE(url1 == controller.GetEntryAtIndex(0)->url()); 76 ASSERT_TRUE(url1 == controller.GetEntryAtIndex(0)->url());
76 ASSERT_TRUE(url2 == controller.GetEntryAtIndex(1)->url()); 77 ASSERT_TRUE(url2 == controller.GetEntryAtIndex(1)->url());
77 ASSERT_TRUE(url3 == controller.GetEntryAtIndex(2)->url()); 78 ASSERT_TRUE(url3 == controller.GetEntryAtIndex(2)->url());
78 } 79 }
79 80
80 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());
81 // We use profile() here, since it's a TestingProfile. 84 // We use profile() here, since it's a TestingProfile.
82 profile()->CreateBookmarkModel(true); 85 profile()->CreateBookmarkModel(true);
83 profile()->BlockUntilBookmarkModelLoaded(); 86 profile()->BlockUntilBookmarkModelLoaded();
84 87
85 // Navigate to a url. 88 // Navigate to a url.
86 GURL url1("http://foo/1"); 89 GURL url1("http://foo/1");
87 AddTab(browser(), url1); 90 AddTab(browser(), url1);
88 browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED); 91 browser()->OpenURL(url1, GURL(), CURRENT_TAB, PageTransition::TYPED);
89 92
90 // TODO(beng): remove this once we can use TabContentses directly in testing 93 // TODO(beng): remove this once we can use TabContentses directly in testing
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 ASSERT_EQ(3, browser()->selected_index()); 161 ASSERT_EQ(3, browser()->selected_index());
159 ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL()); 162 ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL());
160 163
161 // Same thing again for forward. 164 // Same thing again for forward.
162 // TODO(brettw) bug 11055: see the comment above about why we need this. 165 // TODO(brettw) bug 11055: see the comment above about why we need this.
163 CommitPendingLoad(&browser()->GetSelectedTabContents()->controller()); 166 CommitPendingLoad(&browser()->GetSelectedTabContents()->controller());
164 browser()->GoForward(NEW_FOREGROUND_TAB); 167 browser()->GoForward(NEW_FOREGROUND_TAB);
165 ASSERT_EQ(4, browser()->selected_index()); 168 ASSERT_EQ(4, browser()->selected_index());
166 ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL()); 169 ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL());
167 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_about_handler.cc ('k') | chrome/browser/browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698