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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/test/scoped_task_environment.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
14 #include "components/signin/core/browser/account_tracker_service.h" | 15 #include "components/signin/core/browser/account_tracker_service.h" |
15 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 16 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
16 #include "components/signin/core/browser/fake_signin_manager.h" | 17 #include "components/signin/core/browser/fake_signin_manager.h" |
17 #include "components/signin/core/browser/test_signin_client.h" | 18 #include "components/signin/core/browser/test_signin_client.h" |
18 #include "net/http/http_status_code.h" | 19 #include "net/http/http_status_code.h" |
19 #include "net/url_request/url_request_test_util.h" | 20 #include "net/url_request/url_request_test_util.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 | 23 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 225 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
225 run_loop.QuitClosure()); | 226 run_loop.QuitClosure()); |
226 run_loop.Run(); | 227 run_loop.Run(); |
227 } | 228 } |
228 | 229 |
229 TestingWebHistoryService* web_history_service() { | 230 TestingWebHistoryService* web_history_service() { |
230 return &web_history_service_; | 231 return &web_history_service_; |
231 } | 232 } |
232 | 233 |
233 private: | 234 private: |
234 base::MessageLoop message_loop_; | 235 base::test::ScopedTaskEnvironment scoped_task_environment_; |
235 FakeProfileOAuth2TokenService token_service_; | 236 FakeProfileOAuth2TokenService token_service_; |
236 AccountTrackerService account_tracker_; | 237 AccountTrackerService account_tracker_; |
237 TestSigninClient signin_client_; | 238 TestSigninClient signin_client_; |
238 FakeSigninManagerBase signin_manager_; | 239 FakeSigninManagerBase signin_manager_; |
239 scoped_refptr<net::URLRequestContextGetter> url_request_context_; | 240 scoped_refptr<net::URLRequestContextGetter> url_request_context_; |
240 TestingWebHistoryService web_history_service_; | 241 TestingWebHistoryService web_history_service_; |
241 | 242 |
242 DISALLOW_COPY_AND_ASSIGN(WebHistoryServiceTest); | 243 DISALLOW_COPY_AND_ASSIGN(WebHistoryServiceTest); |
243 }; | 244 }; |
244 | 245 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 std::unique_ptr<base::DictionaryValue> response_value5; | 376 std::unique_ptr<base::DictionaryValue> response_value5; |
376 // ReadResponse deletes the request | 377 // ReadResponse deletes the request |
377 response_value5 = TestingWebHistoryService::ReadResponse(request5.get()); | 378 response_value5 = TestingWebHistoryService::ReadResponse(request5.get()); |
378 enabled_value = true; | 379 enabled_value = true; |
379 EXPECT_FALSE(response_value5->GetBoolean("history_recording_enabled", | 380 EXPECT_FALSE(response_value5->GetBoolean("history_recording_enabled", |
380 &enabled_value)); | 381 &enabled_value)); |
381 EXPECT_TRUE(enabled_value); | 382 EXPECT_TRUE(enabled_value); |
382 } | 383 } |
383 | 384 |
384 } // namespace history | 385 } // namespace history |
OLD | NEW |