| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 // The order of these includes is important. | 8 // The order of these includes is important. |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <unknwn.h> | 10 #include <unknwn.h> |
| 11 #include <intshcut.h> | 11 #include <intshcut.h> |
| 12 #include <pstore.h> | 12 #include <pstore.h> |
| 13 #include <shlguid.h> | 13 #include <shlguid.h> |
| 14 #include <urlhist.h> | 14 #include <urlhist.h> |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "app/win/scoped_com_initializer.h" | |
| 20 #include "base/compiler_specific.h" | 19 #include "base/compiler_specific.h" |
| 21 #include "base/file_util.h" | 20 #include "base/file_util.h" |
| 22 #include "base/message_loop.h" | 21 #include "base/message_loop.h" |
| 23 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 24 #include "base/scoped_temp_dir.h" | 23 #include "base/scoped_temp_dir.h" |
| 25 #include "base/stl_util-inl.h" | 24 #include "base/stl_util-inl.h" |
| 26 #include "base/string_util.h" | 25 #include "base/string_util.h" |
| 27 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 27 #include "base/win/scoped_com_initializer.h" |
| 28 #include "chrome/browser/history/history_types.h" | 28 #include "chrome/browser/history/history_types.h" |
| 29 #include "chrome/browser/importer/importer_bridge.h" | 29 #include "chrome/browser/importer/importer_bridge.h" |
| 30 #include "chrome/browser/importer/importer_data_types.h" | 30 #include "chrome/browser/importer/importer_data_types.h" |
| 31 #include "chrome/browser/importer/importer_host.h" | 31 #include "chrome/browser/importer/importer_host.h" |
| 32 #include "chrome/browser/importer/importer_progress_observer.h" | 32 #include "chrome/browser/importer/importer_progress_observer.h" |
| 33 #include "chrome/browser/search_engines/template_url.h" | 33 #include "chrome/browser/search_engines/template_url.h" |
| 34 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
| 35 #include "chrome/test/testing_profile.h" | 35 #include "chrome/test/testing_profile.h" |
| 36 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" |
| 37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 for (int i = 0; i < arraysize(items); ++i) { | 326 for (int i = 0; i < arraysize(items); ++i) { |
| 327 HRESULT res = pstore->WriteItem(0, type, subtype, items[i].name, | 327 HRESULT res = pstore->WriteItem(0, type, subtype, items[i].name, |
| 328 items[i].data_size, reinterpret_cast<BYTE*>(items[i].data), | 328 items[i].data_size, reinterpret_cast<BYTE*>(items[i].data), |
| 329 NULL, 0, 0); | 329 NULL, 0, 0); |
| 330 ASSERT_TRUE(res == PST_E_OK); | 330 ASSERT_TRUE(res == PST_E_OK); |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 TEST_F(ImporterTest, IEImporter) { | 334 TEST_F(ImporterTest, IEImporter) { |
| 335 // Sets up a favorites folder. | 335 // Sets up a favorites folder. |
| 336 app::win::ScopedCOMInitializer com_init; | 336 base::win::ScopedCOMInitializer com_init; |
| 337 std::wstring path = temp_dir_.path().AppendASCII("Favorites").value(); | 337 std::wstring path = temp_dir_.path().AppendASCII("Favorites").value(); |
| 338 CreateDirectory(path.c_str(), NULL); | 338 CreateDirectory(path.c_str(), NULL); |
| 339 CreateDirectory((path + L"\\SubFolder").c_str(), NULL); | 339 CreateDirectory((path + L"\\SubFolder").c_str(), NULL); |
| 340 CreateDirectory((path + L"\\Links").c_str(), NULL); | 340 CreateDirectory((path + L"\\Links").c_str(), NULL); |
| 341 CreateDirectory((path + L"\\Links\\SubFolderOfLinks").c_str(), NULL); | 341 CreateDirectory((path + L"\\Links\\SubFolderOfLinks").c_str(), NULL); |
| 342 CreateDirectory((path + L"\\\x0061").c_str(), NULL); | 342 CreateDirectory((path + L"\\\x0061").c_str(), NULL); |
| 343 ASSERT_TRUE(CreateUrlFile(path + L"\\Google Home Page.url", | 343 ASSERT_TRUE(CreateUrlFile(path + L"\\Google Home Page.url", |
| 344 L"http://www.google.com/")); | 344 L"http://www.google.com/")); |
| 345 ASSERT_TRUE(CreateUrlFile(path + L"\\SubFolder\\Title.url", | 345 ASSERT_TRUE(CreateUrlFile(path + L"\\SubFolder\\Title.url", |
| 346 L"http://www.link.com/")); | 346 L"http://www.link.com/")); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 true); | 880 true); |
| 881 } | 881 } |
| 882 | 882 |
| 883 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { | 883 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { |
| 884 bool import_search_engines = false; | 884 bool import_search_engines = false; |
| 885 scoped_refptr<Firefox3Observer> observer( | 885 scoped_refptr<Firefox3Observer> observer( |
| 886 new Firefox3Observer(import_search_engines)); | 886 new Firefox3Observer(import_search_engines)); |
| 887 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), | 887 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), |
| 888 import_search_engines); | 888 import_search_engines); |
| 889 } | 889 } |
| OLD | NEW |