OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 #include "chrome/browser/ui/search/search_model.h" | 6 #include "chrome/browser/ui/search/search_model.h" |
7 #include "chrome/browser/ui/search/search_tab_helper.h" | 7 #include "chrome/browser/ui/search/search_tab_helper.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/test/base/browser_with_test_window_test.h" | 9 #include "chrome/test/base/browser_with_test_window_test.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 SearchTabHelper::FromWebContents(web_contents)->model()-> | 23 SearchTabHelper::FromWebContents(web_contents)->model()-> |
24 SetMode(SearchMode(SearchMode::MODE_NTP, SearchMode::ORIGIN_NTP)); | 24 SetMode(SearchMode(SearchMode::MODE_NTP, SearchMode::ORIGIN_NTP)); |
25 EXPECT_TRUE(browser()->search_model()->mode().is_ntp()); | 25 EXPECT_TRUE(browser()->search_model()->mode().is_ntp()); |
26 | 26 |
27 // Add second tab, make it active, and make sure its mode changes | 27 // Add second tab, make it active, and make sure its mode changes |
28 // propagate to the browser's search model. | 28 // propagate to the browser's search model. |
29 AddTab(browser(), GURL("http://foo/1")); | 29 AddTab(browser(), GURL("http://foo/1")); |
30 browser()->tab_strip_model()->ActivateTabAt(1, true); | 30 browser()->tab_strip_model()->ActivateTabAt(1, true); |
31 web_contents = browser()->tab_strip_model()->GetWebContentsAt(1); | 31 web_contents = browser()->tab_strip_model()->GetWebContentsAt(1); |
32 SearchTabHelper::FromWebContents(web_contents)->model()-> | 32 SearchTabHelper::FromWebContents(web_contents)->model()-> |
33 SetMode(SearchMode(SearchMode::MODE_SEARCH_RESULTS, | 33 SetMode(SearchMode(SearchMode::MODE_SEARCH_SUGGESTIONS, |
34 SearchMode::ORIGIN_DEFAULT)); | 34 SearchMode::ORIGIN_DEFAULT)); |
35 EXPECT_TRUE(browser()->search_model()->mode().is_search()); | 35 EXPECT_TRUE(browser()->search_model()->mode().is_search_suggestions()); |
36 | 36 |
37 // The first tab is not active so changes should not propagate. | 37 // The first tab is not active so changes should not propagate. |
38 web_contents = browser()->tab_strip_model()->GetWebContentsAt(0); | 38 web_contents = browser()->tab_strip_model()->GetWebContentsAt(0); |
39 SearchTabHelper::FromWebContents(web_contents)->model()-> | 39 SearchTabHelper::FromWebContents(web_contents)->model()-> |
40 SetMode(SearchMode(SearchMode::MODE_NTP, SearchMode::ORIGIN_NTP)); | 40 SetMode(SearchMode(SearchMode::MODE_NTP, SearchMode::ORIGIN_NTP)); |
41 EXPECT_TRUE(browser()->search_model()->mode().is_search()); | 41 EXPECT_TRUE(browser()->search_model()->mode().is_search_suggestions()); |
42 } | 42 } |
OLD | NEW |