OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/component_updater/cros_component_installer.h" | 5 #include "chrome/browser/component_updater/cros_component_installer.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/test/test_simple_task_runner.h" | 9 #include "base/test/test_simple_task_runner.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 } | 80 } |
81 | 81 |
82 std::vector<std::string> GetMimeTypes() const override { | 82 std::vector<std::string> GetMimeTypes() const override { |
83 return std::vector<std::string>(); | 83 return std::vector<std::string>(); |
84 } | 84 } |
85 }; | 85 }; |
86 | 86 |
87 void install_callback(update_client::Error error) {} | 87 void install_callback(update_client::Error error) {} |
88 | 88 |
89 TEST_F(CrOSComponentInstallerTest, BPPPCompatibleCrOSComponent) { | 89 TEST_F(CrOSComponentInstallerTest, BPPPCompatibleCrOSComponent) { |
90 auto* bppp = new BrowserProcessPlatformPart(); | 90 std::unique_ptr<BrowserProcessPlatformPart> bppp( |
sky
2017/05/26 02:27:19
Can you instead declare BPPP on the stack?
xiaochu
2017/05/26 02:47:47
Done.
| |
91 new BrowserProcessPlatformPart()); | |
91 ASSERT_EQ(bppp->IsCompatibleCrOSComponent("a"), false); | 92 ASSERT_EQ(bppp->IsCompatibleCrOSComponent("a"), false); |
92 bppp->AddCompatibleCrOSComponent("a"); | 93 bppp->AddCompatibleCrOSComponent("a"); |
93 ASSERT_EQ(bppp->IsCompatibleCrOSComponent("a"), true); | 94 ASSERT_EQ(bppp->IsCompatibleCrOSComponent("a"), true); |
94 } | 95 } |
95 | 96 |
96 TEST_F(CrOSComponentInstallerTest, RegisterComponentFail) { | 97 TEST_F(CrOSComponentInstallerTest, RegisterComponentFail) { |
97 std::unique_ptr<CrOSMockComponentUpdateService> cus = | 98 std::unique_ptr<CrOSMockComponentUpdateService> cus = |
98 base::MakeUnique<CrOSMockComponentUpdateService>(); | 99 base::MakeUnique<CrOSMockComponentUpdateService>(); |
99 EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(0); | 100 EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(0); |
100 component_updater::CrOSComponent::InstallCrOSComponent( | 101 component_updater::CrOSComponent::InstallCrOSComponent( |
101 "a-component-not-exist", base::Bind(install_callback)); | 102 "a-component-not-exist", base::Bind(install_callback)); |
102 base::RunLoop().RunUntilIdle(); | 103 base::RunLoop().RunUntilIdle(); |
103 } | 104 } |
104 | 105 |
105 } // namespace component_updater | 106 } // namespace component_updater |
OLD | NEW |