OLD | NEW |
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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile_dependency_manager.h" | 7 #include "chrome/browser/profiles/profile_dependency_manager.h" |
8 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 8 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
9 | 9 |
10 class ProfileDependencyManagerUnittests : public ::testing::Test { | 10 class ProfileDependencyManagerUnittests : public ::testing::Test { |
(...skipping 24 matching lines...) Expand all Loading... |
35 public: | 35 public: |
36 TestService(const std::string& name, | 36 TestService(const std::string& name, |
37 std::vector<std::string>* fill_on_shutdown, | 37 std::vector<std::string>* fill_on_shutdown, |
38 ProfileDependencyManager* manager) | 38 ProfileDependencyManager* manager) |
39 : ProfileKeyedServiceFactory("TestService", manager), | 39 : ProfileKeyedServiceFactory("TestService", manager), |
40 name_(name), | 40 name_(name), |
41 fill_on_shutdown_(fill_on_shutdown) { | 41 fill_on_shutdown_(fill_on_shutdown) { |
42 } | 42 } |
43 | 43 |
44 virtual ProfileKeyedService* BuildServiceInstanceFor( | 44 virtual ProfileKeyedService* BuildServiceInstanceFor( |
45 Profile* profile) const { | 45 Profile* profile) const OVERRIDE { |
46 ADD_FAILURE() << "This isn't part of the tests!"; | 46 ADD_FAILURE() << "This isn't part of the tests!"; |
47 return NULL; | 47 return NULL; |
48 } | 48 } |
49 | 49 |
50 virtual void ProfileShutdown(Profile* profile) { | 50 virtual void ProfileShutdown(Profile* profile) OVERRIDE { |
51 fill_on_shutdown_->push_back(name_); | 51 fill_on_shutdown_->push_back(name_); |
52 } | 52 } |
53 | 53 |
54 private: | 54 private: |
55 const std::string name_; | 55 const std::string name_; |
56 std::vector<std::string>* fill_on_shutdown_; | 56 std::vector<std::string>* fill_on_shutdown_; |
57 }; | 57 }; |
58 | 58 |
59 // Tests that we can deal with a single component. | 59 // Tests that we can deal with a single component. |
60 TEST_F(ProfileDependencyManagerUnittests, SingleCase) { | 60 TEST_F(ProfileDependencyManagerUnittests, SingleCase) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 manager()->DestroyProfileServices(NULL); | 170 manager()->DestroyProfileServices(NULL); |
171 | 171 |
172 ASSERT_EQ(6U, shutdown_order()->size()); | 172 ASSERT_EQ(6U, shutdown_order()->size()); |
173 EXPECT_STREQ("bottom", (*shutdown_order())[0].c_str()); | 173 EXPECT_STREQ("bottom", (*shutdown_order())[0].c_str()); |
174 EXPECT_STREQ("specialized_service", (*shutdown_order())[1].c_str()); | 174 EXPECT_STREQ("specialized_service", (*shutdown_order())[1].c_str()); |
175 EXPECT_STREQ("other_intermediary", (*shutdown_order())[2].c_str()); | 175 EXPECT_STREQ("other_intermediary", (*shutdown_order())[2].c_str()); |
176 EXPECT_STREQ("intermediary_service", (*shutdown_order())[3].c_str()); | 176 EXPECT_STREQ("intermediary_service", (*shutdown_order())[3].c_str()); |
177 EXPECT_STREQ("other_root", (*shutdown_order())[4].c_str()); | 177 EXPECT_STREQ("other_root", (*shutdown_order())[4].c_str()); |
178 EXPECT_STREQ("everything_depends_on_me", (*shutdown_order())[5].c_str()); | 178 EXPECT_STREQ("everything_depends_on_me", (*shutdown_order())[5].c_str()); |
179 } | 179 } |
OLD | NEW |