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

Side by Side 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, 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 | « chrome/browser/component_updater/cros_component_installer.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/component_updater/cros_component_installer.h"
6 #include "base/memory/ptr_util.h"
7 #include "base/run_loop.h"
8 #include "base/test/test_simple_task_runner.h"
9 #include "base/threading/thread_task_runner_handle.h"
10 #include "build/build_config.h"
11 #include "chrome/test/base/testing_browser_process.h"
12 #include "components/component_updater/mock_component_updater_service.h"
13 #include "content/public/test/test_browser_thread_bundle.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "testing/platform_test.h"
16
17 namespace component_updater {
18
19 class CrOSMockComponentUpdateService
20 : public component_updater::MockComponentUpdateService {
21 public:
22 CrOSMockComponentUpdateService() {}
23 ~CrOSMockComponentUpdateService() override {}
24
25 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() override {
26 return base::ThreadTaskRunnerHandle::Get();
27 }
28
29 private:
30 content::TestBrowserThreadBundle thread_bundle_;
31 DISALLOW_COPY_AND_ASSIGN(CrOSMockComponentUpdateService);
32 };
33
34 class CrOSComponentInstallerTest : public PlatformTest {
35 public:
36 CrOSComponentInstallerTest() {}
37
38 void SetUp() override { PlatformTest::SetUp(); }
39
40 private:
41 DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTest);
42 };
43
44 #if defined(OS_CHROMEOS)
45 TEST_F(CrOSComponentInstallerTest, RegisterESCPR) {
46 std::unique_ptr<CrOSMockComponentUpdateService> cus =
47 base::MakeUnique<CrOSMockComponentUpdateService>();
48 EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(1);
49 component_updater::RegisterCrOSComponent(cus.get(), "escpr");
50 base::RunLoop().RunUntilIdle();
51 }
52 TEST_F(CrOSComponentInstallerTest, RegisterFakeComponent) {
53 std::unique_ptr<CrOSMockComponentUpdateService> cus =
54 base::MakeUnique<CrOSMockComponentUpdateService>();
55 EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(0);
56 RegisterCrOSComponent(cus.get(), "arandomname");
57 base::RunLoop().RunUntilIdle();
58 }
59 #endif // defined(OS_CHROMEOS)
60
61 } // namespace component_updater
OLDNEW
« 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