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

Side by Side Diff: chrome/browser/ui/browser_list_unittest.cc

Issue 7744039: Switch ChromeTestSuite to the same convention as ContentTestSuite: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixing Created 9 years, 4 months 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
OLDNEW
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/browser/printing/background_printing_manager.h" 5 #include "chrome/browser/printing/background_printing_manager.h"
6 #include "chrome/browser/ui/browser_list.h" 6 #include "chrome/browser/ui/browser_list.h"
7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 7 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.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_browser_process.h"
10 11
11 typedef BrowserWithTestWindowTest BrowserListTest; 12 typedef BrowserWithTestWindowTest BrowserListTest;
12 13
13 namespace { 14 namespace {
14 15
15 // Helper function to iterate and count all the tabs. 16 // Helper function to iterate and count all the tabs.
16 size_t CountAllTabs() { 17 size_t CountAllTabs() {
17 size_t count = 0; 18 size_t count = 0;
18 for (TabContentsIterator iterator; !iterator.done(); ++iterator) 19 for (TabContentsIterator iterator; !iterator.done(); ++iterator)
19 ++count; 20 ++count;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 165
165 EXPECT_EQ(0U, CountAllTabs()); 166 EXPECT_EQ(0U, CountAllTabs());
166 167
167 // Add some tabs. 168 // Add some tabs.
168 for (size_t i = 0; i < 3; ++i) 169 for (size_t i = 0; i < 3; ++i)
169 browser2->NewTab(); 170 browser2->NewTab();
170 browser3->NewTab(); 171 browser3->NewTab();
171 172
172 EXPECT_EQ(4U, CountAllTabs()); 173 EXPECT_EQ(4U, CountAllTabs());
173 174
174 TestingBrowserProcess* browser_process = testing_browser_process_.get(); 175 TestingBrowserProcess* browser_process =
176 static_cast<TestingBrowserProcess*>(g_browser_process);
175 printing::BackgroundPrintingManager* bg_print_manager = 177 printing::BackgroundPrintingManager* bg_print_manager =
176 browser_process->background_printing_manager(); 178 browser_process->background_printing_manager();
177 179
178 // Grab a tab and give ownership to BackgroundPrintingManager. 180 // Grab a tab and give ownership to BackgroundPrintingManager.
179 TabContentsIterator tab_iterator; 181 TabContentsIterator tab_iterator;
180 TabContentsWrapper* tab = *tab_iterator; 182 TabContentsWrapper* tab = *tab_iterator;
181 int page_id = 1; 183 int page_id = 1;
182 NavigateToPrintUrl(tab, page_id++); 184 NavigateToPrintUrl(tab, page_id++);
183 185
184 bg_print_manager->OwnTabContents(tab); 186 bg_print_manager->OwnTabContents(tab);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 EXPECT_EQ(6U, CountAllTabs()); 222 EXPECT_EQ(6U, CountAllTabs());
221 223
222 // Delete all tabs to clean up. 224 // Delete all tabs to clean up.
223 for (std::vector<TabContentsWrapper*>::iterator it = owned_tabs.begin(); 225 for (std::vector<TabContentsWrapper*>::iterator it = owned_tabs.begin();
224 it != owned_tabs.end(); ++it) { 226 it != owned_tabs.end(); ++it) {
225 delete *it; 227 delete *it;
226 } 228 }
227 229
228 EXPECT_EQ(0U, CountAllTabs()); 230 EXPECT_EQ(0U, CountAllTabs());
229 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698