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_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
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/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 // Creates a sign-in manager for tests. If |username| is not empty, the | 94 // Creates a sign-in manager for tests. If |username| is not empty, the |
95 // testing profile of the WebContents will be connected to the given account. | 95 // testing profile of the WebContents will be connected to the given account. |
96 void CreateSigninManager(const std::string& username) { | 96 void CreateSigninManager(const std::string& username) { |
97 SigninManagerBase* signin_manager = static_cast<SigninManagerBase*>( | 97 SigninManagerBase* signin_manager = static_cast<SigninManagerBase*>( |
98 SigninManagerFactory::GetForProfile(profile())); | 98 SigninManagerFactory::GetForProfile(profile())); |
99 | 99 |
100 if (!username.empty()) { | 100 if (!username.empty()) { |
101 ASSERT_TRUE(signin_manager); | 101 ASSERT_TRUE(signin_manager); |
102 signin_manager->SetAuthenticatedUsername(username); | 102 signin_manager->SetAuthenticatedAccountInfo(username, username); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 // Configure the account to |sync_history| or not. | 106 // Configure the account to |sync_history| or not. |
107 void SetHistorySync(bool sync_history) { | 107 void SetHistorySync(bool sync_history) { |
108 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>( | 108 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>( |
109 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile())); | 109 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile())); |
110 | 110 |
111 syncer::ModelTypeSet result; | 111 syncer::ModelTypeSet result; |
112 if (sync_history) { | 112 if (sync_history) { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 } | 435 } |
436 | 436 |
437 TEST_F(SearchTabHelperPrerenderTest, | 437 TEST_F(SearchTabHelperPrerenderTest, |
438 OnTabActivatedNoPrerenderIfOmniboxBlurred) { | 438 OnTabActivatedNoPrerenderIfOmniboxBlurred) { |
439 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false; | 439 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false; |
440 SearchTabHelper* search_tab_helper = | 440 SearchTabHelper* search_tab_helper = |
441 SearchTabHelper::FromWebContents(web_contents()); | 441 SearchTabHelper::FromWebContents(web_contents()); |
442 search_tab_helper->OnTabActivated(); | 442 search_tab_helper->OnTabActivated(); |
443 ASSERT_FALSE(IsInstantURLMarkedForPrerendering()); | 443 ASSERT_FALSE(IsInstantURLMarkedForPrerendering()); |
444 } | 444 } |
OLD | NEW |