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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 scoped_ptr<content::MockRenderProcessHost> rph( | 99 scoped_ptr<content::MockRenderProcessHost> rph( |
100 new content::MockRenderProcessHost(profile())); | 100 new content::MockRenderProcessHost(profile())); |
101 rph->sink().ClearMessages(); | 101 rph->sink().ClearMessages(); |
102 instant_service_->Observe( | 102 instant_service_->Observe( |
103 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 103 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
104 content::Source<content::MockRenderProcessHost>(rph.get()), | 104 content::Source<content::MockRenderProcessHost>(rph.get()), |
105 content::NotificationService::NoDetails()); | 105 content::NotificationService::NoDetails()); |
106 EXPECT_EQ(1U, rph->sink().message_count()); | 106 EXPECT_EQ(1U, rph->sink().message_count()); |
107 const IPC::Message* msg = rph->sink().GetMessageAt(0); | 107 const IPC::Message* msg = rph->sink().GetMessageAt(0); |
108 ASSERT_TRUE(msg); | 108 ASSERT_TRUE(msg); |
109 std::vector<GURL> search_urls; | 109 ChromeViewMsg_SetSearchURLs::Param params; |
110 GURL new_tab_page_url; | 110 ChromeViewMsg_SetSearchURLs::Read(msg, ¶ms); |
111 ChromeViewMsg_SetSearchURLs::Read(msg, &search_urls, &new_tab_page_url); | 111 std::vector<GURL> search_urls = params.a; |
| 112 GURL new_tab_page_url = params.b; |
112 EXPECT_EQ(2U, search_urls.size()); | 113 EXPECT_EQ(2U, search_urls.size()); |
113 EXPECT_EQ("https://www.google.com/alt#quux=", search_urls[0].spec()); | 114 EXPECT_EQ("https://www.google.com/alt#quux=", search_urls[0].spec()); |
114 EXPECT_EQ("https://www.google.com/url?bar=", search_urls[1].spec()); | 115 EXPECT_EQ("https://www.google.com/url?bar=", search_urls[1].spec()); |
115 EXPECT_EQ("https://www.google.com/newtab", new_tab_page_url.spec()); | 116 EXPECT_EQ("https://www.google.com/newtab", new_tab_page_url.spec()); |
116 } | 117 } |
117 | 118 |
118 TEST_F(InstantServiceTest, InstantSearchDisabled) { | 119 TEST_F(InstantServiceTest, InstantSearchDisabled) { |
119 // 'prefetch_results' flag is not enabled in field trials. Make sure | 120 // 'prefetch_results' flag is not enabled in field trials. Make sure |
120 // InstantSearchPrerenderer is not initialized. | 121 // InstantSearchPrerenderer is not initialized. |
121 EXPECT_EQ(static_cast<InstantSearchPrerenderer*>(NULL), | 122 EXPECT_EQ(static_cast<InstantSearchPrerenderer*>(NULL), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 NotifyGoogleBaseURLUpdate(new_base_url); | 158 NotifyGoogleBaseURLUpdate(new_base_url); |
158 EXPECT_NE(old_prerenderer, GetInstantSearchPrerenderer()); | 159 EXPECT_NE(old_prerenderer, GetInstantSearchPrerenderer()); |
159 } | 160 } |
160 | 161 |
161 TEST_F(InstantServiceTest, OmniboxStartMarginChanged) { | 162 TEST_F(InstantServiceTest, OmniboxStartMarginChanged) { |
162 int new_start_margin = 92; | 163 int new_start_margin = 92; |
163 EXPECT_CALL(*instant_service_observer_.get(), | 164 EXPECT_CALL(*instant_service_observer_.get(), |
164 OmniboxStartMarginChanged(new_start_margin)).Times(1); | 165 OmniboxStartMarginChanged(new_start_margin)).Times(1); |
165 UpdateOmniboxStartMargin(new_start_margin); | 166 UpdateOmniboxStartMargin(new_start_margin); |
166 } | 167 } |
OLD | NEW |