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

Unified Diff: components/previews/previews_io_data_unittest.cc

Issue 2333003002: Changed previews component to be a layered component. (Closed)
Patch Set: Rebased on master Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/previews/previews_io_data.cc ('k') | components/previews/previews_ui_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/previews/previews_io_data_unittest.cc
diff --git a/components/previews/previews_io_data_unittest.cc b/components/previews/previews_io_data_unittest.cc
deleted file mode 100644
index 9f88172091ceb6e72fb9b6da99739d62ade6e220..0000000000000000000000000000000000000000
--- a/components/previews/previews_io_data_unittest.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/previews/previews_io_data.h"
-
-#include <memory>
-
-#include "base/memory/ptr_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "base/single_thread_task_runner.h"
-#include "components/previews/previews_ui_service.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace previews {
-
-namespace {
-
-class TestPreviewsIOData : public PreviewsIOData {
- public:
- TestPreviewsIOData(
- const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
- const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner)
- : PreviewsIOData(io_task_runner, ui_task_runner), initialized_(false) {}
- ~TestPreviewsIOData() override {}
-
- // Whether Initialize was called.
- bool initialized() { return initialized_; }
-
- private:
- // Set |initialized_| to true and use base class functionality.
- void InitializeOnIOThread() override {
- initialized_ = true;
- PreviewsIOData::InitializeOnIOThread();
- }
-
- // Whether Initialize was called.
- bool initialized_;
-};
-
-class PreviewsIODataTest : public testing::Test {
- public:
- PreviewsIODataTest() {}
-
- ~PreviewsIODataTest() override {}
-
- void set_io_data(std::unique_ptr<TestPreviewsIOData> io_data) {
- io_data_ = std::move(io_data);
- }
-
- TestPreviewsIOData* io_data() { return io_data_.get(); }
-
- void set_ui_service(std::unique_ptr<PreviewsUIService> ui_service) {
- ui_service_ = std::move(ui_service);
- }
-
- protected:
- // Run this test on a single thread.
- base::MessageLoopForIO loop_;
-
- private:
- std::unique_ptr<TestPreviewsIOData> io_data_;
- std::unique_ptr<PreviewsUIService> ui_service_;
-};
-
-} // namespace
-
-TEST_F(PreviewsIODataTest, TestInitialization) {
- set_io_data(base::WrapUnique(
- new TestPreviewsIOData(loop_.task_runner(), loop_.task_runner())));
- set_ui_service(
- base::WrapUnique(new PreviewsUIService(io_data(), loop_.task_runner())));
- base::RunLoop().RunUntilIdle();
- // After the outstanding posted tasks have run, |io_data_| should be fully
- // initialized.
- EXPECT_TRUE(io_data()->initialized());
-}
-
-} // namespace previews
« no previous file with comments | « components/previews/previews_io_data.cc ('k') | components/previews/previews_ui_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698