OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/password_manager_internals_se
rvice.h" | 5 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" |
6 | 6 |
7 #include "chrome/test/base/testing_profile.h" | 7 #include "chrome/test/base/testing_profile.h" |
8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
9 #include "components/password_manager/content/browser/password_manager_internals
_service_factory.h" | 9 #include "components/password_manager/content/browser/password_manager_internals
_service_factory.h" |
10 #include "components/password_manager/core/browser/password_manager_logger.h" | 10 #include "components/password_manager/core/browser/log_receiver.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using password_manager::PasswordManagerInternalsService; | 14 using password_manager::PasswordManagerInternalsService; |
15 using password_manager::PasswordManagerInternalsServiceFactory; | 15 using password_manager::PasswordManagerInternalsServiceFactory; |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 const char kTestText[] = "abcd1234"; | 19 const char kTestText[] = "abcd1234"; |
20 | 20 |
21 class MockLogReceiver : public password_manager::PasswordManagerLogger { | 21 class MockLogReceiver : public password_manager::LogReceiver { |
22 public: | 22 public: |
23 MockLogReceiver() {} | 23 MockLogReceiver() {} |
24 | 24 |
25 MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&)); | 25 MOCK_METHOD1(LogSavePasswordProgress, void(const std::string&)); |
26 }; | 26 }; |
27 | 27 |
28 enum ProfileType { NORMAL_PROFILE, INCOGNITO_PROFILE }; | 28 enum ProfileType { NORMAL_PROFILE, INCOGNITO_PROFILE }; |
29 | 29 |
30 scoped_ptr<TestingProfile> CreateProfile(ProfileType type) { | 30 scoped_ptr<TestingProfile> CreateProfile(ProfileType type) { |
31 TestingProfile::Builder builder; | 31 TestingProfile::Builder builder; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 scoped_ptr<TestingProfile> profile(CreateProfile(INCOGNITO_PROFILE)); | 70 scoped_ptr<TestingProfile> profile(CreateProfile(INCOGNITO_PROFILE)); |
71 ASSERT_TRUE(profile); | 71 ASSERT_TRUE(profile); |
72 PasswordManagerInternalsService* service = | 72 PasswordManagerInternalsService* service = |
73 PasswordManagerInternalsServiceFactory::GetForBrowserContext( | 73 PasswordManagerInternalsServiceFactory::GetForBrowserContext( |
74 profile.get()); | 74 profile.get()); |
75 // BrowserContextKeyedBaseFactory::GetBrowserContextToUse should return NULL | 75 // BrowserContextKeyedBaseFactory::GetBrowserContextToUse should return NULL |
76 // for |profile|, because |profile| is incognito. Therefore the returned | 76 // for |profile|, because |profile| is incognito. Therefore the returned |
77 // |service| should also be NULL. | 77 // |service| should also be NULL. |
78 EXPECT_FALSE(service); | 78 EXPECT_FALSE(service); |
79 } | 79 } |
OLD | NEW |