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

Unified Diff: chrome/browser/component_updater/cros_component_installer_unittest.cc

Issue 2707063002: Universial component install for chrome os. (Closed)
Patch Set: build unit_test only on chromeos Created 3 years, 10 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 | « chrome/browser/component_updater/cros_component_installer.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/component_updater/cros_component_installer_unittest.cc
diff --git a/chrome/browser/component_updater/cros_component_installer_unittest.cc b/chrome/browser/component_updater/cros_component_installer_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a9373adc60669e81f8c4f9c523b9210a03d9aec9
--- /dev/null
+++ b/chrome/browser/component_updater/cros_component_installer_unittest.cc
@@ -0,0 +1,61 @@
+// Copyright 2017 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 "chrome/browser/component_updater/cros_component_installer.h"
+#include "base/memory/ptr_util.h"
+#include "base/run_loop.h"
+#include "base/test/test_simple_task_runner.h"
+#include "base/threading/thread_task_runner_handle.h"
+#include "build/build_config.h"
+#include "chrome/test/base/testing_browser_process.h"
+#include "components/component_updater/mock_component_updater_service.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/platform_test.h"
+
+namespace component_updater {
+
+class CrOSMockComponentUpdateService
+ : public component_updater::MockComponentUpdateService {
+ public:
+ CrOSMockComponentUpdateService() {}
+ ~CrOSMockComponentUpdateService() override {}
+
+ scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() override {
+ return base::ThreadTaskRunnerHandle::Get();
+ }
+
+ private:
+ content::TestBrowserThreadBundle thread_bundle_;
+ DISALLOW_COPY_AND_ASSIGN(CrOSMockComponentUpdateService);
+};
+
+class CrOSComponentInstallerTest : public PlatformTest {
+ public:
+ CrOSComponentInstallerTest() {}
+
+ void SetUp() override { PlatformTest::SetUp(); }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTest);
+};
+
+#if defined(OS_CHROMEOS)
+TEST_F(CrOSComponentInstallerTest, RegisterESCPR) {
+ std::unique_ptr<CrOSMockComponentUpdateService> cus =
+ base::MakeUnique<CrOSMockComponentUpdateService>();
+ EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(1);
+ component_updater::RegisterCrOSComponent(cus.get(), "escpr");
+ base::RunLoop().RunUntilIdle();
+}
+TEST_F(CrOSComponentInstallerTest, RegisterFakeComponent) {
+ std::unique_ptr<CrOSMockComponentUpdateService> cus =
+ base::MakeUnique<CrOSMockComponentUpdateService>();
+ EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(0);
+ RegisterCrOSComponent(cus.get(), "arandomname");
+ base::RunLoop().RunUntilIdle();
+}
+#endif // defined(OS_CHROMEOS)
+
+} // namespace component_updater
« no previous file with comments | « chrome/browser/component_updater/cros_component_installer.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698