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

Side by Side Diff: chrome/browser/page_cycler/page_cycler_unittest.cc

Issue 17127002: Correctly integrate StoragePartition into TestingProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix InstantNTP test. Created 7 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/prefs/testing_pref_service.h" 7 #include "base/prefs/testing_pref_service.h"
8 #include "base/run_loop.h"
8 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
11 #include "base/threading/sequenced_worker_pool.h" 12 #include "base/threading/sequenced_worker_pool.h"
12 #include "chrome/app/chrome_command_ids.h" 13 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/page_cycler/page_cycler.h" 15 #include "chrome/browser/page_cycler/page_cycler.h"
15 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 PumpLoop(); 144 PumpLoop();
144 } 145 }
145 146
146 void RunPageCycler() { 147 void RunPageCycler() {
147 page_cycler_->Run(); 148 page_cycler_->Run();
148 PumpLoop(); 149 PumpLoop();
149 } 150 }
150 151
151 void PumpLoop() { 152 void PumpLoop() {
152 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 153 content::BrowserThread::GetBlockingPool()->FlushForTesting();
153 message_loop()->RunUntilIdle(); 154 base::RunLoop().RunUntilIdle();
154 } 155 }
155 156
156 void CloseBrowser() { 157 void CloseBrowser() {
157 DestroyBrowserAndProfile(); 158 DestroyBrowserAndProfile();
158 PumpLoop(); 159 PumpLoop();
159 } 160 }
160 161
161 MockPageCycler* page_cycler() { 162 MockPageCycler* page_cycler() {
162 return page_cycler_.get(); 163 return page_cycler_.get();
163 } 164 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 304
304 set_page_cycler(new MockPageCycler(browser(), 305 set_page_cycler(new MockPageCycler(browser(),
305 urls_file(), 306 urls_file(),
306 errors_file())); 307 errors_file()));
307 RunPageCycler(); 308 RunPageCycler();
308 309
309 EXPECT_CALL(*page_cycler(), 310 EXPECT_CALL(*page_cycler(),
310 DidFinishLoad(kFrameID, kAboutURL, kIsMainFrame, _)) 311 DidFinishLoad(kFrameID, kAboutURL, kIsMainFrame, _))
311 .WillOnce(Invoke(page_cycler(), 312 .WillOnce(Invoke(page_cycler(),
312 &MockPageCycler::PageCyclerDidFinishLoad)); 313 &MockPageCycler::PageCyclerDidFinishLoad));
313 message_loop()->RunUntilIdle(); 314 base::RunLoop().RunUntilIdle();
314 315
315 FinishLoad(); 316 FinishLoad();
316 317
317 CloseBrowser(); 318 CloseBrowser();
318 PumpLoop(); 319 PumpLoop();
319 320
320 std::string errors_output; 321 std::string errors_output;
321 std::string errors_expected; 322 std::string errors_expected;
322 ASSERT_TRUE(file_util::ReadFileToString(errors_file(), 323 ASSERT_TRUE(file_util::ReadFileToString(errors_file(),
323 &errors_output)); 324 &errors_output));
(...skipping 22 matching lines...) Expand all
346 .WillRepeatedly(Invoke(page_cycler(), 347 .WillRepeatedly(Invoke(page_cycler(),
347 &MockPageCycler::PageCyclerDidFinishLoad)); 348 &MockPageCycler::PageCyclerDidFinishLoad));
348 349
349 for (int i = 0; i < kNumLoads; ++i) 350 for (int i = 0; i < kNumLoads; ++i)
350 FinishLoad(); 351 FinishLoad();
351 352
352 PumpLoop(); 353 PumpLoop();
353 EXPECT_FALSE(PathExists(errors_file())); 354 EXPECT_FALSE(PathExists(errors_file()));
354 ASSERT_TRUE(PathExists(stats_file())); 355 ASSERT_TRUE(PathExists(stats_file()));
355 } 356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698