OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/previews/core/previews_io_data.h" | 5 #include "components/previews/core/previews_io_data.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 24 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
25 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) | 25 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) |
26 : PreviewsIOData(io_task_runner, ui_task_runner), initialized_(false) {} | 26 : PreviewsIOData(io_task_runner, ui_task_runner), initialized_(false) {} |
27 ~TestPreviewsIOData() override {} | 27 ~TestPreviewsIOData() override {} |
28 | 28 |
29 // Whether Initialize was called. | 29 // Whether Initialize was called. |
30 bool initialized() { return initialized_; } | 30 bool initialized() { return initialized_; } |
31 | 31 |
32 private: | 32 private: |
33 // Set |initialized_| to true and use base class functionality. | 33 // Set |initialized_| to true and use base class functionality. |
34 void InitializeOnIOThread( | 34 void InitializeOnIOThread() override { |
35 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store) override { | |
36 initialized_ = true; | 35 initialized_ = true; |
37 PreviewsIOData::InitializeOnIOThread(std::move(previews_opt_out_store)); | 36 PreviewsIOData::InitializeOnIOThread(); |
38 } | 37 } |
39 | 38 |
40 // Whether Initialize was called. | 39 // Whether Initialize was called. |
41 bool initialized_; | 40 bool initialized_; |
42 }; | 41 }; |
43 | 42 |
44 class PreviewsIODataTest : public testing::Test { | 43 class PreviewsIODataTest : public testing::Test { |
45 public: | 44 public: |
46 PreviewsIODataTest() {} | 45 PreviewsIODataTest() {} |
47 | 46 |
(...skipping 25 matching lines...) Expand all Loading... |
73 new TestPreviewsIOData(loop_.task_runner(), loop_.task_runner()))); | 72 new TestPreviewsIOData(loop_.task_runner(), loop_.task_runner()))); |
74 set_ui_service(base::WrapUnique( | 73 set_ui_service(base::WrapUnique( |
75 new PreviewsUIService(io_data(), loop_.task_runner(), nullptr))); | 74 new PreviewsUIService(io_data(), loop_.task_runner(), nullptr))); |
76 base::RunLoop().RunUntilIdle(); | 75 base::RunLoop().RunUntilIdle(); |
77 // After the outstanding posted tasks have run, |io_data_| should be fully | 76 // After the outstanding posted tasks have run, |io_data_| should be fully |
78 // initialized. | 77 // initialized. |
79 EXPECT_TRUE(io_data()->initialized()); | 78 EXPECT_TRUE(io_data()->initialized()); |
80 } | 79 } |
81 | 80 |
82 } // namespace previews | 81 } // namespace previews |
OLD | NEW |