| 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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/run_loop.h" |
| 12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 13 #include "components/previews/core/previews_ui_service.h" | 14 #include "components/previews/core/previews_ui_service.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 16 |
| 16 namespace previews { | 17 namespace previews { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 class TestPreviewsIOData : public PreviewsIOData { | 21 class TestPreviewsIOData : public PreviewsIOData { |
| 21 public: | 22 public: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 std::unique_ptr<PreviewsUIService> ui_service_; | 66 std::unique_ptr<PreviewsUIService> ui_service_; |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 } // namespace | 69 } // namespace |
| 69 | 70 |
| 70 TEST_F(PreviewsIODataTest, TestInitialization) { | 71 TEST_F(PreviewsIODataTest, TestInitialization) { |
| 71 set_io_data(base::WrapUnique( | 72 set_io_data(base::WrapUnique( |
| 72 new TestPreviewsIOData(loop_.task_runner(), loop_.task_runner()))); | 73 new TestPreviewsIOData(loop_.task_runner(), loop_.task_runner()))); |
| 73 set_ui_service(base::WrapUnique( | 74 set_ui_service(base::WrapUnique( |
| 74 new PreviewsUIService(io_data(), loop_.task_runner(), nullptr))); | 75 new PreviewsUIService(io_data(), loop_.task_runner(), nullptr))); |
| 75 loop_.RunUntilIdle(); | 76 base::RunLoop().RunUntilIdle(); |
| 76 // After the outstanding posted tasks have run, |io_data_| should be fully | 77 // After the outstanding posted tasks have run, |io_data_| should be fully |
| 77 // initialized. | 78 // initialized. |
| 78 EXPECT_TRUE(io_data()->initialized()); | 79 EXPECT_TRUE(io_data()->initialized()); |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace previews | 82 } // namespace previews |
| OLD | NEW |