| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 "http://www.subfolder.com/"}, | 76 "http://www.subfolder.com/"}, |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 const BookmarkInfo kIESortedBookmarks[] = { | 79 const BookmarkInfo kIESortedBookmarks[] = { |
| 80 {false, 0, {}, L"a", "http://www.google.com/0"}, | 80 {false, 0, {}, L"a", "http://www.google.com/0"}, |
| 81 {false, 1, {L"b"}, L"a", "http://www.google.com/1"}, | 81 {false, 1, {L"b"}, L"a", "http://www.google.com/1"}, |
| 82 {false, 1, {L"b"}, L"b", "http://www.google.com/2"}, | 82 {false, 1, {L"b"}, L"b", "http://www.google.com/2"}, |
| 83 {false, 0, {}, L"c", "http://www.google.com/3"}, | 83 {false, 0, {}, L"c", "http://www.google.com/3"}, |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 const char16 kIEIdentifyUrl[] = | 86 const base::char16 kIEIdentifyUrl[] = |
| 87 L"http://A79029D6-753E-4e27-B807-3D46AB1545DF.com:8080/path?key=value"; | 87 L"http://A79029D6-753E-4e27-B807-3D46AB1545DF.com:8080/path?key=value"; |
| 88 const char16 kIEIdentifyTitle[] = | 88 const base::char16 kIEIdentifyTitle[] = |
| 89 L"Unittest GUID"; | 89 L"Unittest GUID"; |
| 90 | 90 |
| 91 const char16 kFaviconStreamSuffix[] = L"url:favicon:$DATA"; | 91 const base::char16 kFaviconStreamSuffix[] = L"url:favicon:$DATA"; |
| 92 const char kDummyFaviconImageData[] = | 92 const char kDummyFaviconImageData[] = |
| 93 "\x42\x4D" // Magic signature 'BM' | 93 "\x42\x4D" // Magic signature 'BM' |
| 94 "\x1E\x00\x00\x00" // File size | 94 "\x1E\x00\x00\x00" // File size |
| 95 "\x00\x00\x00\x00" // Reserved | 95 "\x00\x00\x00\x00" // Reserved |
| 96 "\x1A\x00\x00\x00" // Offset of the pixel data | 96 "\x1A\x00\x00\x00" // Offset of the pixel data |
| 97 "\x0C\x00\x00\x00" // Header Size | 97 "\x0C\x00\x00\x00" // Header Size |
| 98 "\x01\x00\x01\x00" // Size: 1x1 | 98 "\x01\x00\x01\x00" // Size: 1x1 |
| 99 "\x01\x00" // Reserved | 99 "\x01\x00" // Reserved |
| 100 "\x18\x00" // 24-bits | 100 "\x18\x00" // 24-bits |
| 101 "\x00\xFF\x00\x00"; // The pixel | 101 "\x00\xFF\x00\x00"; // The pixel |
| 102 | 102 |
| 103 struct FaviconGroup { | 103 struct FaviconGroup { |
| 104 const char16* favicon_url; | 104 const base::char16* favicon_url; |
| 105 const char16* site_url[2]; | 105 const base::char16* site_url[2]; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 const FaviconGroup kIEFaviconGroup[2] = { | 108 const FaviconGroup kIEFaviconGroup[2] = { |
| 109 {L"http://www.google.com/favicon.ico", | 109 {L"http://www.google.com/favicon.ico", |
| 110 {L"http://www.google.com/", | 110 {L"http://www.google.com/", |
| 111 L"http://www.subfolder.com/"}}, | 111 L"http://www.subfolder.com/"}}, |
| 112 {L"http://example.com/favicon.ico", | 112 {L"http://example.com/favicon.ico", |
| 113 {L"http://host:8080/cgi?q=query", | 113 {L"http://host:8080/cgi?q=query", |
| 114 L"http://chinese-title-favorite/"}}, | 114 L"http://chinese-title-favorite/"}}, |
| 115 }; | 115 }; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool CreateUrlFile(const base::FilePath& file, const base::string16& url) { | 211 bool CreateUrlFile(const base::FilePath& file, const base::string16& url) { |
| 212 return CreateUrlFileWithFavicon(file, url, base::string16()); | 212 return CreateUrlFileWithFavicon(file, url, base::string16()); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void ClearPStoreType(IPStore* pstore, const GUID* type, const GUID* subtype) { | 215 void ClearPStoreType(IPStore* pstore, const GUID* type, const GUID* subtype) { |
| 216 base::win::ScopedComPtr<IEnumPStoreItems, NULL> item; | 216 base::win::ScopedComPtr<IEnumPStoreItems, NULL> item; |
| 217 HRESULT result = pstore->EnumItems(0, type, subtype, 0, item.Receive()); | 217 HRESULT result = pstore->EnumItems(0, type, subtype, 0, item.Receive()); |
| 218 if (result == PST_E_OK) { | 218 if (result == PST_E_OK) { |
| 219 char16* item_name; | 219 base::char16* item_name; |
| 220 while (SUCCEEDED(item->Next(1, &item_name, 0))) { | 220 while (SUCCEEDED(item->Next(1, &item_name, 0))) { |
| 221 pstore->DeleteItem(0, type, subtype, item_name, NULL, 0); | 221 pstore->DeleteItem(0, type, subtype, item_name, NULL, 0); |
| 222 CoTaskMemFree(item_name); | 222 CoTaskMemFree(item_name); |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 pstore->DeleteSubtype(0, type, subtype, 0); | 225 pstore->DeleteSubtype(0, type, subtype, 0); |
| 226 pstore->DeleteType(0, type, 0); | 226 pstore->DeleteType(0, type, 0); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void WritePStore(IPStore* pstore, const GUID* type, const GUID* subtype) { | 229 void WritePStore(IPStore* pstore, const GUID* type, const GUID* subtype) { |
| 230 struct PStoreItem { | 230 struct PStoreItem { |
| 231 char16* name; | 231 base::char16* name; |
| 232 int data_size; | 232 int data_size; |
| 233 char* data; | 233 char* data; |
| 234 } items[] = { | 234 } items[] = { |
| 235 {L"http://localhost:8080/security/index.htm#ref:StringData", 8, | 235 {L"http://localhost:8080/security/index.htm#ref:StringData", 8, |
| 236 "\x31\x00\x00\x00\x32\x00\x00\x00"}, | 236 "\x31\x00\x00\x00\x32\x00\x00\x00"}, |
| 237 {L"http://localhost:8080/security/index.htm#ref:StringIndex", 20, | 237 {L"http://localhost:8080/security/index.htm#ref:StringIndex", 20, |
| 238 "\x57\x49\x43\x4b\x18\x00\x00\x00\x02\x00" | 238 "\x57\x49\x43\x4b\x18\x00\x00\x00\x02\x00" |
| 239 "\x00\x00\x2f\x00\x74\x00\x01\x00\x00\x00"}, | 239 "\x00\x00\x2f\x00\x74\x00\x01\x00\x00\x00"}, |
| 240 {L"user:StringData", 4, | 240 {L"user:StringData", 4, |
| 241 "\x31\x00\x00\x00"}, | 241 "\x31\x00\x00\x00"}, |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 ASSERT_TRUE(CreateUrlFile(links_path.AppendASCII("TheLink.url"), | 494 ASSERT_TRUE(CreateUrlFile(links_path.AppendASCII("TheLink.url"), |
| 495 L"http://www.links-thelink.com/")); | 495 L"http://www.links-thelink.com/")); |
| 496 ASSERT_TRUE(CreateUrlFile( | 496 ASSERT_TRUE(CreateUrlFile( |
| 497 links_path.AppendASCII("SubFolderOfLinks").AppendASCII("SubLink.url"), | 497 links_path.AppendASCII("SubFolderOfLinks").AppendASCII("SubLink.url"), |
| 498 L"http://www.links-sublink.com/")); | 498 L"http://www.links-sublink.com/")); |
| 499 ASSERT_TRUE(CreateUrlFile(path.AppendASCII("IEDefaultLink.url"), | 499 ASSERT_TRUE(CreateUrlFile(path.AppendASCII("IEDefaultLink.url"), |
| 500 L"http://go.microsoft.com/fwlink/?linkid=140813")); | 500 L"http://go.microsoft.com/fwlink/?linkid=140813")); |
| 501 file_util::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1); | 501 file_util::WriteFile(path.AppendASCII("InvalidUrlFile.url"), "x", 1); |
| 502 file_util::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1); | 502 file_util::WriteFile(path.AppendASCII("PlainTextFile.txt"), "x", 1); |
| 503 | 503 |
| 504 const char16* root_links[] = { | 504 const base::char16* root_links[] = { |
| 505 L"Links", | 505 L"Links", |
| 506 L"Google Home Page.url", | 506 L"Google Home Page.url", |
| 507 L"TheLink.url", | 507 L"TheLink.url", |
| 508 L"SubFolder", | 508 L"SubFolder", |
| 509 L"WithPortAndQuery.url", | 509 L"WithPortAndQuery.url", |
| 510 L"a", | 510 L"a", |
| 511 L"SubFolder.url", | 511 L"SubFolder.url", |
| 512 }; | 512 }; |
| 513 ASSERT_TRUE(CreateOrderBlob( | 513 ASSERT_TRUE(CreateOrderBlob( |
| 514 base::FilePath(path), L"", | 514 base::FilePath(path), L"", |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 source_profile.source_path = temp_dir_.path(); | 668 source_profile.source_path = temp_dir_.path(); |
| 669 | 669 |
| 670 host->StartImportSettings( | 670 host->StartImportSettings( |
| 671 source_profile, | 671 source_profile, |
| 672 browser()->profile(), | 672 browser()->profile(), |
| 673 importer::HOME_PAGE, | 673 importer::HOME_PAGE, |
| 674 observer); | 674 observer); |
| 675 base::MessageLoop::current()->Run(); | 675 base::MessageLoop::current()->Run(); |
| 676 } | 676 } |
| 677 | 677 |
| OLD | NEW |