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

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: Address comments 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
« no previous file with comments | « chrome/browser/apps/app_window_interactive_uitest.cc ('k') | chrome/browser/browser_process.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 class BackgroundModeManagerTest : public testing::Test { 197 class BackgroundModeManagerTest : public testing::Test {
198 public: 198 public:
199 BackgroundModeManagerTest() {} 199 BackgroundModeManagerTest() {}
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);
207 }
208
209 void TearDown() override {
210 // Don't allow the browser to be closed because the shutdown procedure will
211 // attempt to access objects that we haven't created (e.g., MessageCenter).
212 browser_shutdown::SetTryingToQuit(true);
213 chrome::DisableShutdownForTesting(false);
214 browser_shutdown::SetTryingToQuit(false);
215 } 206 }
216 207
217 protected: 208 protected:
218 content::TestBrowserThreadBundle thread_bundle_; 209 content::TestBrowserThreadBundle thread_bundle_;
219 scoped_ptr<base::CommandLine> command_line_; 210 scoped_ptr<base::CommandLine> command_line_;
220 211
221 scoped_ptr<TestingProfileManager> profile_manager_; 212 scoped_ptr<TestingProfileManager> profile_manager_;
222 // Test profile used by all tests - this is owned by profile_manager_. 213 // Test profile used by all tests - this is owned by profile_manager_.
223 TestingProfile* profile_; 214 TestingProfile* profile_;
224 215
(...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 1018 // When the background mode pref is enabled and there are pending triggers
1028 // they will be registered and the user will be notified. 1019 // they will be registered and the user will be notified.
1029 EXPECT_CALL(manager, EnableLaunchOnStartup(true)); 1020 EXPECT_CALL(manager, EnableLaunchOnStartup(true));
1030 g_browser_process->local_state()->SetBoolean(prefs::kBackgroundModeEnabled, 1021 g_browser_process->local_state()->SetBoolean(prefs::kBackgroundModeEnabled,
1031 true); 1022 true);
1032 Mock::VerifyAndClearExpectations(&manager); 1023 Mock::VerifyAndClearExpectations(&manager);
1033 ASSERT_EQ(1, manager.GetBackgroundClientCountForProfile(profile_)); 1024 ASSERT_EQ(1, manager.GetBackgroundClientCountForProfile(profile_));
1034 AssertBackgroundModeActive(manager); 1025 AssertBackgroundModeActive(manager);
1035 ASSERT_TRUE(manager.HasShownBalloon()); 1026 ASSERT_TRUE(manager.HasShownBalloon());
1036 } 1027 }
OLDNEW
« no previous file with comments | « chrome/browser/apps/app_window_interactive_uitest.cc ('k') | chrome/browser/browser_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698