| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/importer/safari_importer.h" | 5 #include "chrome/browser/importer/safari_importer.h" |
| 6 | 6 |
| 7 #include "app/sql/connection.h" | |
| 8 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 9 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 11 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 12 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
| 13 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 14 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
| 15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/history/history_types.h" | 15 #include "chrome/browser/history/history_types.h" |
| 17 #include "chrome/browser/importer/importer_bridge.h" | 16 #include "chrome/browser/importer/importer_bridge.h" |
| 18 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "sql/connection.h" |
| 19 #include "testing/platform_test.h" | 19 #include "testing/platform_test.h" |
| 20 | 20 |
| 21 // In order to test the Safari import functionality effectively, we store a | 21 // In order to test the Safari import functionality effectively, we store a |
| 22 // simulated Library directory containing dummy data files in the same | 22 // simulated Library directory containing dummy data files in the same |
| 23 // structure as ~/Library in the Chrome test data directory. | 23 // structure as ~/Library in the Chrome test data directory. |
| 24 // This function returns the path to that directory. | 24 // This function returns the path to that directory. |
| 25 FilePath GetTestSafariLibraryPath() { | 25 FilePath GetTestSafariLibraryPath() { |
| 26 FilePath test_dir; | 26 FilePath test_dir; |
| 27 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); | 27 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); |
| 28 | 28 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 EXPECT_EQ(items & importer::COOKIES, importer::NONE); | 189 EXPECT_EQ(items & importer::COOKIES, importer::NONE); |
| 190 EXPECT_EQ(items & importer::PASSWORDS, importer::NONE); | 190 EXPECT_EQ(items & importer::PASSWORDS, importer::NONE); |
| 191 EXPECT_EQ(items & importer::SEARCH_ENGINES, importer::NONE); | 191 EXPECT_EQ(items & importer::SEARCH_ENGINES, importer::NONE); |
| 192 EXPECT_EQ(items & importer::HOME_PAGE, importer::NONE); | 192 EXPECT_EQ(items & importer::HOME_PAGE, importer::NONE); |
| 193 | 193 |
| 194 // Check that we don't import anything from a bogus library directory. | 194 // Check that we don't import anything from a bogus library directory. |
| 195 ScopedTempDir fake_library_dir; | 195 ScopedTempDir fake_library_dir; |
| 196 ASSERT_TRUE(fake_library_dir.CreateUniqueTempDir()); | 196 ASSERT_TRUE(fake_library_dir.CreateUniqueTempDir()); |
| 197 EXPECT_FALSE(SafariImporter::CanImport(fake_library_dir.path(), &items)); | 197 EXPECT_FALSE(SafariImporter::CanImport(fake_library_dir.path(), &items)); |
| 198 } | 198 } |
| OLD | NEW |