| 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 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 TestService(const std::string& name, | 30 TestService(const std::string& name, |
| 31 std::vector<std::string>* fill_on_shutdown, | 31 std::vector<std::string>* fill_on_shutdown, |
| 32 ProfileDependencyManager* manager) | 32 ProfileDependencyManager* manager) |
| 33 : ProfileKeyedServiceFactory("TestService", manager), | 33 : ProfileKeyedServiceFactory("TestService", manager), |
| 34 name_(name), | 34 name_(name), |
| 35 fill_on_shutdown_(fill_on_shutdown) { | 35 fill_on_shutdown_(fill_on_shutdown) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual ProfileKeyedService* BuildServiceInstanceFor( | 38 virtual ProfileKeyedService* BuildServiceInstanceFor( |
| 39 Profile* profile) const OVERRIDE { | 39 content::BrowserContext* profile) const OVERRIDE { |
| 40 ADD_FAILURE() << "This isn't part of the tests!"; | 40 ADD_FAILURE() << "This isn't part of the tests!"; |
| 41 return NULL; | 41 return NULL; |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual void ProfileShutdown(Profile* profile) OVERRIDE { | 44 virtual void ProfileShutdown(content::BrowserContext* profile) OVERRIDE { |
| 45 fill_on_shutdown_->push_back(name_); | 45 fill_on_shutdown_->push_back(name_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 const std::string name_; | 49 const std::string name_; |
| 50 std::vector<std::string>* fill_on_shutdown_; | 50 std::vector<std::string>* fill_on_shutdown_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 // Tests that we can deal with a single component. | 53 // Tests that we can deal with a single component. |
| 54 TEST_F(ProfileDependencyManagerUnittests, SingleCase) { | 54 TEST_F(ProfileDependencyManagerUnittests, SingleCase) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 manager()->DestroyProfileServices(NULL); | 164 manager()->DestroyProfileServices(NULL); |
| 165 | 165 |
| 166 ASSERT_EQ(6U, shutdown_order()->size()); | 166 ASSERT_EQ(6U, shutdown_order()->size()); |
| 167 EXPECT_STREQ("bottom", (*shutdown_order())[0].c_str()); | 167 EXPECT_STREQ("bottom", (*shutdown_order())[0].c_str()); |
| 168 EXPECT_STREQ("specialized_service", (*shutdown_order())[1].c_str()); | 168 EXPECT_STREQ("specialized_service", (*shutdown_order())[1].c_str()); |
| 169 EXPECT_STREQ("other_intermediary", (*shutdown_order())[2].c_str()); | 169 EXPECT_STREQ("other_intermediary", (*shutdown_order())[2].c_str()); |
| 170 EXPECT_STREQ("intermediary_service", (*shutdown_order())[3].c_str()); | 170 EXPECT_STREQ("intermediary_service", (*shutdown_order())[3].c_str()); |
| 171 EXPECT_STREQ("other_root", (*shutdown_order())[4].c_str()); | 171 EXPECT_STREQ("other_root", (*shutdown_order())[4].c_str()); |
| 172 EXPECT_STREQ("everything_depends_on_me", (*shutdown_order())[5].c_str()); | 172 EXPECT_STREQ("everything_depends_on_me", (*shutdown_order())[5].c_str()); |
| 173 } | 173 } |
| OLD | NEW |