Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 HRESULT res = pstore->WriteItem(0, type, subtype, items[i].name, | 351 HRESULT res = pstore->WriteItem(0, type, subtype, items[i].name, |
| 352 items[i].data_size, reinterpret_cast<BYTE*>(items[i].data), | 352 items[i].data_size, reinterpret_cast<BYTE*>(items[i].data), |
| 353 NULL, 0, 0); | 353 NULL, 0, 0); |
| 354 ASSERT_TRUE(res == PST_E_OK); | 354 ASSERT_TRUE(res == PST_E_OK); |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 | 357 |
| 358 TEST_F(ImporterTest, IEImporter) { | 358 TEST_F(ImporterTest, IEImporter) { |
| 359 // Sets up a favorites folder. | 359 // Sets up a favorites folder. |
| 360 app::win::ScopedCOMInitializer com_init; | 360 app::win::ScopedCOMInitializer com_init; |
| 361 std::wstring path = test_path_.ToWStringHack(); | 361 FilePath file_path = test_path_.AppendASCII("Favorites"); |
| 362 file_util::AppendToPath(&path, L"Favorites"); | 362 std::wstring path = file_path.value(); |
|
evanm
2011/01/07 22:46:01
Can do it on one line:
std::wstring path = test_pa
tfarina
2011/01/07 22:50:00
Done.
| |
| 363 CreateDirectory(path.c_str(), NULL); | 363 CreateDirectory(path.c_str(), NULL); |
| 364 CreateDirectory((path + L"\\SubFolder").c_str(), NULL); | 364 CreateDirectory((path + L"\\SubFolder").c_str(), NULL); |
| 365 CreateDirectory((path + L"\\Links").c_str(), NULL); | 365 CreateDirectory((path + L"\\Links").c_str(), NULL); |
| 366 CreateDirectory((path + L"\\Links\\SubFolderOfLinks").c_str(), NULL); | 366 CreateDirectory((path + L"\\Links\\SubFolderOfLinks").c_str(), NULL); |
| 367 CreateDirectory((path + L"\\\x0061").c_str(), NULL); | 367 CreateDirectory((path + L"\\\x0061").c_str(), NULL); |
| 368 ASSERT_TRUE(CreateUrlFile(path + L"\\Google Home Page.url", | 368 ASSERT_TRUE(CreateUrlFile(path + L"\\Google Home Page.url", |
| 369 L"http://www.google.com/")); | 369 L"http://www.google.com/")); |
| 370 ASSERT_TRUE(CreateUrlFile(path + L"\\SubFolder\\Title.url", | 370 ASSERT_TRUE(CreateUrlFile(path + L"\\SubFolder\\Title.url", |
| 371 L"http://www.link.com/")); | 371 L"http://www.link.com/")); |
| 372 ASSERT_TRUE(CreateUrlFile(path + L"\\TheLink.url", | 372 ASSERT_TRUE(CreateUrlFile(path + L"\\TheLink.url", |
| 373 L"http://www.links-thelink.com/")); | 373 L"http://www.links-thelink.com/")); |
| 374 ASSERT_TRUE(CreateUrlFile(path + L"\\WithPortAndQuery.url", | 374 ASSERT_TRUE(CreateUrlFile(path + L"\\WithPortAndQuery.url", |
| 375 L"http://host:8080/cgi?q=query")); | 375 L"http://host:8080/cgi?q=query")); |
| 376 ASSERT_TRUE(CreateUrlFile(path + L"\\\x0061\\\x4E2D\x6587.url", | 376 ASSERT_TRUE(CreateUrlFile(path + L"\\\x0061\\\x4E2D\x6587.url", |
| 377 L"http://chinese-title-favorite/")); | 377 L"http://chinese-title-favorite/")); |
| 378 ASSERT_TRUE(CreateUrlFile(path + L"\\Links\\TheLink.url", | 378 ASSERT_TRUE(CreateUrlFile(path + L"\\Links\\TheLink.url", |
| 379 L"http://www.links-thelink.com/")); | 379 L"http://www.links-thelink.com/")); |
| 380 ASSERT_TRUE(CreateUrlFile(path + L"\\Links\\SubFolderOfLinks\\SubLink.url", | 380 ASSERT_TRUE(CreateUrlFile(path + L"\\Links\\SubFolderOfLinks\\SubLink.url", |
| 381 L"http://www.links-sublink.com/")); | 381 L"http://www.links-sublink.com/")); |
| 382 file_util::WriteFile(path + L"\\InvalidUrlFile.url", "x", 1); | 382 file_util::WriteFile(path + L"\\InvalidUrlFile.url", "x", 1); |
|
evanm
2011/01/07 22:46:01
I wonder if we'll need to change more of this file
tfarina
2011/01/07 22:50:00
I'm scared about this, and I'd prefer to let more
| |
| 383 file_util::WriteFile(path + L"\\PlainTextFile.txt", "x", 1); | 383 file_util::WriteFile(path + L"\\PlainTextFile.txt", "x", 1); |
| 384 | 384 |
| 385 // Sets up dummy password data. | 385 // Sets up dummy password data. |
| 386 HRESULT res; | 386 HRESULT res; |
| 387 #if 0 // This part of the test is disabled. See bug #2466 | 387 #if 0 // This part of the test is disabled. See bug #2466 |
| 388 ScopedComPtr<IPStore> pstore; | 388 ScopedComPtr<IPStore> pstore; |
| 389 HMODULE pstorec_dll; | 389 HMODULE pstorec_dll; |
| 390 GUID type = IEImporter::kUnittestGUID; | 390 GUID type = IEImporter::kUnittestGUID; |
| 391 GUID subtype = IEImporter::kUnittestGUID; | 391 GUID subtype = IEImporter::kUnittestGUID; |
| 392 // PStore is read-only in Windows Vista. | 392 // PStore is read-only in Windows Vista. |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 true); | 888 true); |
| 889 } | 889 } |
| 890 | 890 |
| 891 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { | 891 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { |
| 892 bool import_search_engines = false; | 892 bool import_search_engines = false; |
| 893 scoped_refptr<Firefox3Observer> observer( | 893 scoped_refptr<Firefox3Observer> observer( |
| 894 new Firefox3Observer(import_search_engines)); | 894 new Firefox3Observer(import_search_engines)); |
| 895 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), | 895 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), |
| 896 import_search_engines); | 896 import_search_engines); |
| 897 } | 897 } |
| OLD | NEW |