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

Side by Side Diff: chrome/browser/background/background_mode_manager_unittest.cc

Issue 1803143002: Replace BrowserProces::AddRefModule/RemoveModule by ScopedKeepAlive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 ~BackgroundModeManagerTest() override {} 200 ~BackgroundModeManagerTest() override {}
201 201
202 void SetUp() override { 202 void SetUp() override {
203 command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM)); 203 command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM));
204 profile_manager_ = CreateTestingProfileManager(); 204 profile_manager_ = CreateTestingProfileManager();
205 profile_ = profile_manager_->CreateTestingProfile("p1"); 205 profile_ = profile_manager_->CreateTestingProfile("p1");
206 chrome::DisableShutdownForTesting(true); 206 chrome::DisableShutdownForTesting(true);
207 } 207 }
208 208
209 void TearDown() override { 209 void TearDown() override {
210 // Don't allow the browser to be closed because the shutdown procedure will 210 // Restore the flag's original value (set in TestingBrowserProcess)
211 // attempt to access objects that we haven't created (e.g., MessageCenter). 211 chrome::DisableShutdownForTesting(true);
212 browser_shutdown::SetTryingToQuit(true);
213 chrome::DisableShutdownForTesting(false);
214 browser_shutdown::SetTryingToQuit(false);
215 } 212 }
216 213
217 protected: 214 protected:
218 content::TestBrowserThreadBundle thread_bundle_; 215 content::TestBrowserThreadBundle thread_bundle_;
219 scoped_ptr<base::CommandLine> command_line_; 216 scoped_ptr<base::CommandLine> command_line_;
220 217
221 scoped_ptr<TestingProfileManager> profile_manager_; 218 scoped_ptr<TestingProfileManager> profile_manager_;
222 // Test profile used by all tests - this is owned by profile_manager_. 219 // Test profile used by all tests - this is owned by profile_manager_.
223 TestingProfile* profile_; 220 TestingProfile* profile_;
224 221
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 // When the background mode pref is enabled and there are pending triggers 1024 // When the background mode pref is enabled and there are pending triggers
1028 // they will be registered and the user will be notified. 1025 // they will be registered and the user will be notified.
1029 EXPECT_CALL(manager, EnableLaunchOnStartup(true)); 1026 EXPECT_CALL(manager, EnableLaunchOnStartup(true));
1030 g_browser_process->local_state()->SetBoolean(prefs::kBackgroundModeEnabled, 1027 g_browser_process->local_state()->SetBoolean(prefs::kBackgroundModeEnabled,
1031 true); 1028 true);
1032 Mock::VerifyAndClearExpectations(&manager); 1029 Mock::VerifyAndClearExpectations(&manager);
1033 ASSERT_EQ(1, manager.GetBackgroundClientCountForProfile(profile_)); 1030 ASSERT_EQ(1, manager.GetBackgroundClientCountForProfile(profile_));
1034 AssertBackgroundModeActive(manager); 1031 AssertBackgroundModeActive(manager);
1035 ASSERT_TRUE(manager.HasShownBalloon()); 1032 ASSERT_TRUE(manager.HasShownBalloon());
1036 } 1033 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698