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

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

Issue 12853004: Move creation of WebDatabaseTable subclasses to WebDatabaseServiceFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge error. Created 7 years, 9 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 (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 <windows.h> 5 #include <windows.h>
6 #include <wincrypt.h> 6 #include <wincrypt.h>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "base/synchronization/waitable_event.h" 17 #include "base/synchronization/waitable_event.h"
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "chrome/browser/password_manager/ie7_password.h" 19 #include "chrome/browser/password_manager/ie7_password.h"
20 #include "chrome/browser/password_manager/password_form_data.h" 20 #include "chrome/browser/password_manager/password_form_data.h"
21 #include "chrome/browser/password_manager/password_store_consumer.h" 21 #include "chrome/browser/password_manager/password_store_consumer.h"
22 #include "chrome/browser/password_manager/password_store_win.h" 22 #include "chrome/browser/password_manager/password_store_win.h"
23 #include "chrome/browser/webdata/logins_table.h"
23 #include "chrome/browser/webdata/web_data_service.h" 24 #include "chrome/browser/webdata/web_data_service.h"
24 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
25 #include "chrome/test/base/testing_profile.h" 26 #include "chrome/test/base/testing_profile.h"
26 #include "content/public/test/test_browser_thread.h" 27 #include "content/public/test/test_browser_thread.h"
27 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 30
30 using base::WaitableEvent; 31 using base::WaitableEvent;
31 using content::BrowserThread; 32 using content::BrowserThread;
32 using testing::_; 33 using testing::_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 virtual void SetUp() { 109 virtual void SetUp() {
109 ASSERT_TRUE(db_thread_.Start()); 110 ASSERT_TRUE(db_thread_.Start());
110 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 111 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
111 112
112 profile_.reset(new TestingProfile()); 113 profile_.reset(new TestingProfile());
113 114
114 login_db_.reset(new LoginDatabase()); 115 login_db_.reset(new LoginDatabase());
115 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( 116 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append(
116 FILE_PATH_LITERAL("login_test")))); 117 FILE_PATH_LITERAL("login_test"))));
117 wds_ = new WebDataService(WebDataServiceBase::ProfileErrorCallback());
118 base::FilePath path = temp_dir_.path().AppendASCII("web_data_test"); 118 base::FilePath path = temp_dir_.path().AppendASCII("web_data_test");
119 wds_->Init(path); 119 wds_ = new WebDataService(path,
120 WebDataServiceBase::ProfileErrorCallback());
121 // Need to add at least one table so the database gets created.
122 wds_->AddTable(scoped_ptr<WebDatabaseTable>(new LoginsTable()));
123 wds_->Init();
120 } 124 }
121 125
122 virtual void TearDown() { 126 virtual void TearDown() {
123 if (store_.get()) 127 if (store_.get())
124 store_->ShutdownOnUIThread(); 128 store_->ShutdownOnUIThread();
125 wds_->ShutdownOnUIThread(); 129 wds_->ShutdownOnUIThread();
126 wds_ = NULL; 130 wds_ = NULL;
127 base::WaitableEvent done(false, false); 131 base::WaitableEvent done(false, false);
128 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 132 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
129 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); 133 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done)));
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 VectorOfForms expect_none; 412 VectorOfForms expect_none;
409 // expect that we get no results; 413 // expect that we get no results;
410 EXPECT_CALL( 414 EXPECT_CALL(
411 consumer, 415 consumer,
412 OnPasswordStoreRequestDone(_, ContainsAllPasswordForms(expect_none))) 416 OnPasswordStoreRequestDone(_, ContainsAllPasswordForms(expect_none)))
413 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); 417 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop()));
414 418
415 store_->GetAutofillableLogins(&consumer); 419 store_->GetAutofillableLogins(&consumer);
416 MessageLoop::current()->Run(); 420 MessageLoop::current()->Run();
417 } 421 }
OLDNEW
« no previous file with comments | « chrome/browser/api/webdata/web_data_service_base.h ('k') | chrome/browser/webdata/autofill_web_data_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698