summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-10-27 13:27:14 +0100
committerKristian Monsen <kristianm@google.com>2010-10-27 13:27:14 +0100
commitbda42a81ee5f9b20d2bebedcf0bbef1e30e5b293 (patch)
treee6c803134a90c4535df4b3d8d1c1d8f03405e462 /chrome/browser/importer
parent026dcf071380a81f0213473bab11c7db9f367bce (diff)
downloadexternal_chromium-bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293.zip
external_chromium-bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293.tar.gz
external_chromium-bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293.tar.bz2
Adding missing files to chrome/browser
These are not used, but added to easier sync with chromium Change-Id: I54e6f2f49677e29736fd502758a438b2e3d685d8
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r--chrome/browser/importer/firefox_importer_utils_unittest.cc42
-rw-r--r--chrome/browser/importer/importer_messages.cc11
2 files changed, 53 insertions, 0 deletions
diff --git a/chrome/browser/importer/firefox_importer_utils_unittest.cc b/chrome/browser/importer/firefox_importer_utils_unittest.cc
new file mode 100644
index 0000000..7e5fadc
--- /dev/null
+++ b/chrome/browser/importer/firefox_importer_utils_unittest.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+#include "chrome/browser/importer/firefox_importer_utils.h"
+
+struct GetPrefsJsValueCase {
+ std::string prefs_content;
+ std::string pref_name;
+ std::string pref_value;
+} GetPrefsJsValueCases[] = {
+ // Basic case. Single pref, unquoted value.
+ { "user_pref(\"foo.bar\", 1);", "foo.bar", "1" },
+ // Value is quoted. Quotes should be stripped.
+ { "user_pref(\"foo.bar\", \"1\");", "foo.bar", "1" },
+ // Value has parens.
+ { "user_pref(\"foo.bar\", \"Value (detail)\");",
+ "foo.bar", "Value (detail)" },
+ // Multi-line case.
+ { "user_pref(\"foo.bar\", 1);\n"
+ "user_pref(\"foo.baz\", 2);\n"
+ "user_pref(\"foo.bag\", 3);",
+ "foo.baz", "2" },
+ // Malformed content.
+ { "user_pref(\"foo.bar\", 1);\n"
+ "user_pref(\"foo.baz\", 2;\n"
+ "user_pref(\"foo.bag\", 3);",
+ "foo.baz", "" },
+ // Malformed content.
+ { "uesr_pref(\"foo.bar\", 1);", "foo.bar", "" },
+};
+
+TEST(FirefoxImporterUtilsTest, GetPrefsJsValue) {
+ for (size_t i = 0; i < arraysize(GetPrefsJsValueCases); ++i) {
+ EXPECT_EQ(
+ GetPrefsJsValueCases[i].pref_value,
+ GetPrefsJsValue(GetPrefsJsValueCases[i].prefs_content,
+ GetPrefsJsValueCases[i].pref_name));
+ }
+}
diff --git a/chrome/browser/importer/importer_messages.cc b/chrome/browser/importer/importer_messages.cc
new file mode 100644
index 0000000..d20452a
--- /dev/null
+++ b/chrome/browser/importer/importer_messages.cc
@@ -0,0 +1,11 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/importer/importer_messages.h"
+
+#include "base/values.h"
+
+#define MESSAGES_INTERNAL_IMPL_FILE \
+ "chrome/browser/importer/importer_messages_internal.h"
+#include "ipc/ipc_message_impl_macros.h"