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

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

Issue 2902373003: Fix memory leak in unit test (Closed)
Patch Set: address comments from sky Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 BrowserProcessPlatformPart bppp;
91 ASSERT_EQ(bppp->IsCompatibleCrOSComponent("a"), false); 91 ASSERT_EQ(bppp.IsCompatibleCrOSComponent("a"), false);
92 bppp->AddCompatibleCrOSComponent("a"); 92 bppp.AddCompatibleCrOSComponent("a");
93 ASSERT_EQ(bppp->IsCompatibleCrOSComponent("a"), true); 93 ASSERT_EQ(bppp.IsCompatibleCrOSComponent("a"), true);
94 } 94 }
95 95
96 TEST_F(CrOSComponentInstallerTest, RegisterComponentFail) { 96 TEST_F(CrOSComponentInstallerTest, RegisterComponentFail) {
97 std::unique_ptr<CrOSMockComponentUpdateService> cus = 97 std::unique_ptr<CrOSMockComponentUpdateService> cus =
98 base::MakeUnique<CrOSMockComponentUpdateService>(); 98 base::MakeUnique<CrOSMockComponentUpdateService>();
99 EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(0); 99 EXPECT_CALL(*cus, RegisterComponent(testing::_)).Times(0);
100 component_updater::CrOSComponent::InstallCrOSComponent( 100 component_updater::CrOSComponent::InstallCrOSComponent(
101 "a-component-not-exist", base::Bind(install_callback)); 101 "a-component-not-exist", base::Bind(install_callback));
102 base::RunLoop().RunUntilIdle(); 102 base::RunLoop().RunUntilIdle();
103 } 103 }
104 104
105 } // namespace component_updater 105 } // namespace component_updater
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698