| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/history/core/browser/web_history_service.h" | 5 #include "components/history/core/browser/web_history_service.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "chrome/browser/history/web_history_service_factory.h" | 9 #include "chrome/browser/history/web_history_service_factory.h" |
| 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 10 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 void SetExpectedURL(const GURL& expected_url) { | 61 void SetExpectedURL(const GURL& expected_url) { |
| 62 expected_url_ = expected_url; | 62 expected_url_ = expected_url; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void SetExpectedAudioHistoryValue(bool expected_value) { | 65 void SetExpectedAudioHistoryValue(bool expected_value) { |
| 66 expected_audio_history_value_ = expected_value; | 66 expected_audio_history_value_ = expected_value; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void SetExpectedPostData(const std::string& expected_data) { | 69 void SetExpectedPostData(const std::string& expected_data) { |
| 70 current_expected_post_data_= expected_data; | 70 current_expected_post_data_ = expected_data; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void EnsureNoPendingRequestsRemain() { | 73 void EnsureNoPendingRequestsRemain() { |
| 74 EXPECT_EQ(0u, GetNumberOfPendingAudioHistoryRequests()); | 74 EXPECT_EQ(0u, GetNumberOfPendingAudioHistoryRequests()); |
| 75 } | 75 } |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 GURL expected_url_; | 78 GURL expected_url_; |
| 79 bool expected_audio_history_value_; | 79 bool expected_audio_history_value_; |
| 80 std::string current_expected_post_data_; | 80 std::string current_expected_post_data_; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 void SetUp() override { | 219 void SetUp() override { |
| 220 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 220 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 221 &profile_, &ProfileSyncServiceMock::BuildMockProfileSyncService); | 221 &profile_, &ProfileSyncServiceMock::BuildMockProfileSyncService); |
| 222 // Use SetTestingFactoryAndUse to force creation and initialization. | 222 // Use SetTestingFactoryAndUse to force creation and initialization. |
| 223 WebHistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 223 WebHistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 224 &profile_, &BuildWebHistoryService); | 224 &profile_, &BuildWebHistoryService); |
| 225 | 225 |
| 226 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>( | 226 ProfileSyncServiceMock* sync_service = static_cast<ProfileSyncServiceMock*>( |
| 227 ProfileSyncServiceFactory::GetInstance()->GetForProfile(&profile_)); | 227 ProfileSyncServiceFactory::GetInstance()->GetForProfile(&profile_)); |
| 228 EXPECT_CALL(*sync_service, | 228 EXPECT_CALL(*sync_service, |
| 229 SyncActive()).WillRepeatedly(Return(true)); | 229 IsSyncActive()).WillRepeatedly(Return(true)); |
| 230 syncer::ModelTypeSet result; | 230 syncer::ModelTypeSet result; |
| 231 result.Put(syncer::HISTORY_DELETE_DIRECTIVES); | 231 result.Put(syncer::HISTORY_DELETE_DIRECTIVES); |
| 232 EXPECT_CALL(*sync_service, | 232 EXPECT_CALL(*sync_service, |
| 233 GetActiveDataTypes()).WillRepeatedly(Return(result)); | 233 GetActiveDataTypes()).WillRepeatedly(Return(result)); |
| 234 } | 234 } |
| 235 void TearDown() override { | 235 void TearDown() override { |
| 236 base::RunLoop run_loop; | 236 base::RunLoop run_loop; |
| 237 base::MessageLoop::current()->PostTask(FROM_HERE, run_loop.QuitClosure()); | 237 base::MessageLoop::current()->PostTask(FROM_HERE, run_loop.QuitClosure()); |
| 238 run_loop.Run(); | 238 run_loop.Run(); |
| 239 } | 239 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 " \"history_recording\": true\n" | 419 " \"history_recording\": true\n" |
| 420 "}")); | 420 "}")); |
| 421 scoped_ptr<base::DictionaryValue> response_value5; | 421 scoped_ptr<base::DictionaryValue> response_value5; |
| 422 // ReadResponse deletes the request | 422 // ReadResponse deletes the request |
| 423 response_value5 = TestingWebHistoryService::ReadResponse(request5.get()); | 423 response_value5 = TestingWebHistoryService::ReadResponse(request5.get()); |
| 424 enabled_value = true; | 424 enabled_value = true; |
| 425 EXPECT_FALSE(response_value5->GetBoolean("history_recording_enabled", | 425 EXPECT_FALSE(response_value5->GetBoolean("history_recording_enabled", |
| 426 &enabled_value)); | 426 &enabled_value)); |
| 427 EXPECT_TRUE(enabled_value); | 427 EXPECT_TRUE(enabled_value); |
| 428 } | 428 } |
| OLD | NEW |