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

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

Issue 684613002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/background/background_mode_manager.h" 9 #include "chrome/browser/background/background_mode_manager.h"
10 #include "chrome/browser/browser_shutdown.h" 10 #include "chrome/browser/browser_shutdown.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 EXPECT_FALSE(chrome::WillKeepAlive()); 145 EXPECT_FALSE(chrome::WillKeepAlive());
146 EXPECT_FALSE(manager.HaveStatusTray()); 146 EXPECT_FALSE(manager.HaveStatusTray());
147 EXPECT_TRUE(manager.IsLaunchOnStartup()); 147 EXPECT_TRUE(manager.IsLaunchOnStartup());
148 } 148 }
149 149
150 } // namespace 150 } // namespace
151 151
152 class BackgroundModeManagerTest : public testing::Test { 152 class BackgroundModeManagerTest : public testing::Test {
153 public: 153 public:
154 BackgroundModeManagerTest() {} 154 BackgroundModeManagerTest() {}
155 virtual ~BackgroundModeManagerTest() {} 155 ~BackgroundModeManagerTest() override {}
156 virtual void SetUp() override { 156 void SetUp() override {
157 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); 157 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
158 profile_manager_ = CreateTestingProfileManager(); 158 profile_manager_ = CreateTestingProfileManager();
159 profile_ = profile_manager_->CreateTestingProfile("p1"); 159 profile_ = profile_manager_->CreateTestingProfile("p1");
160 } 160 }
161 scoped_ptr<CommandLine> command_line_; 161 scoped_ptr<CommandLine> command_line_;
162 162
163 protected: 163 protected:
164 scoped_refptr<extensions::Extension> CreateExtension( 164 scoped_refptr<extensions::Extension> CreateExtension(
165 extensions::Manifest::Location location, 165 extensions::Manifest::Location location,
166 const std::string& data, 166 const std::string& data,
(...skipping 27 matching lines...) Expand all
194 return profile_manager.Pass(); 194 return profile_manager.Pass();
195 } 195 }
196 196
197 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManagerTest); 197 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManagerTest);
198 }; 198 };
199 199
200 class BackgroundModeManagerWithExtensionsTest 200 class BackgroundModeManagerWithExtensionsTest
201 : public BackgroundModeManagerTest { 201 : public BackgroundModeManagerTest {
202 public: 202 public:
203 BackgroundModeManagerWithExtensionsTest() {} 203 BackgroundModeManagerWithExtensionsTest() {}
204 virtual ~BackgroundModeManagerWithExtensionsTest() {} 204 ~BackgroundModeManagerWithExtensionsTest() override {}
205 virtual void SetUp() override { 205 void SetUp() override {
206 BackgroundModeManagerTest::SetUp(); 206 BackgroundModeManagerTest::SetUp();
207 // Aura clears notifications from the message center at shutdown. 207 // Aura clears notifications from the message center at shutdown.
208 message_center::MessageCenter::Initialize(); 208 message_center::MessageCenter::Initialize();
209 209
210 // BackgroundModeManager actually affects Chrome start/stop state, 210 // BackgroundModeManager actually affects Chrome start/stop state,
211 // tearing down our thread bundle before we've had chance to clean 211 // tearing down our thread bundle before we've had chance to clean
212 // everything up. Keeping Chrome alive prevents this. 212 // everything up. Keeping Chrome alive prevents this.
213 // We aren't interested in if the keep alive works correctly in this test. 213 // We aren't interested in if the keep alive works correctly in this test.
214 chrome::IncrementKeepAliveCount(); 214 chrome::IncrementKeepAliveCount();
215 215
216 #if defined(OS_CHROMEOS) 216 #if defined(OS_CHROMEOS)
217 // On ChromeOS shutdown, HandleAppExitingForPlatform will call 217 // On ChromeOS shutdown, HandleAppExitingForPlatform will call
218 // chrome::DecrementKeepAliveCount because it assumes the aura shell 218 // chrome::DecrementKeepAliveCount because it assumes the aura shell
219 // called chrome::IncrementKeepAliveCount. Simulate the call here. 219 // called chrome::IncrementKeepAliveCount. Simulate the call here.
220 chrome::IncrementKeepAliveCount(); 220 chrome::IncrementKeepAliveCount();
221 #endif 221 #endif
222 222
223 // Create our test BackgroundModeManager. 223 // Create our test BackgroundModeManager.
224 manager_.reset(new SimpleTestBackgroundModeManager( 224 manager_.reset(new SimpleTestBackgroundModeManager(
225 command_line_.get(), profile_manager_->profile_info_cache())); 225 command_line_.get(), profile_manager_->profile_info_cache()));
226 manager_->RegisterProfile(profile_); 226 manager_->RegisterProfile(profile_);
227 } 227 }
228 228
229 virtual void TearDown() { 229 void TearDown() override {
230 // Clean up the status icon. If this is not done before profile deletes, 230 // Clean up the status icon. If this is not done before profile deletes,
231 // the context menu updates will DCHECK with the now deleted profiles. 231 // the context menu updates will DCHECK with the now deleted profiles.
232 StatusIcon* status_icon = manager_->status_icon_; 232 StatusIcon* status_icon = manager_->status_icon_;
233 manager_->status_icon_ = NULL; 233 manager_->status_icon_ = NULL;
234 delete status_icon; 234 delete status_icon;
235 235
236 // We have to destroy the profiles now because we created them with real 236 // We have to destroy the profiles now because we created them with real
237 // thread state. This causes a lot of machinery to spin up that stops 237 // thread state. This causes a lot of machinery to spin up that stops
238 // working when we tear down our thread state at the end of the test. 238 // working when we tear down our thread state at the end of the test.
239 profile_manager_->DeleteAllTestingProfiles(); 239 profile_manager_->DeleteAllTestingProfiles();
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 // Installing an ephemeral app should not show the balloon. 875 // Installing an ephemeral app should not show the balloon.
876 manager_->SetHasShownBalloon(false); 876 manager_->SetHasShownBalloon(false);
877 AddEphemeralApp(ephemeral_app.get(), service); 877 AddEphemeralApp(ephemeral_app.get(), service);
878 EXPECT_FALSE(manager_->HasShownBalloon()); 878 EXPECT_FALSE(manager_->HasShownBalloon());
879 879
880 // Promoting the ephemeral app to a regular installed app should now show 880 // Promoting the ephemeral app to a regular installed app should now show
881 // the balloon. 881 // the balloon.
882 service->PromoteEphemeralApp(ephemeral_app.get(), false /*from sync*/); 882 service->PromoteEphemeralApp(ephemeral_app.get(), false /*from sync*/);
883 EXPECT_TRUE(manager_->HasShownBalloon()); 883 EXPECT_TRUE(manager_->HasShownBalloon());
884 } 884 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698