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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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/managed_mode/managed_mode.h" 5 #include "chrome/browser/managed_mode/managed_mode.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 FakeManagedMode* managed_mode_; 112 FakeManagedMode* managed_mode_;
113 113
114 DISALLOW_COPY_AND_ASSIGN(MockCallback); 114 DISALLOW_COPY_AND_ASSIGN(MockCallback);
115 }; 115 };
116 116
117 } // namespace 117 } // namespace
118 118
119 class ManagedModeTest : public ::testing::Test { 119 class ManagedModeTest : public ::testing::Test {
120 public: 120 public:
121 ManagedModeTest() : message_loop_(MessageLoop::TYPE_UI), 121 ManagedModeTest() : message_loop_(base::MessageLoop::TYPE_UI),
122 ui_thread_(content::BrowserThread::UI, &message_loop_), 122 ui_thread_(content::BrowserThread::UI, &message_loop_),
123 io_thread_(content::BrowserThread::IO, &message_loop_) { 123 io_thread_(content::BrowserThread::IO, &message_loop_) {
124 } 124 }
125 125
126 scoped_refptr<MockCallback> CreateCallback() { 126 scoped_refptr<MockCallback> CreateCallback() {
127 return new StrictMock<MockCallback>(&managed_mode_); 127 return new StrictMock<MockCallback>(&managed_mode_);
128 } 128 }
129 129
130 base::Callback<void(bool)> CreateExpectedCallback(bool success) { 130 base::Callback<void(bool)> CreateExpectedCallback(bool success) {
131 scoped_refptr<MockCallback> callback = CreateCallback(); 131 scoped_refptr<MockCallback> callback = CreateCallback();
132 EXPECT_CALL(*callback, DidEnterManagedMode(success)); 132 EXPECT_CALL(*callback, DidEnterManagedMode(success));
133 return base::Bind(&MockCallback::CheckManagedMode, callback); 133 return base::Bind(&MockCallback::CheckManagedMode, callback);
134 } 134 }
135 135
136 protected: 136 protected:
137 MessageLoop message_loop_; 137 base::MessageLoop message_loop_;
138 content::TestBrowserThread ui_thread_; 138 content::TestBrowserThread ui_thread_;
139 content::TestBrowserThread io_thread_; 139 content::TestBrowserThread io_thread_;
140 TestingProfile managed_mode_profile_; 140 TestingProfile managed_mode_profile_;
141 TestingProfile other_profile_; 141 TestingProfile other_profile_;
142 FakeManagedMode managed_mode_; 142 FakeManagedMode managed_mode_;
143 }; 143 };
144 144
145 TEST_F(ManagedModeTest, SingleBrowser) { 145 TEST_F(ManagedModeTest, SingleBrowser) {
146 BrowserFixture managed_mode_browser(&managed_mode_, &managed_mode_profile_); 146 BrowserFixture managed_mode_browser(&managed_mode_, &managed_mode_profile_);
147 147
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 TEST_F(ManagedModeTest, Cancelled) { 227 TEST_F(ManagedModeTest, Cancelled) {
228 BrowserFixture managed_mode_browser(&managed_mode_, &managed_mode_profile_); 228 BrowserFixture managed_mode_browser(&managed_mode_, &managed_mode_profile_);
229 BrowserFixture other_browser(&managed_mode_, &other_profile_); 229 BrowserFixture other_browser(&managed_mode_, &other_profile_);
230 230
231 // If the user cancelled entering managed mode, it should fail immediately. 231 // If the user cancelled entering managed mode, it should fail immediately.
232 managed_mode_.set_should_cancel_enter(true); 232 managed_mode_.set_should_cancel_enter(true);
233 managed_mode_.EnterManagedModeForTesting(&managed_mode_profile_, 233 managed_mode_.EnterManagedModeForTesting(&managed_mode_profile_,
234 CreateExpectedCallback(false)); 234 CreateExpectedCallback(false));
235 } 235 }
OLDNEW
« no previous file with comments | « chrome/browser/logging_chrome_browsertest.cc ('k') | chrome/browser/managed_mode/managed_mode_url_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698