Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6227)

Unified Diff: chrome/browser/importer/firefox_importer_browsertest.cc

Issue 480953002: Implement "Autofill form data" import for Firefox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback (simplify Read method) Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/importer/firefox_importer_browsertest.cc
diff --git a/chrome/browser/importer/firefox_importer_browsertest.cc b/chrome/browser/importer/firefox_importer_browsertest.cc
index 8ae0237a457cb76a7924889700151eac84c2f29e..3df0e4e4d713f79bac54c809a9b69d906d1194ed 100644
--- a/chrome/browser/importer/firefox_importer_browsertest.cc
+++ b/chrome/browser/importer/firefox_importer_browsertest.cc
@@ -20,6 +20,7 @@
#include "chrome/common/importer/imported_favicon_usage.h"
#include "chrome/common/importer/importer_data_types.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "components/autofill/core/browser/webdata/autofill_entry.h"
#include "components/autofill/core/common/password_form.h"
#include "components/search_engines/template_url.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -51,6 +52,11 @@ struct KeywordInfo {
const char* url;
};
+struct AutofillFormDataInfo {
+ const char* name;
+ const char* value;
+};
+
const BookmarkInfo kFirefoxBookmarks[] = {
{true, 1, {"Bookmarks Toolbar"},
L"Toolbar",
@@ -94,6 +100,21 @@ const KeywordInfo kFirefoxKeywords[] = {
{L"\x4E2D\x6587", L"\x4E2D\x6587", "http://www.google.com/"},
};
+const AutofillFormDataInfo kFirefoxAutofillEntries[] = {
+ {"name", "John"},
+ {"address", "#123 Cherry Ave"},
+ {"city", "Mountain View"},
+ {"zip", "94043"},
+ {"n300", "+1 (408) 871-4567"},
+ {"name", "john"},
+ {"name", "aguantó"},
+ {"address", "télévision@example.com"},
+ {"city", "&$%$$$ TESTO *&*&^&^& MOKO"},
+ {"zip", "WOHOOOO$$$$$$$$****"},
+ {"n300", "\xe0\xa4\x9f\xe2\x97\x8c\xe0\xa4\xbe\xe0\xa4\xaf\xe0\xa4\xb0"},
+ {"n300", "\xe4\xbb\xa5\xe7\x8e\xa9\xe4\xb8\xba\xe4\xb8\xbb"}
+};
+
class FirefoxObserver : public ProfileWriter,
public importer::ImporterProgressObserver {
public:
@@ -167,6 +188,17 @@ class FirefoxObserver : public ProfileWriter,
}
}
+ virtual void AddAutofillFormDataEntries(
+ const std::vector<autofill::AutofillEntry>& autofill_entries) OVERRIDE {
+ EXPECT_EQ(arraysize(kFirefoxAutofillEntries), autofill_entries.size());
+ for (size_t i = 0; i < arraysize(kFirefoxAutofillEntries); ++i) {
+ EXPECT_EQ(kFirefoxAutofillEntries[i].name,
+ base::UTF16ToUTF8(autofill_entries[i].key().name()));
+ EXPECT_EQ(kFirefoxAutofillEntries[i].value,
+ base::UTF16ToUTF8(autofill_entries[i].key().value()));
+ }
+ }
+
virtual void AddKeywords(ScopedVector<TemplateURL> template_urls,
bool unique_on_host_and_path) OVERRIDE {
for (size_t i = 0; i < template_urls.size(); ++i) {
@@ -271,7 +303,7 @@ class FirefoxProfileImporterBrowserTest : public InProcessBrowserTest {
source_profile.locale = "en-US";
int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES |
- importer::SEARCH_ENGINES;
+ importer::SEARCH_ENGINES | importer::AUTOFILL_FORM_DATA;
// Deletes itself.
ExternalProcessImporterHost* host = new ExternalProcessImporterHost;
« no previous file with comments | « chrome/browser/importer/external_process_importer_client.cc ('k') | chrome/browser/importer/importer_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698