summaryrefslogtreecommitdiffstats
path: root/chrome/browser/template_url_prepopulate_data_unittest.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 19:54:56 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 19:54:56 +0000
commitd82443b8abc227bd9aa383bfc62702cf36c97476 (patch)
tree2aa9125983c41369ed92ef78837919853145ca2e /chrome/browser/template_url_prepopulate_data_unittest.cc
parent0063a45b4515ead768e917a4f62f8fe96574a02d (diff)
downloadchromium_src-d82443b8abc227bd9aa383bfc62702cf36c97476.zip
chromium_src-d82443b8abc227bd9aa383bfc62702cf36c97476.tar.gz
chromium_src-d82443b8abc227bd9aa383bfc62702cf36c97476.tar.bz2
Fie.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/template_url_prepopulate_data_unittest.cc')
-rw-r--r--chrome/browser/template_url_prepopulate_data_unittest.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/chrome/browser/template_url_prepopulate_data_unittest.cc b/chrome/browser/template_url_prepopulate_data_unittest.cc
new file mode 100644
index 0000000..14c6abb
--- /dev/null
+++ b/chrome/browser/template_url_prepopulate_data_unittest.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2008 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/template_url.h"
+#include "chrome/browser/template_url_prepopulate_data.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/scoped_vector.h"
+#include "chrome/test/testing_profile.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+typedef testing::Test TemplateURLPrepopulateDataTest;
+
+// Verifies the set of prepopulate data doesn't contain entries with duplicate
+// ids.
+TEST_F(TemplateURLPrepopulateDataTest, UniqueIDs) {
+ // GEO ids.
+ int ids[] = { 0x2, 0x3,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 0xE3, 0xE4, 0xE7, 0xE8,
+ 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2,
+ 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFB, 0xFC, 0xFD, 0xFE,
+ 0x102, 0x103, 0x104, 0x105, 0x107, 0x108, 0x10D, 0x12C, 0x12D,
+ 0x12E, 0x12F, 0x130, 0x131, 0x132, 0x133, 0x134, 0x135, 0x136,
+ 0x137, 0x138, 0x139, 0x13A, 0x13B, 0x13D, 0x13E, 0x13F, 0x141,
+ 0x142, 0x143, 0x144, 0x145, 0x146, 0x147, 0x148, 0x149, 0x14A,
+ 0x14B, 0x14C, 0x14D, 0x14E, 0x14F, 0x150, 0x151, 0x152, 0x153,
+ 0x154, 0x155, 0x156, 0x157, 0x15A, 0x15B, 0x15C, 0x15D, 0x15F,
+ 0x160, 0x3B16, 0x4CA2, 0x52FA, 0x6F60E7, -1 };
+ TestingProfile profile;
+ for (size_t i = 0; i < arraysize(ids); ++i) {
+ profile.GetPrefs()->SetInteger(prefs::kGeoIDAtInstall, ids[i]);
+ ScopedVector<TemplateURL> urls;
+ size_t url_count;
+ TemplateURLPrepopulateData::GetPrepopulatedEngines(
+ profile.GetPrefs(), &(urls.get()), &url_count);
+ std::set<int> unique_ids;
+ for (size_t turl_i = 0; turl_i < urls.size(); ++turl_i) {
+ ASSERT_TRUE(unique_ids.find(urls[turl_i]->prepopulate_id()) ==
+ unique_ids.end());
+ unique_ids.insert(urls[turl_i]->prepopulate_id());
+ }
+ }
+}