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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 OnMessageReceived(*message); | 264 OnMessageReceived(*message); |
265 } | 265 } |
266 | 266 |
267 TEST_F(SearchIPCRouterTest, HandleTabChangedEvents) { | 267 TEST_F(SearchIPCRouterTest, HandleTabChangedEvents) { |
268 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 268 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
269 content::WebContents* contents = web_contents(); | 269 content::WebContents* contents = web_contents(); |
270 EXPECT_EQ(0, browser()->tab_strip_model()->GetIndexOfWebContents(contents)); | 270 EXPECT_EQ(0, browser()->tab_strip_model()->GetIndexOfWebContents(contents)); |
271 EXPECT_TRUE(IsActiveTab(contents)); | 271 EXPECT_TRUE(IsActiveTab(contents)); |
272 | 272 |
273 // Add a new tab to deactivate the current tab. | 273 // Add a new tab to deactivate the current tab. |
274 AddTab(browser(), GURL(content::kAboutBlankURL)); | 274 AddTab(browser(), GURL(url::kAboutBlankURL)); |
275 EXPECT_EQ(2, browser()->tab_strip_model()->count()); | 275 EXPECT_EQ(2, browser()->tab_strip_model()->count()); |
276 EXPECT_EQ(1, browser()->tab_strip_model()->GetIndexOfWebContents(contents)); | 276 EXPECT_EQ(1, browser()->tab_strip_model()->GetIndexOfWebContents(contents)); |
277 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); | 277 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
278 EXPECT_FALSE(IsActiveTab(contents)); | 278 EXPECT_FALSE(IsActiveTab(contents)); |
279 | 279 |
280 // Activate the first tab. | 280 // Activate the first tab. |
281 browser()->tab_strip_model()->ActivateTabAt(1, false); | 281 browser()->tab_strip_model()->ActivateTabAt(1, false); |
282 EXPECT_EQ(browser()->tab_strip_model()->active_index(), | 282 EXPECT_EQ(browser()->tab_strip_model()->active_index(), |
283 browser()->tab_strip_model()->GetIndexOfWebContents(contents)); | 283 browser()->tab_strip_model()->GetIndexOfWebContents(contents)); |
284 EXPECT_TRUE(IsActiveTab(contents)); | 284 EXPECT_TRUE(IsActiveTab(contents)); |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); | 908 NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar")); |
909 SetupMockDelegateAndPolicy(); | 909 SetupMockDelegateAndPolicy(); |
910 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); | 910 MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy(); |
911 EXPECT_CALL(*policy, ShouldSendToggleVoiceSearch()).Times(1) | 911 EXPECT_CALL(*policy, ShouldSendToggleVoiceSearch()).Times(1) |
912 .WillOnce(testing::Return(false)); | 912 .WillOnce(testing::Return(false)); |
913 | 913 |
914 process()->sink().ClearMessages(); | 914 process()->sink().ClearMessages(); |
915 GetSearchIPCRouter().ToggleVoiceSearch(); | 915 GetSearchIPCRouter().ToggleVoiceSearch(); |
916 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); | 916 EXPECT_FALSE(MessageWasSent(ChromeViewMsg_SearchBoxToggleVoiceSearch::ID)); |
917 } | 917 } |
OLD | NEW |