| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 SearchTabHelper::CreateForWebContents(web_contents()); | 101 SearchTabHelper::CreateForWebContents(web_contents()); |
| 102 | 102 |
| 103 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 103 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 104 profile(), | 104 profile(), |
| 105 &TemplateURLServiceFactory::BuildInstanceFor); | 105 &TemplateURLServiceFactory::BuildInstanceFor); |
| 106 TemplateURLService* template_url_service = | 106 TemplateURLService* template_url_service = |
| 107 TemplateURLServiceFactory::GetForProfile(profile()); | 107 TemplateURLServiceFactory::GetForProfile(profile()); |
| 108 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); | 108 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service); |
| 109 | 109 |
| 110 TemplateURLData data; | 110 TemplateURLData data; |
| 111 data.SetShortName(base::ASCIIToUTF16("foo.com")); |
| 111 data.SetURL("http://foo.com/url?bar={searchTerms}"); | 112 data.SetURL("http://foo.com/url?bar={searchTerms}"); |
| 112 data.instant_url = "http://foo.com/instant?" | 113 data.instant_url = "http://foo.com/instant?" |
| 113 "{google:omniboxStartMarginParameter}foo=foo#foo=foo&espv"; | 114 "{google:omniboxStartMarginParameter}foo=foo#foo=foo&espv"; |
| 114 data.new_tab_url = "https://foo.com/newtab?espv"; | 115 data.new_tab_url = "https://foo.com/newtab?espv"; |
| 115 data.alternate_urls.push_back("http://foo.com/alt#quux={searchTerms}"); | 116 data.alternate_urls.push_back("http://foo.com/alt#quux={searchTerms}"); |
| 116 data.search_terms_replacement_key = "espv"; | 117 data.search_terms_replacement_key = "espv"; |
| 117 | 118 |
| 118 TemplateURL* template_url = new TemplateURL(data); | 119 TemplateURL* template_url = new TemplateURL(data); |
| 119 // Takes ownership of |template_url|. | 120 // Takes ownership of |template_url|. |
| 120 template_url_service->Add(template_url); | 121 template_url_service->Add(template_url); |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 | 907 |
| 907 // Construct a series of synthetic messages for each valid IPC message type, | 908 // Construct a series of synthetic messages for each valid IPC message type, |
| 908 // ensuring the router ignores them all. | 909 // ensuring the router ignores them all. |
| 909 for (int i = 0; i < LastIPCMsgStart; ++i) { | 910 for (int i = 0; i < LastIPCMsgStart; ++i) { |
| 910 const int message_id = i << 16; | 911 const int message_id = i << 16; |
| 911 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); | 912 ASSERT_EQ(IPC_MESSAGE_ID_CLASS(message_id), i); |
| 912 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); | 913 IPC::Message msg(routing_id, message_id, IPC::Message::PRIORITY_LOW); |
| 913 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; | 914 EXPECT_FALSE(OnSpuriousMessageReceived(msg)) << i; |
| 914 } | 915 } |
| 915 } | 916 } |
| OLD | NEW |