| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // The order of these includes is important. | 5 // The order of these includes is important. |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 #include <unknwn.h> | 7 #include <unknwn.h> |
| 8 #include <intshcut.h> | 8 #include <intshcut.h> |
| 9 #include <propvarutil.h> | 9 #include <propvarutil.h> |
| 10 #include <shlguid.h> | 10 #include <shlguid.h> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "chrome/common/importer/importer_data_types.h" | 42 #include "chrome/common/importer/importer_data_types.h" |
| 43 #include "chrome/test/base/in_process_browser_test.h" | 43 #include "chrome/test/base/in_process_browser_test.h" |
| 44 #include "chrome/test/base/testing_profile.h" | 44 #include "chrome/test/base/testing_profile.h" |
| 45 #include "components/autofill/core/common/password_form.h" | 45 #include "components/autofill/core/common/password_form.h" |
| 46 #include "components/os_crypt/ie7_password_win.h" | 46 #include "components/os_crypt/ie7_password_win.h" |
| 47 #include "testing/gtest/include/gtest/gtest.h" | 47 #include "testing/gtest/include/gtest/gtest.h" |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 const BookmarkInfo kIEBookmarks[] = { | 51 const BookmarkInfo kIEBookmarks[] = { |
| 52 {true, 2, {L"Links", L"SubFolderOfLinks"}, | 52 {true, 2, {"Links", "SubFolderOfLinks"}, |
| 53 L"SubLink", | 53 L"SubLink", |
| 54 "http://www.links-sublink.com/"}, | 54 "http://www.links-sublink.com/"}, |
| 55 {true, 1, {L"Links"}, | 55 {true, 1, {"Links"}, |
| 56 L"TheLink", | 56 L"TheLink", |
| 57 "http://www.links-thelink.com/"}, | 57 "http://www.links-thelink.com/"}, |
| 58 {false, 0, {}, | 58 {false, 0, {}, |
| 59 L"Google Home Page", | 59 L"Google Home Page", |
| 60 "http://www.google.com/"}, | 60 "http://www.google.com/"}, |
| 61 {false, 0, {}, | 61 {false, 0, {}, |
| 62 L"TheLink", | 62 L"TheLink", |
| 63 "http://www.links-thelink.com/"}, | 63 "http://www.links-thelink.com/"}, |
| 64 {false, 1, {L"SubFolder"}, | 64 {false, 1, {"SubFolder"}, |
| 65 L"Title", | 65 L"Title", |
| 66 "http://www.link.com/"}, | 66 "http://www.link.com/"}, |
| 67 {false, 0, {}, | 67 {false, 0, {}, |
| 68 L"WithPortAndQuery", | 68 L"WithPortAndQuery", |
| 69 "http://host:8080/cgi?q=query"}, | 69 "http://host:8080/cgi?q=query"}, |
| 70 {false, 1, {L"a"}, | 70 {false, 1, {"a"}, |
| 71 L"\x4E2D\x6587", | 71 L"\x4E2D\x6587", |
| 72 "http://chinese-title-favorite/"}, | 72 "http://chinese-title-favorite/"}, |
| 73 {false, 0, {}, | 73 {false, 0, {}, |
| 74 L"SubFolder", | 74 L"SubFolder", |
| 75 "http://www.subfolder.com/"}, | 75 "http://www.subfolder.com/"}, |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 const BookmarkInfo kIESortedBookmarks[] = { | 78 const BookmarkInfo kIESortedBookmarks[] = { |
| 79 {false, 0, {}, L"a", "http://www.google.com/0"}, | 79 {false, 0, {}, L"a", "http://www.google.com/0"}, |
| 80 {false, 1, {L"b"}, L"a", "http://www.google.com/1"}, | 80 {false, 1, {"b"}, L"a", "http://www.google.com/1"}, |
| 81 {false, 1, {L"b"}, L"b", "http://www.google.com/2"}, | 81 {false, 1, {"b"}, L"b", "http://www.google.com/2"}, |
| 82 {false, 0, {}, L"c", "http://www.google.com/3"}, | 82 {false, 0, {}, L"c", "http://www.google.com/3"}, |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 const base::char16 kIEIdentifyUrl[] = | 85 const base::char16 kIEIdentifyUrl[] = |
| 86 L"http://A79029D6-753E-4e27-B807-3D46AB1545DF.com:8080/path?key=value"; | 86 L"http://A79029D6-753E-4e27-B807-3D46AB1545DF.com:8080/path?key=value"; |
| 87 const base::char16 kIEIdentifyTitle[] = | 87 const base::char16 kIEIdentifyTitle[] = |
| 88 L"Unittest GUID"; | 88 L"Unittest GUID"; |
| 89 | 89 |
| 90 const base::char16 kFaviconStreamSuffix[] = L"url:favicon:$DATA"; | 90 const base::char16 kFaviconStreamSuffix[] = L"url:favicon:$DATA"; |
| 91 const char kDummyFaviconImageData[] = | 91 const char kDummyFaviconImageData[] = |
| 92 "\x42\x4D" // Magic signature 'BM' | 92 "\x42\x4D" // Magic signature 'BM' |
| 93 "\x1E\x00\x00\x00" // File size | 93 "\x1E\x00\x00\x00" // File size |
| 94 "\x00\x00\x00\x00" // Reserved | 94 "\x00\x00\x00\x00" // Reserved |
| 95 "\x1A\x00\x00\x00" // Offset of the pixel data | 95 "\x1A\x00\x00\x00" // Offset of the pixel data |
| 96 "\x0C\x00\x00\x00" // Header Size | 96 "\x0C\x00\x00\x00" // Header Size |
| 97 "\x01\x00\x01\x00" // Size: 1x1 | 97 "\x01\x00\x01\x00" // Size: 1x1 |
| 98 "\x01\x00" // Reserved | 98 "\x01\x00" // Reserved |
| 99 "\x18\x00" // 24-bits | 99 "\x18\x00" // 24-bits |
| 100 "\x00\xFF\x00\x00"; // The pixel | 100 "\x00\xFF\x00\x00"; // The pixel |
| 101 | 101 |
| 102 struct FaviconGroup { | 102 struct FaviconGroup { |
| 103 const base::char16* favicon_url; | 103 const base::char16* favicon_url; |
| 104 const base::char16* site_url[2]; | 104 const base::char16* site_url[2]; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 const FaviconGroup kIEFaviconGroup[2] = { | 107 const FaviconGroup kIEFaviconGroup[2] = { |
| 108 {L"http://www.google.com/favicon.ico", | 108 {L"http://www.google.com/favicon.ico", |
| 109 {L"http://www.google.com/", | 109 {L"http://www.google.com/", |
| 110 L"http://www.subfolder.com/"}}, | 110 L"http://www.subfolder.com/"}}, |
| 111 {L"http://example.com/favicon.ico", | 111 {L"http://example.com/favicon.ico", |
| 112 {L"http://host:8080/cgi?q=query", | 112 {L"http://host:8080/cgi?q=query", |
| 113 L"http://chinese-title-favorite/"}}, | 113 L"http://chinese-title-favorite/"}}, |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 bool CreateOrderBlob(const base::FilePath& favorites_folder, | 116 bool CreateOrderBlob(const base::FilePath& favorites_folder, |
| 117 const base::string16& path, | 117 const base::string16& path, |
| 118 const std::vector<base::string16>& entries) { | 118 const std::vector<base::string16>& entries) { |
| 119 if (entries.size() > 255) | 119 if (entries.size() > 255) |
| 120 return false; | 120 return false; |
| 121 | 121 |
| 122 // Create a binary sequence for setting a specific order of favorites. | 122 // Create a binary sequence for setting a specific order of favorites. |
| 123 // The format depends on the version of Shell32.dll, so we cannot embed | 123 // The format depends on the version of Shell32.dll, so we cannot embed |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 source_profile.source_path = temp_dir_.path(); | 627 source_profile.source_path = temp_dir_.path(); |
| 628 | 628 |
| 629 host->StartImportSettings( | 629 host->StartImportSettings( |
| 630 source_profile, | 630 source_profile, |
| 631 browser()->profile(), | 631 browser()->profile(), |
| 632 importer::HOME_PAGE, | 632 importer::HOME_PAGE, |
| 633 observer); | 633 observer); |
| 634 base::MessageLoop::current()->Run(); | 634 base::MessageLoop::current()->Run(); |
| 635 } | 635 } |
| 636 | 636 |
| OLD | NEW |