| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/run_loop.h" |
| 14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/win/registry.h" | 18 #include "base/win/registry.h" |
| 18 #include "base/win/windows_version.h" | 19 #include "base/win/windows_version.h" |
| 19 #include "chrome/browser/importer/external_process_importer_host.h" | 20 #include "chrome/browser/importer/external_process_importer_host.h" |
| 20 #include "chrome/browser/importer/importer_progress_observer.h" | 21 #include "chrome/browser/importer/importer_progress_observer.h" |
| 21 #include "chrome/browser/importer/importer_unittest_utils.h" | 22 #include "chrome/browser/importer/importer_unittest_utils.h" |
| 22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 scoped_refptr<TestObserver> observer( | 219 scoped_refptr<TestObserver> observer( |
| 219 new TestObserver(bookmark_entries, favicon_groups)); | 220 new TestObserver(bookmark_entries, favicon_groups)); |
| 220 host->set_observer(observer.get()); | 221 host->set_observer(observer.get()); |
| 221 | 222 |
| 222 importer::SourceProfile source_profile; | 223 importer::SourceProfile source_profile; |
| 223 source_profile.importer_type = importer::TYPE_EDGE; | 224 source_profile.importer_type = importer::TYPE_EDGE; |
| 224 source_profile.source_path = temp_path.AppendASCII("edge_profile"); | 225 source_profile.source_path = temp_path.AppendASCII("edge_profile"); |
| 225 | 226 |
| 226 host->StartImportSettings(source_profile, browser()->profile(), | 227 host->StartImportSettings(source_profile, browser()->profile(), |
| 227 importer::FAVORITES, observer.get()); | 228 importer::FAVORITES, observer.get()); |
| 228 base::MessageLoop::current()->Run(); | 229 base::RunLoop().Run(); |
| 229 } | 230 } |
| 230 | 231 |
| 231 IN_PROC_BROWSER_TEST_F(EdgeImporterBrowserTest, EdgeImporterLegacyFallback) { | 232 IN_PROC_BROWSER_TEST_F(EdgeImporterBrowserTest, EdgeImporterLegacyFallback) { |
| 232 const BookmarkInfo kEdgeBookmarks[] = { | 233 const BookmarkInfo kEdgeBookmarks[] = { |
| 233 {false, 0, {}, L"Google", "http://www.google.com/"}}; | 234 {false, 0, {}, L"Google", "http://www.google.com/"}}; |
| 234 std::vector<BookmarkInfo> bookmark_entries( | 235 std::vector<BookmarkInfo> bookmark_entries( |
| 235 kEdgeBookmarks, kEdgeBookmarks + arraysize(kEdgeBookmarks)); | 236 kEdgeBookmarks, kEdgeBookmarks + arraysize(kEdgeBookmarks)); |
| 236 const FaviconGroup kEdgeFaviconGroup[] = { | 237 const FaviconGroup kEdgeFaviconGroup[] = { |
| 237 {L"http://www.google.com/favicon.ico", L"http://www.google.com/"}}; | 238 {L"http://www.google.com/favicon.ico", L"http://www.google.com/"}}; |
| 238 std::vector<FaviconGroup> favicon_groups( | 239 std::vector<FaviconGroup> favicon_groups( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 256 source_profile.importer_type = importer::TYPE_EDGE; | 257 source_profile.importer_type = importer::TYPE_EDGE; |
| 257 base::FilePath source_path = temp_dir_.path().AppendASCII("edge_profile"); | 258 base::FilePath source_path = temp_dir_.path().AppendASCII("edge_profile"); |
| 258 ASSERT_NE(-1, | 259 ASSERT_NE(-1, |
| 259 base::WriteFile( | 260 base::WriteFile( |
| 260 source_path.AppendASCII("Favorites\\Google.url:favicon:$DATA"), | 261 source_path.AppendASCII("Favorites\\Google.url:favicon:$DATA"), |
| 261 kDummyFaviconImageData, sizeof(kDummyFaviconImageData))); | 262 kDummyFaviconImageData, sizeof(kDummyFaviconImageData))); |
| 262 source_profile.source_path = source_path; | 263 source_profile.source_path = source_path; |
| 263 | 264 |
| 264 host->StartImportSettings(source_profile, browser()->profile(), | 265 host->StartImportSettings(source_profile, browser()->profile(), |
| 265 importer::FAVORITES, observer.get()); | 266 importer::FAVORITES, observer.get()); |
| 266 base::MessageLoop::current()->Run(); | 267 base::RunLoop().Run(); |
| 267 } | 268 } |
| 268 | 269 |
| 269 IN_PROC_BROWSER_TEST_F(EdgeImporterBrowserTest, EdgeImporterNoDatabase) { | 270 IN_PROC_BROWSER_TEST_F(EdgeImporterBrowserTest, EdgeImporterNoDatabase) { |
| 270 // Only verified to work with ESE library on Windows 8.1 and above. | 271 // Only verified to work with ESE library on Windows 8.1 and above. |
| 271 if (base::win::GetVersion() < base::win::VERSION_WIN8_1) | 272 if (base::win::GetVersion() < base::win::VERSION_WIN8_1) |
| 272 return; | 273 return; |
| 273 | 274 |
| 274 std::vector<BookmarkInfo> bookmark_entries; | 275 std::vector<BookmarkInfo> bookmark_entries; |
| 275 std::vector<FaviconGroup> favicon_groups; | 276 std::vector<FaviconGroup> favicon_groups; |
| 276 | 277 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 287 scoped_refptr<TestObserver> observer( | 288 scoped_refptr<TestObserver> observer( |
| 288 new TestObserver(bookmark_entries, favicon_groups)); | 289 new TestObserver(bookmark_entries, favicon_groups)); |
| 289 host->set_observer(observer.get()); | 290 host->set_observer(observer.get()); |
| 290 | 291 |
| 291 importer::SourceProfile source_profile; | 292 importer::SourceProfile source_profile; |
| 292 source_profile.importer_type = importer::TYPE_EDGE; | 293 source_profile.importer_type = importer::TYPE_EDGE; |
| 293 source_profile.source_path = temp_dir_.path(); | 294 source_profile.source_path = temp_dir_.path(); |
| 294 | 295 |
| 295 host->StartImportSettings(source_profile, browser()->profile(), | 296 host->StartImportSettings(source_profile, browser()->profile(), |
| 296 importer::FAVORITES, observer.get()); | 297 importer::FAVORITES, observer.get()); |
| 297 base::MessageLoop::current()->Run(); | 298 base::RunLoop().Run(); |
| 298 } | 299 } |
| OLD | NEW |