| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 "base/scoped_vector.h" |
| 5 #include "chrome/browser/search_engines/template_url.h" | 6 #include "chrome/browser/search_engines/template_url.h" |
| 6 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 7 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 7 #include "chrome/common/pref_names.h" | 8 #include "chrome/common/pref_names.h" |
| 8 #include "chrome/common/scoped_vector.h" | |
| 9 #include "chrome/test/testing_profile.h" | 9 #include "chrome/test/testing_profile.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 typedef testing::Test TemplateURLPrepopulateDataTest; | 12 typedef testing::Test TemplateURLPrepopulateDataTest; |
| 13 | 13 |
| 14 // Verifies the set of prepopulate data doesn't contain entries with duplicate | 14 // Verifies the set of prepopulate data doesn't contain entries with duplicate |
| 15 // ids. | 15 // ids. |
| 16 TEST_F(TemplateURLPrepopulateDataTest, UniqueIDs) { | 16 TEST_F(TemplateURLPrepopulateDataTest, UniqueIDs) { |
| 17 int ids[] = { 'A'<<8|'D', 'A'<<8|'E', 'A'<<8|'F', 'A'<<8|'G', 'A'<<8|'I', | 17 int ids[] = { 'A'<<8|'D', 'A'<<8|'E', 'A'<<8|'F', 'A'<<8|'G', 'A'<<8|'I', |
| 18 'A'<<8|'L', 'A'<<8|'M', 'A'<<8|'N', 'A'<<8|'O', 'A'<<8|'Q', | 18 'A'<<8|'L', 'A'<<8|'M', 'A'<<8|'N', 'A'<<8|'O', 'A'<<8|'Q', |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 TemplateURLPrepopulateData::GetPrepopulatedEngines( | 71 TemplateURLPrepopulateData::GetPrepopulatedEngines( |
| 72 profile.GetPrefs(), &(urls.get()), &url_count); | 72 profile.GetPrefs(), &(urls.get()), &url_count); |
| 73 std::set<int> unique_ids; | 73 std::set<int> unique_ids; |
| 74 for (size_t turl_i = 0; turl_i < urls.size(); ++turl_i) { | 74 for (size_t turl_i = 0; turl_i < urls.size(); ++turl_i) { |
| 75 ASSERT_TRUE(unique_ids.find(urls[turl_i]->prepopulate_id()) == | 75 ASSERT_TRUE(unique_ids.find(urls[turl_i]->prepopulate_id()) == |
| 76 unique_ids.end()); | 76 unique_ids.end()); |
| 77 unique_ids.insert(urls[turl_i]->prepopulate_id()); | 77 unique_ids.insert(urls[turl_i]->prepopulate_id()); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 } | 80 } |
| OLD | NEW |