Chromium Code Reviews| 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 "chrome/browser/importer/safari_importer.h" | 5 #include "chrome/utility/importer/safari_importer.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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/importer/importer_bridge.h" | |
| 17 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/importer/imported_bookmark_entry.h" | 17 #include "chrome/common/importer/imported_bookmark_entry.h" |
| 19 #include "chrome/common/importer/imported_favicon_usage.h" | 18 #include "chrome/common/importer/imported_favicon_usage.h" |
| 19 #include "chrome/common/importer/importer_bridge.h" | |
| 20 #include "chrome/common/importer/safari_importer_utils.h" | |
|
gab
2013/07/09 20:48:31
It seems you reverted some, but not all changes in
scottmg
2013/07/09 21:16:45
Done.
gab
2013/07/09 21:29:43
Ok, my question was, are you planning to introduce
| |
| 20 #include "sql/connection.h" | 21 #include "sql/connection.h" |
| 21 #include "testing/platform_test.h" | 22 #include "testing/platform_test.h" |
| 22 | 23 |
| 23 // In order to test the Safari import functionality effectively, we store a | 24 // In order to test the Safari import functionality effectively, we store a |
| 24 // simulated Library directory containing dummy data files in the same | 25 // simulated Library directory containing dummy data files in the same |
| 25 // structure as ~/Library in the Chrome test data directory. | 26 // structure as ~/Library in the Chrome test data directory. |
| 26 // This function returns the path to that directory. | 27 // This function returns the path to that directory. |
| 27 base::FilePath GetTestSafariLibraryPath() { | 28 base::FilePath GetTestSafariLibraryPath() { |
| 28 base::FilePath test_dir; | 29 base::FilePath test_dir; |
| 29 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); | 30 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 EXPECT_TRUE(fav1.urls.find(GURL("http://www.opensearch.org/Home")) | 180 EXPECT_TRUE(fav1.urls.find(GURL("http://www.opensearch.org/Home")) |
| 180 != fav1.urls.end()); | 181 != fav1.urls.end()); |
| 181 | 182 |
| 182 EXPECT_TRUE(fav1.urls.find( | 183 EXPECT_TRUE(fav1.urls.find( |
| 183 GURL("http://www.opensearch.org/Special:Search?search=lalala&go=Search")) | 184 GURL("http://www.opensearch.org/Special:Search?search=lalala&go=Search")) |
| 184 != fav1.urls.end()); | 185 != fav1.urls.end()); |
| 185 } | 186 } |
| 186 | 187 |
| 187 TEST_F(SafariImporterTest, CanImport) { | 188 TEST_F(SafariImporterTest, CanImport) { |
| 188 uint16 items = importer::NONE; | 189 uint16 items = importer::NONE; |
| 189 EXPECT_TRUE(SafariImporter::CanImport(GetTestSafariLibraryPath(), &items)); | 190 EXPECT_TRUE(SafariImporterCanImport(GetTestSafariLibraryPath(), &items)); |
| 190 EXPECT_EQ(items, importer::HISTORY | importer::FAVORITES); | 191 EXPECT_EQ(items, importer::HISTORY | importer::FAVORITES); |
| 191 EXPECT_EQ(items & importer::COOKIES, importer::NONE); | 192 EXPECT_EQ(items & importer::COOKIES, importer::NONE); |
| 192 EXPECT_EQ(items & importer::PASSWORDS, importer::NONE); | 193 EXPECT_EQ(items & importer::PASSWORDS, importer::NONE); |
| 193 EXPECT_EQ(items & importer::SEARCH_ENGINES, importer::NONE); | 194 EXPECT_EQ(items & importer::SEARCH_ENGINES, importer::NONE); |
| 194 EXPECT_EQ(items & importer::HOME_PAGE, importer::NONE); | 195 EXPECT_EQ(items & importer::HOME_PAGE, importer::NONE); |
| 195 | 196 |
| 196 // Check that we don't import anything from a bogus library directory. | 197 // Check that we don't import anything from a bogus library directory. |
| 197 base::ScopedTempDir fake_library_dir; | 198 base::ScopedTempDir fake_library_dir; |
| 198 ASSERT_TRUE(fake_library_dir.CreateUniqueTempDir()); | 199 ASSERT_TRUE(fake_library_dir.CreateUniqueTempDir()); |
| 199 EXPECT_FALSE(SafariImporter::CanImport(fake_library_dir.path(), &items)); | 200 EXPECT_FALSE(SafariImporterCanImport(fake_library_dir.path(), &items)); |
| 200 } | 201 } |
| OLD | NEW |