OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/password_manager/password_generation_manager.h" | 8 #include "chrome/browser/password_manager/password_generation_manager.h" |
9 #include "chrome/browser/password_manager/password_manager.h" | 9 #include "chrome/browser/password_manager/password_manager.h" |
10 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" | 10 #include "chrome/browser/password_manager/password_manager_delegate_impl.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 scoped_ptr<TestPasswordGenerationManager> password_generation_manager_; | 62 scoped_ptr<TestPasswordGenerationManager> password_generation_manager_; |
63 }; | 63 }; |
64 | 64 |
65 class IncognitoPasswordGenerationManagerTest : | 65 class IncognitoPasswordGenerationManagerTest : |
66 public PasswordGenerationManagerTest { | 66 public PasswordGenerationManagerTest { |
67 public: | 67 public: |
68 virtual content::BrowserContext* CreateBrowserContext() OVERRIDE { | 68 virtual content::BrowserContext* CreateBrowserContext() OVERRIDE { |
69 // Create an incognito profile. | 69 // Create an incognito profile. |
70 TestingProfile::Builder builder; | 70 TestingProfile::Builder builder; |
| 71 builder.SetIncognito(); |
71 scoped_ptr<TestingProfile> profile = builder.Build(); | 72 scoped_ptr<TestingProfile> profile = builder.Build(); |
72 profile->set_incognito(true); | |
73 return profile.release(); | 73 return profile.release(); |
74 } | 74 } |
75 }; | 75 }; |
76 | 76 |
77 TEST_F(PasswordGenerationManagerTest, UpdateState) { | 77 TEST_F(PasswordGenerationManagerTest, UpdateState) { |
78 PasswordManagerDelegateImpl::CreateForWebContents(web_contents()); | 78 PasswordManagerDelegateImpl::CreateForWebContents(web_contents()); |
79 PasswordManager::CreateForWebContentsAndDelegate( | 79 PasswordManager::CreateForWebContentsAndDelegate( |
80 web_contents(), | 80 web_contents(), |
81 PasswordManagerDelegateImpl::FromWebContents(web_contents())); | 81 PasswordManagerDelegateImpl::FromWebContents(web_contents())); |
82 | 82 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); | 195 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); |
196 // Always set password generation enabled check box so we can test the | 196 // Always set password generation enabled check box so we can test the |
197 // behavior of password sync. | 197 // behavior of password sync. |
198 prefs->SetBoolean(prefs::kPasswordGenerationEnabled, true); | 198 prefs->SetBoolean(prefs::kPasswordGenerationEnabled, true); |
199 | 199 |
200 browser_sync::SyncPrefs sync_prefs(profile()->GetPrefs()); | 200 browser_sync::SyncPrefs sync_prefs(profile()->GetPrefs()); |
201 sync_prefs.SetSyncSetupCompleted(); | 201 sync_prefs.SetSyncSetupCompleted(); |
202 UpdateState(false); | 202 UpdateState(false); |
203 EXPECT_EQ(0u, password_generation_manager_->GetSentStates().size()); | 203 EXPECT_EQ(0u, password_generation_manager_->GetSentStates().size()); |
204 } | 204 } |
OLD | NEW |