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

Side by Side Diff: chrome/browser/importer/firefox_importer_utils_unittest.cc

Issue 3221007: Fix a couple of firefox search engine import bugs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: added test, TODO Created 10 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/importer/firefox_importer_utils.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "testing/gtest/include/gtest/gtest.h"
6
7 #include "chrome/browser/importer/firefox_importer_utils.h"
8
9 struct GetPrefsJsValueCase {
10 std::string prefs_content;
11 std::string pref_name;
12 std::string pref_value;
13 } GetPrefsJsValueCases[] = {
14 // Basic case. Single pref, unquoted value.
15 { "user_pref(\"foo.bar\", 1);", "foo.bar", "1" },
16 // Value is quoted. Quotes should be stripped.
17 { "user_pref(\"foo.bar\", \"1\");", "foo.bar", "1" },
18 // Value has parens.
19 { "user_pref(\"foo.bar\", \"Value (detail)\");",
20 "foo.bar", "Value (detail)" },
21 // Multi-line case.
22 { "user_pref(\"foo.bar\", 1);\n"
23 "user_pref(\"foo.baz\", 2);\n"
24 "user_pref(\"foo.bag\", 3);",
25 "foo.baz", "2" },
26 // Malformed content.
27 { "user_pref(\"foo.bar\", 1);\n"
28 "user_pref(\"foo.baz\", 2;\n"
29 "user_pref(\"foo.bag\", 3);",
30 "foo.baz", "" },
31 // Malformed content.
32 { "uesr_pref(\"foo.bar\", 1);", "foo.bar", "" },
33 };
34
35 TEST(FirefoxImporterUtilsTest, GetPrefsJsValue) {
36 for (size_t i = 0; i < arraysize(GetPrefsJsValueCases); ++i) {
37 EXPECT_EQ(
38 GetPrefsJsValueCases[i].pref_value,
39 GetPrefsJsValue(GetPrefsJsValueCases[i].prefs_content,
40 GetPrefsJsValueCases[i].pref_name));
41 }
42 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox_importer_utils.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698