| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/utility/importer/edge_database_reader_win.h" | 5 #include "chrome/utility/importer/edge_database_reader_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 class EdgeDatabaseReaderTest : public ::testing::Test { | 26 class EdgeDatabaseReaderTest : public ::testing::Test { |
| 27 protected: | 27 protected: |
| 28 bool CopyTestDatabase(const base::string16& database_name, | 28 bool CopyTestDatabase(const base::string16& database_name, |
| 29 base::FilePath* copied_path) { | 29 base::FilePath* copied_path) { |
| 30 base::FilePath input_path; | 30 base::FilePath input_path; |
| 31 input_path = test_data_path_.AppendASCII("edge_database_reader") | 31 input_path = test_data_path_.AppendASCII("edge_database_reader") |
| 32 .Append(database_name) | 32 .Append(database_name) |
| 33 .AddExtension(L".gz"); | 33 .AddExtension(L".gz"); |
| 34 base::FilePath output_path = temp_dir_.path().Append(database_name); | 34 base::FilePath output_path = temp_dir_.GetPath().Append(database_name); |
| 35 | 35 |
| 36 if (DecompressDatabase(input_path, output_path)) { | 36 if (DecompressDatabase(input_path, output_path)) { |
| 37 *copied_path = output_path; | 37 *copied_path = output_path; |
| 38 return true; | 38 return true; |
| 39 } | 39 } |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool WriteFile(const base::string16& name, | 43 bool WriteFile(const base::string16& name, |
| 44 const std::string& contents, | 44 const std::string& contents, |
| 45 base::FilePath* output_path) { | 45 base::FilePath* output_path) { |
| 46 *output_path = temp_dir_.path().Append(name); | 46 *output_path = temp_dir_.GetPath().Append(name); |
| 47 return base::WriteFile(*output_path, contents.c_str(), contents.size()) >= | 47 return base::WriteFile(*output_path, contents.c_str(), contents.size()) >= |
| 48 0; | 48 0; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void SetUp() override { | 51 void SetUp() override { |
| 52 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 52 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 53 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_path_)); | 53 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_path_)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); | 443 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); |
| 444 EXPECT_FALSE(table_enum->RetrieveColumn(L"GuidCol", &uint_col_value)); | 444 EXPECT_FALSE(table_enum->RetrieveColumn(L"GuidCol", &uint_col_value)); |
| 445 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); | 445 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); |
| 446 EXPECT_FALSE(table_enum->RetrieveColumn(L"DateCol", &uint_col_value)); | 446 EXPECT_FALSE(table_enum->RetrieveColumn(L"DateCol", &uint_col_value)); |
| 447 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); | 447 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); |
| 448 EXPECT_FALSE(table_enum->RetrieveColumn(L"StrCol", &uint_col_value)); | 448 EXPECT_FALSE(table_enum->RetrieveColumn(L"StrCol", &uint_col_value)); |
| 449 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); | 449 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); |
| 450 EXPECT_FALSE(table_enum->RetrieveColumn(L"BoolCol", &uint_col_value)); | 450 EXPECT_FALSE(table_enum->RetrieveColumn(L"BoolCol", &uint_col_value)); |
| 451 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); | 451 EXPECT_EQ(JET_errInvalidColumnType, table_enum->last_error()); |
| 452 } | 452 } |
| OLD | NEW |