Chromium Code Reviews| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 = new TemplateURL(data); |
| 114 // Takes ownership of |template_url|. | 114 // Takes ownership of |template_url|. |
|
Peter Kasting
2016/08/31 04:12:56
Nit: Comment is now redundant.
Avi (use Gerrit)
2016/09/01 00:34:26
Done.
| |
| 115 template_url_service->Add(template_url); | 115 template_url_service->Add(base::WrapUnique(template_url)); |
| 116 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); | 116 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
| 117 process()->sink().ClearMessages(); | 117 process()->sink().ClearMessages(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 content::WebContents* web_contents() { | 120 content::WebContents* web_contents() { |
| 121 return browser()->tab_strip_model()->GetActiveWebContents(); | 121 return browser()->tab_strip_model()->GetActiveWebContents(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 content::MockRenderProcessHost* process() { | 124 content::MockRenderProcessHost* process() { |
| 125 return static_cast<content::MockRenderProcessHost*>( | 125 return static_cast<content::MockRenderProcessHost*>( |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 | 696 |
| 697 // Construct a series of synthetic messages for each valid IPC message type, | 697 // Construct a series of synthetic messages for each valid IPC message type, |
| 698 // ensuring the router ignores them all. | 698 // ensuring the router ignores them all. |
| 699 for (int i = 0; i < LastIPCMsgStart; ++i) { | 699 for (int i = 0; i < LastIPCMsgStart; ++i) { |
| 700 const int message_id = i << 16; | 700 const int message_id = i << 16; |
| 701 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); | 701 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); |
| 702 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); | 702 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); |
| 703 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; | 703 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; |
| 704 } | 704 } |
| 705 } | 705 } |
| OLD | NEW |