Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: components/previews/core/previews_ui_service_unittest.cc

Issue 2749693003: Reland of Moving previews code from components/ to chrome/ (Closed)
Patch Set: fixed vector copy Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/previews/core/previews_ui_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ui_service.h" 5 #include "components/previews/core/previews_ui_service.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/run_loop.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "components/previews/core/previews_io_data.h" 14 #include "components/previews/core/previews_io_data.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace previews { 17 namespace previews {
18 18
19 namespace { 19 namespace {
20 20
21 class TestPreviewsUIService : public PreviewsUIService { 21 class TestPreviewsUIService : public PreviewsUIService {
22 public: 22 public:
23 TestPreviewsUIService( 23 TestPreviewsUIService(
24 PreviewsIOData* previews_io_data, 24 PreviewsIOData* previews_io_data,
25 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, 25 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
26 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store) 26 std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store)
27 : PreviewsUIService(previews_io_data, 27 : PreviewsUIService(previews_io_data,
28 io_task_runner, 28 io_task_runner,
29 std::move(previews_opt_out_store)), 29 std::move(previews_opt_out_store),
30 PreviewsIsEnabledCallback()),
30 io_data_set_(false) {} 31 io_data_set_(false) {}
31 ~TestPreviewsUIService() override {} 32 ~TestPreviewsUIService() override {}
32 33
33 // Set |io_data_set_| to true and use base class functionality. 34 // Set |io_data_set_| to true and use base class functionality.
34 void SetIOData(base::WeakPtr<PreviewsIOData> previews_io_data) override { 35 void SetIOData(base::WeakPtr<PreviewsIOData> previews_io_data) override {
35 io_data_set_ = true; 36 io_data_set_ = true;
36 PreviewsUIService::SetIOData(previews_io_data); 37 PreviewsUIService::SetIOData(previews_io_data);
37 } 38 }
38 39
39 // Whether SetIOData was called. 40 // Whether SetIOData was called.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 new PreviewsIOData(loop_.task_runner(), loop_.task_runner()))); 79 new PreviewsIOData(loop_.task_runner(), loop_.task_runner())));
79 set_ui_service(base::WrapUnique( 80 set_ui_service(base::WrapUnique(
80 new TestPreviewsUIService(io_data(), loop_.task_runner(), nullptr))); 81 new TestPreviewsUIService(io_data(), loop_.task_runner(), nullptr)));
81 base::RunLoop().RunUntilIdle(); 82 base::RunLoop().RunUntilIdle();
82 // After the outstanding posted tasks have run, SetIOData should have been 83 // After the outstanding posted tasks have run, SetIOData should have been
83 // called for |ui_service_|. 84 // called for |ui_service_|.
84 EXPECT_TRUE(ui_service()->io_data_set()); 85 EXPECT_TRUE(ui_service()->io_data_set());
85 } 86 }
86 87
87 } // namespace previews 88 } // namespace previews
OLDNEW
« no previous file with comments | « components/previews/core/previews_ui_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698