OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The order of these includes is important. | 7 // The order of these includes is important. |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <unknwn.h> | 9 #include <unknwn.h> |
10 #include <intshcut.h> | 10 #include <intshcut.h> |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/browser/importer/importer_bridge.h" | 32 #include "chrome/browser/importer/importer_bridge.h" |
33 #include "chrome/browser/importer/importer_data_types.h" | 33 #include "chrome/browser/importer/importer_data_types.h" |
34 #include "chrome/browser/importer/importer_host.h" | 34 #include "chrome/browser/importer/importer_host.h" |
35 #include "chrome/browser/importer/importer_progress_observer.h" | 35 #include "chrome/browser/importer/importer_progress_observer.h" |
36 #include "chrome/browser/importer/importer_unittest_utils.h" | 36 #include "chrome/browser/importer/importer_unittest_utils.h" |
37 #include "chrome/browser/importer/ie_importer.h" | 37 #include "chrome/browser/importer/ie_importer.h" |
38 #include "chrome/browser/password_manager/ie7_password.h" | 38 #include "chrome/browser/password_manager/ie7_password.h" |
39 #include "chrome/browser/search_engines/template_url.h" | 39 #include "chrome/browser/search_engines/template_url.h" |
40 #include "chrome/common/chrome_paths.h" | 40 #include "chrome/common/chrome_paths.h" |
41 #include "chrome/test/base/testing_profile.h" | 41 #include "chrome/test/base/testing_profile.h" |
42 #include "webkit/forms/password_form.h" | 42 #include "content/public/common/password_form.h" |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 const char16 kUnitTestRegistrySubKey[] = L"SOFTWARE\\Chromium Unit Tests"; | 46 const char16 kUnitTestRegistrySubKey[] = L"SOFTWARE\\Chromium Unit Tests"; |
47 const char16 kUnitTestUserOverrideSubKey[] = | 47 const char16 kUnitTestUserOverrideSubKey[] = |
48 L"SOFTWARE\\Chromium Unit Tests\\HKCU Override"; | 48 L"SOFTWARE\\Chromium Unit Tests\\HKCU Override"; |
49 | 49 |
50 const BookmarkInfo kIEBookmarks[] = { | 50 const BookmarkInfo kIEBookmarks[] = { |
51 {true, 2, {L"Links", L"SubFolderOfLinks"}, | 51 {true, 2, {L"Links", L"SubFolderOfLinks"}, |
52 L"SubLink", | 52 L"SubLink", |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 virtual bool BookmarkModelIsLoaded() const { | 274 virtual bool BookmarkModelIsLoaded() const { |
275 // Profile is ready for writing. | 275 // Profile is ready for writing. |
276 return true; | 276 return true; |
277 } | 277 } |
278 | 278 |
279 virtual bool TemplateURLServiceIsLoaded() const { | 279 virtual bool TemplateURLServiceIsLoaded() const { |
280 return true; | 280 return true; |
281 } | 281 } |
282 | 282 |
283 virtual void AddPasswordForm(const webkit::forms::PasswordForm& form) { | 283 virtual void AddPasswordForm(const content::PasswordForm& form) { |
284 // Importer should obtain this password form only. | 284 // Importer should obtain this password form only. |
285 EXPECT_EQ(GURL("http://localhost:8080/security/index.htm"), form.origin); | 285 EXPECT_EQ(GURL("http://localhost:8080/security/index.htm"), form.origin); |
286 EXPECT_EQ("http://localhost:8080/", form.signon_realm); | 286 EXPECT_EQ("http://localhost:8080/", form.signon_realm); |
287 EXPECT_EQ(L"user", form.username_element); | 287 EXPECT_EQ(L"user", form.username_element); |
288 EXPECT_EQ(L"1", form.username_value); | 288 EXPECT_EQ(L"1", form.username_value); |
289 EXPECT_EQ(L"", form.password_element); | 289 EXPECT_EQ(L"", form.password_element); |
290 EXPECT_EQ(L"2", form.password_value); | 290 EXPECT_EQ(L"2", form.password_value); |
291 EXPECT_EQ("", form.action.spec()); | 291 EXPECT_EQ("", form.action.spec()); |
292 ++password_count_; | 292 ++password_count_; |
293 } | 293 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} | 370 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} |
371 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} | 371 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} |
372 virtual void ImportEnded() OVERRIDE { | 372 virtual void ImportEnded() OVERRIDE { |
373 MessageLoop::current()->Quit(); | 373 MessageLoop::current()->Quit(); |
374 EXPECT_EQ(arraysize(kIESortedBookmarks), bookmark_count_); | 374 EXPECT_EQ(arraysize(kIESortedBookmarks), bookmark_count_); |
375 } | 375 } |
376 | 376 |
377 virtual bool BookmarkModelIsLoaded() const { return true; } | 377 virtual bool BookmarkModelIsLoaded() const { return true; } |
378 virtual bool TemplateURLServiceIsLoaded() const { return true; } | 378 virtual bool TemplateURLServiceIsLoaded() const { return true; } |
379 | 379 |
380 virtual void AddPasswordForm(const webkit::forms::PasswordForm& form) {} | 380 virtual void AddPasswordForm(const content::PasswordForm& form) {} |
381 virtual void AddHistoryPage(const history::URLRows& page, | 381 virtual void AddHistoryPage(const history::URLRows& page, |
382 history::VisitSource visit_source) {} | 382 history::VisitSource visit_source) {} |
383 virtual void AddKeyword(std::vector<TemplateURL*> template_url, | 383 virtual void AddKeyword(std::vector<TemplateURL*> template_url, |
384 int default_keyword_index) {} | 384 int default_keyword_index) {} |
385 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks, | 385 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks, |
386 const string16& top_level_folder_name) OVERRIDE { | 386 const string16& top_level_folder_name) OVERRIDE { |
387 ASSERT_LE(bookmark_count_ + bookmarks.size(), | 387 ASSERT_LE(bookmark_count_ + bookmarks.size(), |
388 arraysize(kIESortedBookmarks)); | 388 arraysize(kIESortedBookmarks)); |
389 for (size_t i = 0; i < bookmarks.size(); ++i) { | 389 for (size_t i = 0; i < bookmarks.size(); ++i) { |
390 EXPECT_TRUE(EqualBookmarkEntry(bookmarks[i], | 390 EXPECT_TRUE(EqualBookmarkEntry(bookmarks[i], |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data1, &username, | 637 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data1, &username, |
638 &password)); | 638 &password)); |
639 EXPECT_EQ(L"abcdefgh", username); | 639 EXPECT_EQ(L"abcdefgh", username); |
640 EXPECT_EQ(L"abcdefghijkl", password); | 640 EXPECT_EQ(L"abcdefghijkl", password); |
641 | 641 |
642 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data2, &username, | 642 ASSERT_TRUE(ie7_password::GetUserPassFromData(decrypted_data2, &username, |
643 &password)); | 643 &password)); |
644 EXPECT_EQ(L"abcdefghi", username); | 644 EXPECT_EQ(L"abcdefghi", username); |
645 EXPECT_EQ(L"abcdefg", password); | 645 EXPECT_EQ(L"abcdefg", password); |
646 } | 646 } |
OLD | NEW |