Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: chrome/browser/password_manager/password_generation_manager_unittest.cc

Issue 17127002: Correctly integrate StoragePartition into TestingProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix InstantNTP test. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 26 matching lines...) Expand all
37 37
38 private: 38 private:
39 std::vector<bool> sent_states_; 39 std::vector<bool> sent_states_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(TestPasswordGenerationManager); 41 DISALLOW_COPY_AND_ASSIGN(TestPasswordGenerationManager);
42 }; 42 };
43 43
44 class PasswordGenerationManagerTest : public ChromeRenderViewHostTestHarness { 44 class PasswordGenerationManagerTest : public ChromeRenderViewHostTestHarness {
45 protected: 45 protected:
46 virtual void SetUp() OVERRIDE { 46 virtual void SetUp() OVERRIDE {
47
48 SetThreadBundleOptions(content::TestBrowserThreadBundle::REAL_IO_THREAD); 47 SetThreadBundleOptions(content::TestBrowserThreadBundle::REAL_IO_THREAD);
49 ChromeRenderViewHostTestHarness::SetUp(); 48 ChromeRenderViewHostTestHarness::SetUp();
50 49
51 password_generation_manager_.reset( 50 password_generation_manager_.reset(
52 new TestPasswordGenerationManager(web_contents())); 51 new TestPasswordGenerationManager(web_contents()));
53 } 52 }
54 53
55 virtual void TearDown() OVERRIDE { 54 virtual void TearDown() OVERRIDE {
56 ChromeRenderViewHostTestHarness::TearDown(); 55 ChromeRenderViewHostTestHarness::TearDown();
57 } 56 }
58 57
59 virtual content::BrowserContext* CreateBrowserContext() OVERRIDE {
60 TestingProfile* profile = new TestingProfile();
61 profile->CreateRequestContext();
62 return profile;
63 }
64
65 void UpdateState(bool new_renderer) { 58 void UpdateState(bool new_renderer) {
66 password_generation_manager_->UpdateState(NULL, new_renderer); 59 password_generation_manager_->UpdateState(NULL, new_renderer);
67 } 60 }
68 61
69 scoped_ptr<TestPasswordGenerationManager> password_generation_manager_; 62 scoped_ptr<TestPasswordGenerationManager> password_generation_manager_;
70 }; 63 };
71 64
72 class IncognitoPasswordGenerationManagerTest : 65 class IncognitoPasswordGenerationManagerTest :
73 public PasswordGenerationManagerTest { 66 public PasswordGenerationManagerTest {
74 public: 67 public:
75 virtual content::BrowserContext* CreateBrowserContext() OVERRIDE { 68 virtual content::BrowserContext* CreateBrowserContext() OVERRIDE {
76 // Create an incognito profile. 69 // Create an incognito profile.
77 TestingProfile::Builder builder; 70 TestingProfile::Builder builder;
78 scoped_ptr<TestingProfile> profile = builder.Build(); 71 scoped_ptr<TestingProfile> profile = builder.Build();
79 profile->set_incognito(true); 72 profile->set_incognito(true);
80 profile->CreateRequestContext();
81 return profile.release(); 73 return profile.release();
82 } 74 }
83 }; 75 };
84 76
85 TEST_F(PasswordGenerationManagerTest, UpdateState) { 77 TEST_F(PasswordGenerationManagerTest, UpdateState) {
86 PasswordManagerDelegateImpl::CreateForWebContents(web_contents()); 78 PasswordManagerDelegateImpl::CreateForWebContents(web_contents());
87 PasswordManager::CreateForWebContentsAndDelegate( 79 PasswordManager::CreateForWebContentsAndDelegate(
88 web_contents(), 80 web_contents(),
89 PasswordManagerDelegateImpl::FromWebContents(web_contents())); 81 PasswordManagerDelegateImpl::FromWebContents(web_contents()));
90 82
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); 195 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false);
204 // 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
205 // behavior of password sync. 197 // behavior of password sync.
206 prefs->SetBoolean(prefs::kPasswordGenerationEnabled, true); 198 prefs->SetBoolean(prefs::kPasswordGenerationEnabled, true);
207 199
208 browser_sync::SyncPrefs sync_prefs(profile()->GetPrefs()); 200 browser_sync::SyncPrefs sync_prefs(profile()->GetPrefs());
209 sync_prefs.SetSyncSetupCompleted(); 201 sync_prefs.SetSyncSetupCompleted();
210 UpdateState(false); 202 UpdateState(false);
211 EXPECT_EQ(0u, password_generation_manager_->GetSentStates().size()); 203 EXPECT_EQ(0u, password_generation_manager_->GetSentStates().size());
212 } 204 }
OLDNEW
« no previous file with comments | « chrome/browser/page_cycler/page_cycler_unittest.cc ('k') | chrome/browser/password_manager/password_store_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698