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

Unified Diff: components/feedback/feedback_data_unittest.cc

Issue 1165913002: [Cleanup] Used scoped pointers in KeyedServiceFactory's SetTestingFactory functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish renaming profile -> context Created 5 years, 6 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 | « chrome/test/base/testing_profile.cc ('k') | components/feedback/feedback_uploader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/feedback/feedback_data_unittest.cc
diff --git a/components/feedback/feedback_data_unittest.cc b/components/feedback/feedback_data_unittest.cc
index 141c17439ee46598513e831825816edabf6a01d2..e10bc2fa8f0d8f3e849123f5599b5b84f20b2c86 100644
--- a/components/feedback/feedback_data_unittest.cc
+++ b/components/feedback/feedback_data_unittest.cc
@@ -6,6 +6,7 @@
#include <set>
+#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/prefs/testing_pref_service.h"
#include "base/run_loop.h"
@@ -38,13 +39,11 @@ class MockUploader : public feedback::FeedbackUploader, public KeyedService {
MOCK_METHOD1(DispatchReport, void(const std::string&));
};
-MockUploader *g_uploader;
-
-KeyedService* CreateFeedbackUploaderService(content::BrowserContext* context) {
- if (!g_uploader)
- g_uploader = new MockUploader(context);
- EXPECT_CALL(*g_uploader, DispatchReport(testing::_)).Times(1);
- return g_uploader;
+scoped_ptr<KeyedService> CreateFeedbackUploaderService(
+ content::BrowserContext* context) {
+ scoped_ptr<MockUploader> uploader(new MockUploader(context));
+ EXPECT_CALL(*uploader, DispatchReport(testing::_)).Times(1);
+ return uploader.Pass();
}
scoped_ptr<std::string> MakeScoped(const char* str) {
@@ -108,8 +107,6 @@ TEST_F(FeedbackDataTest, ReportSending) {
Send();
RunMessageLoop();
EXPECT_TRUE(data_->IsDataComplete());
- delete g_uploader;
- g_uploader = NULL;
}
} // namespace feedback
« no previous file with comments | « chrome/test/base/testing_profile.cc ('k') | components/feedback/feedback_uploader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698