OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/search/search_ipc_router.h" | 5 #include "chrome/browser/ui/search/search_ipc_router.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 search_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); | 103 search_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); |
104 | 104 |
105 TemplateURLData data; | 105 TemplateURLData data; |
106 data.SetShortName(base::ASCIIToUTF16("foo.com")); | 106 data.SetShortName(base::ASCIIToUTF16("foo.com")); |
107 data.SetURL("http://foo.com/url?bar={searchTerms}"); | 107 data.SetURL("http://foo.com/url?bar={searchTerms}"); |
108 data.instant_url = "http://foo.com/instant?foo=foo#foo=foo&espv"; | 108 data.instant_url = "http://foo.com/instant?foo=foo#foo=foo&espv"; |
109 data.new_tab_url = "https://foo.com/newtab?espv"; | 109 data.new_tab_url = "https://foo.com/newtab?espv"; |
110 data.alternate_urls.push_back("http://foo.com/alt#quux={searchTerms}"); | 110 data.alternate_urls.push_back("http://foo.com/alt#quux={searchTerms}"); |
111 data.search_terms_replacement_key = "espv"; | 111 data.search_terms_replacement_key = "espv"; |
112 | 112 |
113 TemplateURL* template_url = new TemplateURL(data); | 113 TemplateURL* template_url = |
114 // Takes ownership of |template_url|. | 114 template_url_service->Add(base::MakeUnique<TemplateURL>(data)); |
115 template_url_service->Add(template_url); | |
116 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); | 115 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
117 process()->sink().ClearMessages(); | 116 process()->sink().ClearMessages(); |
118 } | 117 } |
119 | 118 |
120 content::WebContents* web_contents() { | 119 content::WebContents* web_contents() { |
121 return browser()->tab_strip_model()->GetActiveWebContents(); | 120 return browser()->tab_strip_model()->GetActiveWebContents(); |
122 } | 121 } |
123 | 122 |
124 content::MockRenderProcessHost* process() { | 123 content::MockRenderProcessHost* process() { |
125 return static_cast<content::MockRenderProcessHost*>( | 124 return static_cast<content::MockRenderProcessHost*>( |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 695 |
697 // Construct a series of synthetic messages for each valid IPC message type, | 696 // Construct a series of synthetic messages for each valid IPC message type, |
698 // ensuring the router ignores them all. | 697 // ensuring the router ignores them all. |
699 for (int i = 0; i < LastIPCMsgStart; ++i) { | 698 for (int i = 0; i < LastIPCMsgStart; ++i) { |
700 const int message_id = i << 16; | 699 const int message_id = i << 16; |
701 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); | 700 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); |
702 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); | 701 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); |
703 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; | 702 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; |
704 } | 703 } |
705 } | 704 } |
OLD | NEW |