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/log_receiver.h" | 10 #include "components/password_manager/core/browser/log_receiver.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // During the test cases, the profiles may get created on the same address. To | 35 // During the test cases, the profiles may get created on the same address. To |
36 // avoid over-zealous asserts we need to mark the newly created one as "live". | 36 // avoid over-zealous asserts we need to mark the newly created one as "live". |
37 // See declaration of MarkBrowserContextLiveForTesting for more details. | 37 // See declaration of MarkBrowserContextLiveForTesting for more details. |
38 BrowserContextDependencyManager::GetInstance() | 38 BrowserContextDependencyManager::GetInstance() |
39 ->MarkBrowserContextLiveForTesting(profile.get()); | 39 ->MarkBrowserContextLiveForTesting(profile.get()); |
40 if (type == INCOGNITO_PROFILE) { | 40 if (type == INCOGNITO_PROFILE) { |
41 BrowserContextDependencyManager::GetInstance() | 41 BrowserContextDependencyManager::GetInstance() |
42 ->MarkBrowserContextLiveForTesting(profile->GetOffTheRecordProfile()); | 42 ->MarkBrowserContextLiveForTesting(profile->GetOffTheRecordProfile()); |
43 } | 43 } |
44 #endif | 44 #endif |
45 return profile.Pass(); | 45 return profile; |
46 } | 46 } |
47 | 47 |
48 } // namespace | 48 } // namespace |
49 | 49 |
50 class PasswordManagerInternalsServiceTest : public testing::Test { | 50 class PasswordManagerInternalsServiceTest : public testing::Test { |
51 content::TestBrowserThreadBundle thread_bundle_; | 51 content::TestBrowserThreadBundle thread_bundle_; |
52 }; | 52 }; |
53 | 53 |
54 // When the profile is not incognito, it should be possible to activate the | 54 // When the profile is not incognito, it should be possible to activate the |
55 // service. | 55 // service. |
(...skipping 23 matching lines...) Expand all Loading... |
79 | 79 |
80 Profile* incognito_profile = profile->GetOffTheRecordProfile(); | 80 Profile* incognito_profile = profile->GetOffTheRecordProfile(); |
81 PasswordManagerInternalsService* service = | 81 PasswordManagerInternalsService* service = |
82 PasswordManagerInternalsServiceFactory::GetForBrowserContext( | 82 PasswordManagerInternalsServiceFactory::GetForBrowserContext( |
83 incognito_profile); | 83 incognito_profile); |
84 // BrowserContextKeyedBaseFactory::GetBrowserContextToUse should return NULL | 84 // BrowserContextKeyedBaseFactory::GetBrowserContextToUse should return NULL |
85 // for |profile|, because |profile| is incognito. Therefore the returned | 85 // for |profile|, because |profile| is incognito. Therefore the returned |
86 // |service| should also be NULL. | 86 // |service| should also be NULL. |
87 EXPECT_FALSE(service); | 87 EXPECT_FALSE(service); |
88 } | 88 } |
OLD | NEW |