| 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_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/metrics/histogram.h" | 6 #include "base/metrics/histogram.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/protector/base_setting_change.h" | 9 #include "chrome/browser/protector/base_setting_change.h" |
| 10 #include "chrome/browser/protector/histograms.h" | 10 #include "chrome/browser/protector/histograms.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 virtual void CleanUpOnMainThread() OVERRIDE { | 69 virtual void CleanUpOnMainThread() OVERRIDE { |
| 70 EXPECT_CALL(*mock_protector_service_, Shutdown()); | 70 EXPECT_CALL(*mock_protector_service_, Shutdown()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 TemplateURL* MakeTemplateURL(const string16& short_name, | 73 TemplateURL* MakeTemplateURL(const string16& short_name, |
| 74 const string16& keyword, | 74 const string16& keyword, |
| 75 const std::string& url) { | 75 const std::string& url) { |
| 76 TemplateURLData data; | 76 TemplateURLData data; |
| 77 data.short_name = short_name; | 77 data.short_name = short_name; |
| 78 if (keyword.empty()) | 78 data.SetKeyword(keyword); |
| 79 data.SetAutogenerateKeyword(true); | |
| 80 else | |
| 81 data.SetKeyword(keyword); | |
| 82 data.SetURL(url); | 79 data.SetURL(url); |
| 83 return new TemplateURL(browser()->profile(), data); | 80 return new TemplateURL(browser()->profile(), data); |
| 84 } | 81 } |
| 85 | 82 |
| 86 TemplateURL* FindTemplateURL(const std::string& search_url) { | 83 TemplateURL* FindTemplateURL(const std::string& search_url) { |
| 87 TemplateURLService::TemplateURLVector urls = | 84 TemplateURLService::TemplateURLVector urls = |
| 88 turl_service_->GetTemplateURLs(); | 85 turl_service_->GetTemplateURLs(); |
| 89 for (TemplateURLService::TemplateURLVector::const_iterator | 86 for (TemplateURLService::TemplateURLVector::const_iterator |
| 90 it = urls.begin(); it != urls.end(); ++it) { | 87 it = urls.begin(); it != urls.end(); ++it) { |
| 91 if ((*it)->url() == search_url) | 88 if ((*it)->url() == search_url) |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 EXPECT_EQ(FindTemplateURL(http_example_info), | 667 EXPECT_EQ(FindTemplateURL(http_example_info), |
| 671 turl_service_->GetDefaultSearchProvider()); | 668 turl_service_->GetDefaultSearchProvider()); |
| 672 | 669 |
| 673 // Discard does nothing - backup was already active. | 670 // Discard does nothing - backup was already active. |
| 674 change->Discard(browser()); | 671 change->Discard(browser()); |
| 675 EXPECT_EQ(FindTemplateURL(http_example_info), | 672 EXPECT_EQ(FindTemplateURL(http_example_info), |
| 676 turl_service_->GetDefaultSearchProvider()); | 673 turl_service_->GetDefaultSearchProvider()); |
| 677 } | 674 } |
| 678 | 675 |
| 679 } // namespace protector | 676 } // namespace protector |
| OLD | NEW |