| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
| 6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/search_engines/template_url.h" | 8 #include "chrome/browser/search_engines/template_url.h" |
| 9 #include "chrome/browser/search_engines/template_url_service.h" | 9 #include "chrome/browser/search_engines/template_url_service.h" |
| 10 #include "chrome/browser/search_engines/util.h" | 10 #include "chrome/browser/search_engines/util.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 // ID set - Prefer the lowest TemplateURLID if the keywords don't match and if | 80 // ID set - Prefer the lowest TemplateURLID if the keywords don't match and if |
| 81 // none are the default. | 81 // none are the default. |
| 82 local_turls.push_back( | 82 local_turls.push_back( |
| 83 CreatePrepopulateTemplateURL(3, "winner6", 13).release()); | 83 CreatePrepopulateTemplateURL(3, "winner6", 13).release()); |
| 84 local_turls.push_back( | 84 local_turls.push_back( |
| 85 CreatePrepopulateTemplateURL(3, "loser5", 14).release()); | 85 CreatePrepopulateTemplateURL(3, "loser5", 14).release()); |
| 86 local_turls.push_back( | 86 local_turls.push_back( |
| 87 CreatePrepopulateTemplateURL(3, "loser6", 15).release()); | 87 CreatePrepopulateTemplateURL(3, "loser6", 15).release()); |
| 88 | 88 |
| 89 RemoveDuplicatePrepopulateIDs(NULL, prepopulated_turls, default_turl, | 89 RemoveDuplicatePrepopulateIDs( |
| 90 &local_turls, NULL); | 90 NULL, prepopulated_turls, default_turl, &local_turls, NULL); |
| 91 | 91 |
| 92 // Verify that the expected local TURLs survived the process. | 92 // Verify that the expected local TURLs survived the process. |
| 93 EXPECT_EQ(local_turls.size(), | 93 EXPECT_EQ(local_turls.size(), |
| 94 prepopulated_turls.size() + num_non_prepopulated_urls); | 94 prepopulated_turls.size() + num_non_prepopulated_urls); |
| 95 for (TemplateURLService::TemplateURLVector::const_iterator itr = | 95 for (TemplateURLService::TemplateURLVector::const_iterator itr = |
| 96 local_turls.begin(); itr != local_turls.end(); ++itr) { | 96 local_turls.begin(); itr != local_turls.end(); ++itr) { |
| 97 EXPECT_TRUE( | 97 EXPECT_TRUE( |
| 98 StartsWith((*itr)->keyword(), base::ASCIIToUTF16("winner"), true)); | 98 StartsWith((*itr)->keyword(), base::ASCIIToUTF16("winner"), true)) |
| 99 << "Expected '" << (*itr)->keyword() << "' to start with 'winner'."; |
| 99 } | 100 } |
| 100 } | 101 } |
| OLD | NEW |