| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_number_conversions.h" |
| 11 #include "base/string_util.h" // TODO(brettw) remove when ASCIIToUTF16 moves. |
| 11 #include "base/time.h" | 12 #include "base/time.h" |
| 12 #include "chrome/browser/password_manager/login_database.h" | 13 #include "chrome/browser/password_manager/login_database.h" |
| 13 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 14 #include "webkit/glue/password_form.h" | 15 #include "webkit/glue/password_form.h" |
| 15 | 16 |
| 16 using webkit_glue::PasswordForm; | 17 using webkit_glue::PasswordForm; |
| 17 | 18 |
| 18 class LoginDatabaseTest : public testing::Test { | 19 class LoginDatabaseTest : public testing::Test { |
| 19 protected: | 20 protected: |
| 20 virtual void SetUp() { | 21 virtual void SetUp() { |
| 21 PathService::Get(chrome::DIR_TEST_DATA, &file_); | 22 PathService::Get(chrome::DIR_TEST_DATA, &file_); |
| 22 const std::string test_db = | 23 const std::string test_db = |
| 23 "TestMetadataStoreMacDatabase" + | 24 "TestMetadataStoreMacDatabase" + |
| 24 Int64ToString(base::Time::Now().ToInternalValue()) + ".db"; | 25 base::Int64ToString(base::Time::Now().ToInternalValue()) + ".db"; |
| 25 file_ = file_.AppendASCII(test_db); | 26 file_ = file_.AppendASCII(test_db); |
| 26 file_util::Delete(file_, false); | 27 file_util::Delete(file_, false); |
| 27 } | 28 } |
| 28 | 29 |
| 29 virtual void TearDown() { | 30 virtual void TearDown() { |
| 30 file_util::Delete(file_, false); | 31 file_util::Delete(file_, false); |
| 31 } | 32 } |
| 32 | 33 |
| 33 FilePath file_; | 34 FilePath file_; |
| 34 }; | 35 }; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // GetLogins should give the blacklisted result. | 274 // GetLogins should give the blacklisted result. |
| 274 EXPECT_TRUE(db->GetLogins(form, &result)); | 275 EXPECT_TRUE(db->GetLogins(form, &result)); |
| 275 EXPECT_EQ(1U, result.size()); | 276 EXPECT_EQ(1U, result.size()); |
| 276 ClearResults(&result); | 277 ClearResults(&result); |
| 277 | 278 |
| 278 // So should GetAllBlacklistedLogins. | 279 // So should GetAllBlacklistedLogins. |
| 279 EXPECT_TRUE(db->GetBlacklistLogins(&result)); | 280 EXPECT_TRUE(db->GetBlacklistLogins(&result)); |
| 280 EXPECT_EQ(1U, result.size()); | 281 EXPECT_EQ(1U, result.size()); |
| 281 ClearResults(&result); | 282 ClearResults(&result); |
| 282 } | 283 } |
| OLD | NEW |