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

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

Issue 2902373003: Fix memory leak in unit test (Closed)
Patch Set: move bppp to member variable. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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
index 951771b87b1c6d0210f2b33484dcfb6767c275e8..93d051e794913d985b894832549ffda70aab9648 100644
--- a/chrome/browser/component_updater/cros_component_installer_unittest.cc
+++ b/chrome/browser/component_updater/cros_component_installer_unittest.cc
@@ -33,10 +33,16 @@ class CrOSMockComponentUpdateService
class CrOSComponentInstallerTest : public PlatformTest {
public:
CrOSComponentInstallerTest() {}
- void SetUp() override { PlatformTest::SetUp(); }
+ void SetUp() override {
+ PlatformTest::SetUp();
+ bppp_ = std::make_shared<BrowserProcessPlatformPart>();
+ }
+ std::shared_ptr<BrowserProcessPlatformPart> GetBPPP() { return bppp_; }
private:
content::TestBrowserThreadBundle thread_bundle_;
+ std::shared_ptr<BrowserProcessPlatformPart> bppp_;
+
DISALLOW_COPY_AND_ASSIGN(CrOSComponentInstallerTest);
};
@@ -87,10 +93,9 @@ class FakeInstallerTraits : public ComponentInstallerTraits {
void install_callback(update_client::Error error) {}
TEST_F(CrOSComponentInstallerTest, BPPPCompatibleCrOSComponent) {
- auto* bppp = new BrowserProcessPlatformPart();
- ASSERT_EQ(bppp->IsCompatibleCrOSComponent("a"), false);
- bppp->AddCompatibleCrOSComponent("a");
- ASSERT_EQ(bppp->IsCompatibleCrOSComponent("a"), true);
+ ASSERT_EQ(GetBPPP()->IsCompatibleCrOSComponent("a"), false);
sky 2017/05/26 03:11:12 I'm suggesting you do this: BrowserProcessPlatf
xiaochu 2017/05/26 03:21:21 Done.
+ GetBPPP()->AddCompatibleCrOSComponent("a");
+ ASSERT_EQ(GetBPPP()->IsCompatibleCrOSComponent("a"), true);
}
TEST_F(CrOSComponentInstallerTest, RegisterComponentFail) {
« 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