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

Side by Side Diff: apps/app_keep_alive_service_unittest.cc

Issue 176363002: Rename Start/EndKeepAlive to Increment/DecrementKeepAliveCount (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (rename_keep_alive) Created 6 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
« no previous file with comments | « apps/app_keep_alive_service.cc ('k') | apps/app_window.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/app_keep_alive_service.h" 5 #include "apps/app_keep_alive_service.h"
6 #include "apps/app_keep_alive_service_factory.h" 6 #include "apps/app_keep_alive_service_factory.h"
7 #include "chrome/browser/lifetime/application_lifetime.h" 7 #include "chrome/browser/lifetime/application_lifetime.h"
8 #include "chrome/test/base/testing_profile.h" 8 #include "chrome/test/base/testing_profile.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 #if !defined(OS_ANDROID) 11 #if !defined(OS_ANDROID)
12 12
13 class AppKeepAliveServiceUnitTest : public testing::Test { 13 class AppKeepAliveServiceUnitTest : public testing::Test {
14 protected: 14 protected:
15 virtual void SetUp() OVERRIDE { 15 virtual void SetUp() OVERRIDE {
16 testing::Test::SetUp(); 16 testing::Test::SetUp();
17 service_.reset(new apps::AppKeepAliveService(&profile_)); 17 service_.reset(new apps::AppKeepAliveService(&profile_));
18 } 18 }
19 19
20 virtual void TearDown() OVERRIDE { 20 virtual void TearDown() OVERRIDE {
21 while (chrome::WillKeepAlive()) 21 while (chrome::WillKeepAlive())
22 chrome::EndKeepAlive(); 22 chrome::DecrementKeepAliveCount();
23 testing::Test::TearDown(); 23 testing::Test::TearDown();
24 } 24 }
25 25
26 TestingProfile profile_; 26 TestingProfile profile_;
27 scoped_ptr<apps::AppKeepAliveService> service_; 27 scoped_ptr<apps::AppKeepAliveService> service_;
28 }; 28 };
29 29
30 TEST_F(AppKeepAliveServiceUnitTest, Basic) { 30 TEST_F(AppKeepAliveServiceUnitTest, Basic) {
31 ASSERT_FALSE(chrome::WillKeepAlive()); 31 ASSERT_FALSE(chrome::WillKeepAlive());
32 service_->OnAppStart(&profile_, "foo"); 32 service_->OnAppStart(&profile_, "foo");
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 TEST_F(AppKeepAliveServiceUnitTest, ProfileShutdownWithAppsStarted) { 120 TEST_F(AppKeepAliveServiceUnitTest, ProfileShutdownWithAppsStarted) {
121 ASSERT_FALSE(chrome::WillKeepAlive()); 121 ASSERT_FALSE(chrome::WillKeepAlive());
122 service_->OnAppStart(&profile_, "foo"); 122 service_->OnAppStart(&profile_, "foo");
123 EXPECT_TRUE(chrome::WillKeepAlive()); 123 EXPECT_TRUE(chrome::WillKeepAlive());
124 service_->OnAppStart(&profile_, "bar"); 124 service_->OnAppStart(&profile_, "bar");
125 EXPECT_TRUE(chrome::WillKeepAlive()); 125 EXPECT_TRUE(chrome::WillKeepAlive());
126 service_->Shutdown(); 126 service_->Shutdown();
127 EXPECT_FALSE(chrome::WillKeepAlive()); 127 EXPECT_FALSE(chrome::WillKeepAlive());
128 } 128 }
129 #endif 129 #endif
OLDNEW
« no previous file with comments | « apps/app_keep_alive_service.cc ('k') | apps/app_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698