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" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 {L"http://www.subfolder.com/favicon.ico", L"http://www.subfolder.com"}, | 195 {L"http://www.subfolder.com/favicon.ico", L"http://www.subfolder.com"}, |
196 }; | 196 }; |
197 | 197 |
198 std::vector<FaviconGroup> favicon_groups( | 198 std::vector<FaviconGroup> favicon_groups( |
199 kEdgeFaviconGroup, kEdgeFaviconGroup + arraysize(kEdgeFaviconGroup)); | 199 kEdgeFaviconGroup, kEdgeFaviconGroup + arraysize(kEdgeFaviconGroup)); |
200 | 200 |
201 base::FilePath data_path; | 201 base::FilePath data_path; |
202 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); | 202 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); |
203 data_path = data_path.AppendASCII("edge_profile"); | 203 data_path = data_path.AppendASCII("edge_profile"); |
204 | 204 |
205 base::FilePath temp_path = temp_dir_.path(); | 205 base::FilePath temp_path = temp_dir_.GetPath(); |
206 ASSERT_TRUE(base::CopyDirectory(data_path, temp_path, true)); | 206 ASSERT_TRUE(base::CopyDirectory(data_path, temp_path, true)); |
207 ASSERT_TRUE(DecompressDatabase(temp_path.AppendASCII("edge_profile"))); | 207 ASSERT_TRUE(DecompressDatabase(temp_path.AppendASCII("edge_profile"))); |
208 | 208 |
209 base::string16 key_path(importer::GetEdgeSettingsKey()); | 209 base::string16 key_path(importer::GetEdgeSettingsKey()); |
210 base::win::RegKey key; | 210 base::win::RegKey key; |
211 ASSERT_EQ(ERROR_SUCCESS, | 211 ASSERT_EQ(ERROR_SUCCESS, |
212 key.Create(HKEY_CURRENT_USER, key_path.c_str(), KEY_WRITE)); | 212 key.Create(HKEY_CURRENT_USER, key_path.c_str(), KEY_WRITE)); |
213 key.WriteValue(L"FavoritesESEEnabled", 1); | 213 key.WriteValue(L"FavoritesESEEnabled", 1); |
214 ASSERT_FALSE(importer::IsEdgeFavoritesLegacyMode()); | 214 ASSERT_FALSE(importer::IsEdgeFavoritesLegacyMode()); |
215 | 215 |
(...skipping 20 matching lines...) Expand all Loading... |
236 kEdgeBookmarks, kEdgeBookmarks + arraysize(kEdgeBookmarks)); | 236 kEdgeBookmarks, kEdgeBookmarks + arraysize(kEdgeBookmarks)); |
237 const FaviconGroup kEdgeFaviconGroup[] = { | 237 const FaviconGroup kEdgeFaviconGroup[] = { |
238 {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/"}}; |
239 std::vector<FaviconGroup> favicon_groups( | 239 std::vector<FaviconGroup> favicon_groups( |
240 kEdgeFaviconGroup, kEdgeFaviconGroup + arraysize(kEdgeFaviconGroup)); | 240 kEdgeFaviconGroup, kEdgeFaviconGroup + arraysize(kEdgeFaviconGroup)); |
241 | 241 |
242 base::FilePath data_path; | 242 base::FilePath data_path; |
243 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); | 243 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); |
244 data_path = data_path.AppendASCII("edge_profile"); | 244 data_path = data_path.AppendASCII("edge_profile"); |
245 | 245 |
246 ASSERT_TRUE(base::CopyDirectory(data_path, temp_dir_.path(), true)); | 246 ASSERT_TRUE(base::CopyDirectory(data_path, temp_dir_.GetPath(), true)); |
247 ASSERT_TRUE(importer::IsEdgeFavoritesLegacyMode()); | 247 ASSERT_TRUE(importer::IsEdgeFavoritesLegacyMode()); |
248 | 248 |
249 // Starts to import the above settings. | 249 // Starts to import the above settings. |
250 // Deletes itself. | 250 // Deletes itself. |
251 ExternalProcessImporterHost* host = new ExternalProcessImporterHost; | 251 ExternalProcessImporterHost* host = new ExternalProcessImporterHost; |
252 scoped_refptr<TestObserver> observer( | 252 scoped_refptr<TestObserver> observer( |
253 new TestObserver(bookmark_entries, favicon_groups)); | 253 new TestObserver(bookmark_entries, favicon_groups)); |
254 host->set_observer(observer.get()); | 254 host->set_observer(observer.get()); |
255 | 255 |
256 importer::SourceProfile source_profile; | 256 importer::SourceProfile source_profile; |
257 source_profile.importer_type = importer::TYPE_EDGE; | 257 source_profile.importer_type = importer::TYPE_EDGE; |
258 base::FilePath source_path = temp_dir_.path().AppendASCII("edge_profile"); | 258 base::FilePath source_path = temp_dir_.GetPath().AppendASCII("edge_profile"); |
259 ASSERT_NE(-1, | 259 ASSERT_NE(-1, |
260 base::WriteFile( | 260 base::WriteFile( |
261 source_path.AppendASCII("Favorites\\Google.url:favicon:$DATA"), | 261 source_path.AppendASCII("Favorites\\Google.url:favicon:$DATA"), |
262 kDummyFaviconImageData, sizeof(kDummyFaviconImageData))); | 262 kDummyFaviconImageData, sizeof(kDummyFaviconImageData))); |
263 source_profile.source_path = source_path; | 263 source_profile.source_path = source_path; |
264 | 264 |
265 host->StartImportSettings(source_profile, browser()->profile(), | 265 host->StartImportSettings(source_profile, browser()->profile(), |
266 importer::FAVORITES, observer.get()); | 266 importer::FAVORITES, observer.get()); |
267 base::RunLoop().Run(); | 267 base::RunLoop().Run(); |
268 } | 268 } |
(...skipping 15 matching lines...) Expand all Loading... |
284 | 284 |
285 // Starts to import the above settings. | 285 // Starts to import the above settings. |
286 // Deletes itself. | 286 // Deletes itself. |
287 ExternalProcessImporterHost* host = new ExternalProcessImporterHost; | 287 ExternalProcessImporterHost* host = new ExternalProcessImporterHost; |
288 scoped_refptr<TestObserver> observer( | 288 scoped_refptr<TestObserver> observer( |
289 new TestObserver(bookmark_entries, favicon_groups)); | 289 new TestObserver(bookmark_entries, favicon_groups)); |
290 host->set_observer(observer.get()); | 290 host->set_observer(observer.get()); |
291 | 291 |
292 importer::SourceProfile source_profile; | 292 importer::SourceProfile source_profile; |
293 source_profile.importer_type = importer::TYPE_EDGE; | 293 source_profile.importer_type = importer::TYPE_EDGE; |
294 source_profile.source_path = temp_dir_.path(); | 294 source_profile.source_path = temp_dir_.GetPath(); |
295 | 295 |
296 host->StartImportSettings(source_profile, browser()->profile(), | 296 host->StartImportSettings(source_profile, browser()->profile(), |
297 importer::FAVORITES, observer.get()); | 297 importer::FAVORITES, observer.get()); |
298 base::RunLoop().Run(); | 298 base::RunLoop().Run(); |
299 } | 299 } |
OLD | NEW |