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

Side by Side Diff: chrome/browser/component_updater/cros_component_installer_unittest.cc

Issue 2707063002: Universial component install for chrome os. (Closed)
Patch Set: switch from json to std::map for static configuration 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
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/run_loop.h"
7 #include "base/test/test_simple_task_runner.h"
8 #include "base/threading/thread_task_runner_handle.h"
9 #include "chrome/test/base/testing_browser_process.h"
10 #include "components/component_updater/mock_component_updater_service.h"
11 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "testing/platform_test.h"
14
15 namespace component_updater {
16
17 class CrOSMockComponentUpdateService
18 : public component_updater::MockComponentUpdateService {
19 public:
20 CrOSMockComponentUpdateService() {}
21 ~CrOSMockComponentUpdateService() override {}
22
23 scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() override {
24 return base::ThreadTaskRunnerHandle::Get();
25 }
26
27 private:
28 content::TestBrowserThreadBundle thread_bundle_;
29 DISALLOW_COPY_AND_ASSIGN(CrOSMockComponentUpdateService);
30 };
31
32 class CrOSComponentInstallerTest : public PlatformTest {
33 public:
34 CrOSComponentInstallerTest() {}
35
36 void SetUp() override { PlatformTest::SetUp(); }
37
38 private:
39 DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTest);
40 };
41
42 #if defined(OS_CHROMEOS)
43 TEST_F(CrOSComponentInstallerTest, RegisterESCPR) {
44 std::unique_ptr<CrOSMockComponentUpdateService> cus(
45 new CrOSMockComponentUpdateService());
46 EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(1);
47 component_updater::RegisterCrOSComponent(cus.get(), "escpr");
48 base::RunLoop().RunUntilIdle();
49 }
50 TEST_F(CrOSComponentInstallerTest, RegisterFakeComponent) {
51 std::unique_ptr<CrOSMockComponentUpdateService> cus(
52 new CrOSMockComponentUpdateService());
53 EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(0);
54 RegisterCrOSComponent(cus.get(), "arandomname");
55 base::RunLoop().RunUntilIdle();
56 }
57 #endif // defined(OS_CHROMEOS)
58 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698