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

Side by Side Diff: chrome/browser/chromeos/offline/offline_load_page_unittest.cc

Issue 9419033: Move creation of BrowserContext objects that live in content to content, instead of depending on th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix memory leaks in tests Created 8 years, 10 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 "chrome/browser/chromeos/cros/cros_library.h" 5 #include "chrome/browser/chromeos/cros/cros_library.h"
6 #include "chrome/browser/chromeos/offline/offline_load_page.h" 6 #include "chrome/browser/chromeos/offline/offline_load_page.h"
7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
8 #include "content/browser/tab_contents/test_tab_contents.h" 8 #include "content/browser/tab_contents/test_tab_contents.h"
9 #include "content/public/browser/interstitial_page.h" 9 #include "content/public/browser/interstitial_page.h"
10 #include "content/test/test_browser_thread.h" 10 #include "content/test/test_browser_thread.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 public: 43 public:
44 // The decision the user made. 44 // The decision the user made.
45 enum UserResponse { 45 enum UserResponse {
46 PENDING, 46 PENDING,
47 OK, 47 OK,
48 CANCEL 48 CANCEL
49 }; 49 };
50 50
51 OfflineLoadPageTest() 51 OfflineLoadPageTest()
52 : ui_thread_(BrowserThread::UI, MessageLoop::current()), 52 : ui_thread_(BrowserThread::UI, MessageLoop::current()),
53 file_user_blocking_thread_(
54 BrowserThread::FILE_USER_BLOCKING, MessageLoop::current()),
53 io_thread_(BrowserThread::IO, MessageLoop::current()) { 55 io_thread_(BrowserThread::IO, MessageLoop::current()) {
54 } 56 }
55 57
56 virtual void SetUp() { 58 virtual void SetUp() {
57 ChromeRenderViewHostTestHarness::SetUp(); 59 ChromeRenderViewHostTestHarness::SetUp();
58 user_response_ = PENDING; 60 user_response_ = PENDING;
59 } 61 }
60 62
61 void OnBlockingPageComplete(bool proceed) { 63 void OnBlockingPageComplete(bool proceed) {
62 if (proceed) 64 if (proceed)
(...skipping 16 matching lines...) Expand all
79 // showing. 81 // showing.
80 InterstitialPage* GetOfflineLoadPage() { 82 InterstitialPage* GetOfflineLoadPage() {
81 return InterstitialPage::GetInterstitialPage(contents()); 83 return InterstitialPage::GetInterstitialPage(contents());
82 } 84 }
83 85
84 UserResponse user_response() const { return user_response_; } 86 UserResponse user_response() const { return user_response_; }
85 87
86 private: 88 private:
87 UserResponse user_response_; 89 UserResponse user_response_;
88 content::TestBrowserThread ui_thread_; 90 content::TestBrowserThread ui_thread_;
91 content::TestBrowserThread file_user_blocking_thread_;
89 content::TestBrowserThread io_thread_; 92 content::TestBrowserThread io_thread_;
90 93
91 // Initializes / shuts down a stub CrosLibrary. 94 // Initializes / shuts down a stub CrosLibrary.
92 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; 95 chromeos::ScopedStubCrosEnabler stub_cros_enabler_;
93 96
94 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPageTest); 97 DISALLOW_COPY_AND_ASSIGN(OfflineLoadPageTest);
95 }; 98 };
96 99
97 void TestOfflineLoadPage::NotifyBlockingPageComplete(bool proceed) { 100 void TestOfflineLoadPage::NotifyBlockingPageComplete(bool proceed) {
98 test_page_->OnBlockingPageComplete(proceed); 101 test_page_->OnBlockingPageComplete(proceed);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // The interstitial should be gone. 148 // The interstitial should be gone.
146 EXPECT_EQ(CANCEL, user_response()); 149 EXPECT_EQ(CANCEL, user_response());
147 EXPECT_FALSE(GetOfflineLoadPage()); 150 EXPECT_FALSE(GetOfflineLoadPage());
148 // We did not proceed, the pending entry should be gone. 151 // We did not proceed, the pending entry should be gone.
149 EXPECT_FALSE(controller().GetPendingEntry()); 152 EXPECT_FALSE(controller().GetPendingEntry());
150 // the URL is set back to kURL1. 153 // the URL is set back to kURL1.
151 EXPECT_EQ(kURL1, contents()->GetURL().spec()); 154 EXPECT_EQ(kURL1, contents()->GetURL().spec());
152 } 155 }
153 156
154 } // namespace chromeos 157 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover_unittest.cc ('k') | chrome/browser/cookies_tree_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698