Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/utility/importer/bookmark_html_reader_unittest.cc

Issue 1119453003: [Importer] Allow Chrome to import bookmark files without a charset specified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/utility/importer/bookmark_html_reader.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/bookmark_html_reader.h" 5 #include "chrome/utility/importer/bookmark_html_reader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 std::vector<importer::SearchEngineInfo> search_engines; 333 std::vector<importer::SearchEngineInfo> search_engines;
334 ImportBookmarksFile(base::Callback<bool(void)>(), 334 ImportBookmarksFile(base::Callback<bool(void)>(),
335 base::Callback<bool(const GURL&)>(), 335 base::Callback<bool(const GURL&)>(),
336 path, NULL, &search_engines, NULL); 336 path, NULL, &search_engines, NULL);
337 337
338 ASSERT_EQ(2U, search_engines.size()); 338 ASSERT_EQ(2U, search_engines.size());
339 ExpectFirstFirefoxBookmarkWithKeyword(search_engines[0]); 339 ExpectFirstFirefoxBookmarkWithKeyword(search_engines[0]);
340 ExpectSecondFirefoxBookmarkWithKeyword(search_engines[1]); 340 ExpectSecondFirefoxBookmarkWithKeyword(search_engines[1]);
341 } 341 }
342 342
343 // Verifies that importing a bookmarks file without a charset specified succeeds
344 // (by falling back to a default charset). Per [ http://crbug.com/460423 ], this
345 // sort of bookmarks file is generated by IE.
346 TEST_F(BookmarkHTMLReaderTestWithData,
347 InternetExplorerBookmarkFileWithoutCharsetImport) {
348 base::FilePath path = test_data_path_.AppendASCII("ie_sans_charset.html");
349
350 std::vector<ImportedBookmarkEntry> bookmarks;
351 ImportBookmarksFile(base::Callback<bool(void)>(),
352 base::Callback<bool(const GURL&)>(),
353 path, &bookmarks, NULL, NULL);
354
355 ASSERT_EQ(3U, bookmarks.size());
356 EXPECT_EQ(ASCIIToUTF16("Google"), bookmarks[0].title);
357 EXPECT_EQ(ASCIIToUTF16("Outlook"), bookmarks[1].title);
358 EXPECT_EQ(ASCIIToUTF16("Speed Test"), bookmarks[2].title);
359 }
360
343 namespace { 361 namespace {
344 362
345 class CancelAfterFifteenCalls { 363 class CancelAfterFifteenCalls {
346 int count; 364 int count;
347 public: 365 public:
348 CancelAfterFifteenCalls() : count(0) { } 366 CancelAfterFifteenCalls() : count(0) { }
349 bool ShouldCancel() { 367 bool ShouldCancel() {
350 return ++count > 16; 368 return ++count > 16;
351 } 369 }
352 }; 370 };
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 ImportBookmarksFile(base::Callback<bool(void)>(), 406 ImportBookmarksFile(base::Callback<bool(void)>(),
389 base::Bind(&IsURLValid), 407 base::Bind(&IsURLValid),
390 path, &bookmarks, NULL, NULL); 408 path, &bookmarks, NULL, NULL);
391 409
392 ASSERT_EQ(2U, bookmarks.size()); 410 ASSERT_EQ(2U, bookmarks.size());
393 ExpectFirstFirefox2Bookmark(bookmarks[0]); 411 ExpectFirstFirefox2Bookmark(bookmarks[0]);
394 ExpectThirdFirefox2Bookmark(bookmarks[1]); 412 ExpectThirdFirefox2Bookmark(bookmarks[1]);
395 } 413 }
396 414
397 } // namespace bookmark_html_reader 415 } // namespace bookmark_html_reader
OLDNEW
« no previous file with comments | « chrome/utility/importer/bookmark_html_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698