OLD | NEW |
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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 class MockPasswordStoreObserver : public PasswordStore::Observer { | 41 class MockPasswordStoreObserver : public PasswordStore::Observer { |
42 public: | 42 public: |
43 MOCK_METHOD1(OnLoginsChanged, | 43 MOCK_METHOD1(OnLoginsChanged, |
44 void(const PasswordStoreChangeList& changes)); | 44 void(const PasswordStoreChangeList& changes)); |
45 }; | 45 }; |
46 | 46 |
47 } // anonymous namespace | 47 } // anonymous namespace |
48 | 48 |
49 class PasswordStoreDefaultTest : public testing::Test { | 49 class PasswordStoreDefaultTest : public testing::Test { |
50 protected: | 50 protected: |
51 virtual void SetUp() override { | 51 void SetUp() override { |
52 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 52 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
53 login_db_.reset(new LoginDatabase()); | 53 login_db_.reset(new LoginDatabase()); |
54 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( | 54 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( |
55 FILE_PATH_LITERAL("login_test")))); | 55 FILE_PATH_LITERAL("login_test")))); |
56 } | 56 } |
57 | 57 |
58 virtual void TearDown() override { | 58 void TearDown() override { ASSERT_TRUE(temp_dir_.Delete()); } |
59 ASSERT_TRUE(temp_dir_.Delete()); | |
60 } | |
61 | 59 |
62 base::MessageLoopForUI message_loop_; | 60 base::MessageLoopForUI message_loop_; |
63 scoped_ptr<LoginDatabase> login_db_; | 61 scoped_ptr<LoginDatabase> login_db_; |
64 base::ScopedTempDir temp_dir_; | 62 base::ScopedTempDir temp_dir_; |
65 }; | 63 }; |
66 | 64 |
67 ACTION(STLDeleteElements0) { | 65 ACTION(STLDeleteElements0) { |
68 STLDeleteContainerPointers(arg0.begin(), arg0.end()); | 66 STLDeleteContainerPointers(arg0.begin(), arg0.end()); |
69 } | 67 } |
70 | 68 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // Deleting the login should trigger a notification. | 173 // Deleting the login should trigger a notification. |
176 store->RemoveLogin(*form); | 174 store->RemoveLogin(*form); |
177 base::MessageLoop::current()->RunUntilIdle(); | 175 base::MessageLoop::current()->RunUntilIdle(); |
178 | 176 |
179 store->RemoveObserver(&observer); | 177 store->RemoveObserver(&observer); |
180 store->Shutdown(); | 178 store->Shutdown(); |
181 base::MessageLoop::current()->RunUntilIdle(); | 179 base::MessageLoop::current()->RunUntilIdle(); |
182 } | 180 } |
183 | 181 |
184 } // namespace password_manager | 182 } // namespace password_manager |
OLD | NEW |