| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Configure the account to |sync_history| or not. | 104 // Configure the account to |sync_history| or not. |
| 105 void SetHistorySync(bool sync_history) { | 105 void SetHistorySync(bool sync_history) { |
| 106 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>( | 106 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>( |
| 107 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile())); | 107 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile())); |
| 108 | 108 |
| 109 EXPECT_CALL(*sync_service, SyncActive()).WillRepeatedly(Return(true)); | 109 EXPECT_CALL(*sync_service, SyncActive()).WillRepeatedly(Return(true)); |
| 110 syncer::ModelTypeSet result; | 110 syncer::ModelTypeSet result; |
| 111 if (sync_history) { | 111 if (sync_history) { |
| 112 result.Put(syncer::HISTORY_DELETE_DIRECTIVES); | 112 result.Put(syncer::HISTORY_DELETE_DIRECTIVES); |
| 113 } | 113 } |
| 114 EXPECT_CALL(*sync_service, GetActiveDataTypes()) | 114 EXPECT_CALL(*sync_service, GetPreferredDataTypes()) |
| 115 .WillRepeatedly(Return(result)); | 115 .WillRepeatedly(Return(result)); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool MessageWasSent(uint32 id) { | 118 bool MessageWasSent(uint32 id) { |
| 119 return process()->sink().GetFirstMessageMatching(id) != NULL; | 119 return process()->sink().GetFirstMessageMatching(id) != NULL; |
| 120 } | 120 } |
| 121 | 121 |
| 122 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } | 122 MockSearchIPCRouterDelegate* mock_delegate() { return &delegate_; } |
| 123 | 123 |
| 124 private: | 124 private: |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 } | 456 } |
| 457 | 457 |
| 458 TEST_F(SearchTabHelperPrerenderTest, | 458 TEST_F(SearchTabHelperPrerenderTest, |
| 459 OnTabActivatedNoPrerenderIfOmniboxBlurred) { | 459 OnTabActivatedNoPrerenderIfOmniboxBlurred) { |
| 460 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false; | 460 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false; |
| 461 SearchTabHelper* search_tab_helper = | 461 SearchTabHelper* search_tab_helper = |
| 462 SearchTabHelper::FromWebContents(web_contents()); | 462 SearchTabHelper::FromWebContents(web_contents()); |
| 463 search_tab_helper->OnTabActivated(); | 463 search_tab_helper->OnTabActivated(); |
| 464 ASSERT_FALSE(IsInstantURLMarkedForPrerendering()); | 464 ASSERT_FALSE(IsInstantURLMarkedForPrerendering()); |
| 465 } | 465 } |
| OLD | NEW |