| 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/utility/importer/safari_importer.h" | 5 #include "chrome/utility/importer/safari_importer.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 8 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/macros.h" |
| 11 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 12 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 13 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 14 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 18 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 18 #include "chrome/common/importer/imported_bookmark_entry.h" | 21 #include "chrome/common/importer/imported_bookmark_entry.h" |
| 19 #include "chrome/common/importer/importer_bridge.h" | 22 #include "chrome/common/importer/importer_bridge.h" |
| 20 #include "chrome/common/importer/safari_importer_utils.h" | 23 #include "chrome/common/importer/safari_importer_utils.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 EXPECT_EQ(fav1.urls.size(), 2U); | 254 EXPECT_EQ(fav1.urls.size(), 2U); |
| 252 EXPECT_TRUE(fav1.urls.find(GURL("http://www.opensearch.org/Home")) | 255 EXPECT_TRUE(fav1.urls.find(GURL("http://www.opensearch.org/Home")) |
| 253 != fav1.urls.end()); | 256 != fav1.urls.end()); |
| 254 | 257 |
| 255 EXPECT_TRUE(fav1.urls.find( | 258 EXPECT_TRUE(fav1.urls.find( |
| 256 GURL("http://www.opensearch.org/Special:Search?search=lalala&go=Search")) | 259 GURL("http://www.opensearch.org/Special:Search?search=lalala&go=Search")) |
| 257 != fav1.urls.end()); | 260 != fav1.urls.end()); |
| 258 } | 261 } |
| 259 | 262 |
| 260 TEST_F(SafariImporterTest, CanImport) { | 263 TEST_F(SafariImporterTest, CanImport) { |
| 261 uint16 items = importer::NONE; | 264 uint16_t items = importer::NONE; |
| 262 EXPECT_TRUE(SafariImporterCanImport( | 265 EXPECT_TRUE(SafariImporterCanImport( |
| 263 GetTestSafariLibraryPath("default"), &items)); | 266 GetTestSafariLibraryPath("default"), &items)); |
| 264 EXPECT_EQ(items, importer::HISTORY | importer::FAVORITES); | 267 EXPECT_EQ(items, importer::HISTORY | importer::FAVORITES); |
| 265 EXPECT_EQ(items & importer::COOKIES, importer::NONE); | 268 EXPECT_EQ(items & importer::COOKIES, importer::NONE); |
| 266 EXPECT_EQ(items & importer::PASSWORDS, importer::NONE); | 269 EXPECT_EQ(items & importer::PASSWORDS, importer::NONE); |
| 267 EXPECT_EQ(items & importer::SEARCH_ENGINES, importer::NONE); | 270 EXPECT_EQ(items & importer::SEARCH_ENGINES, importer::NONE); |
| 268 EXPECT_EQ(items & importer::HOME_PAGE, importer::NONE); | 271 EXPECT_EQ(items & importer::HOME_PAGE, importer::NONE); |
| 269 | 272 |
| 270 // Check that we don't import anything from a bogus library directory. | 273 // Check that we don't import anything from a bogus library directory. |
| 271 base::ScopedTempDir fake_library_dir; | 274 base::ScopedTempDir fake_library_dir; |
| 272 ASSERT_TRUE(fake_library_dir.CreateUniqueTempDir()); | 275 ASSERT_TRUE(fake_library_dir.CreateUniqueTempDir()); |
| 273 EXPECT_FALSE(SafariImporterCanImport(fake_library_dir.path(), &items)); | 276 EXPECT_FALSE(SafariImporterCanImport(fake_library_dir.path(), &items)); |
| 274 } | 277 } |
| OLD | NEW |