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

Side by Side Diff: components/feedback/feedback_uploader_unittest.cc

Issue 273623003: Make valgrind happy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « components/feedback/OWNERS ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/feedback/feedback_uploader.h" 5 #include "components/feedback/feedback_uploader.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 25 matching lines...) Expand all
36 36
37 } // namespace 37 } // namespace
38 38
39 namespace feedback { 39 namespace feedback {
40 40
41 class FeedbackUploaderTest : public testing::Test { 41 class FeedbackUploaderTest : public testing::Test {
42 protected: 42 protected:
43 FeedbackUploaderTest() 43 FeedbackUploaderTest()
44 : ui_thread_(content::BrowserThread::UI, &message_loop_), 44 : ui_thread_(content::BrowserThread::UI, &message_loop_),
45 context_(new content::TestBrowserContext()), 45 context_(new content::TestBrowserContext()),
46 prefs_(new TestingPrefServiceSimple()),
46 dispatched_reports_count_(0), 47 dispatched_reports_count_(0),
47 expected_reports_(0) { 48 expected_reports_(0) {
48 user_prefs::UserPrefs::Set(context_.get(), new TestingPrefServiceSimple()); 49 user_prefs::UserPrefs::Set(context_.get(), prefs_.get());
49 FeedbackUploaderFactory::GetInstance()->SetTestingFactory( 50 FeedbackUploaderFactory::GetInstance()->SetTestingFactory(
50 context_.get(), &CreateFeedbackUploaderService); 51 context_.get(), &CreateFeedbackUploaderService);
51 52
52 uploader_ = FeedbackUploaderFactory::GetForBrowserContext(context_.get()); 53 uploader_ = FeedbackUploaderFactory::GetForBrowserContext(context_.get());
53 uploader_->setup_for_test( 54 uploader_->setup_for_test(
54 base::Bind(&FeedbackUploaderTest::MockDispatchReport, 55 base::Bind(&FeedbackUploaderTest::MockDispatchReport,
55 base::Unretained(this)), 56 base::Unretained(this)),
56 kRetryDelayForTest); 57 kRetryDelayForTest);
57 } 58 }
58 59
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (ProcessingComplete()) 96 if (ProcessingComplete())
96 return; 97 return;
97 run_loop_.reset(new base::RunLoop()); 98 run_loop_.reset(new base::RunLoop());
98 run_loop_->Run(); 99 run_loop_->Run();
99 } 100 }
100 101
101 base::MessageLoop message_loop_; 102 base::MessageLoop message_loop_;
102 scoped_ptr<base::RunLoop> run_loop_; 103 scoped_ptr<base::RunLoop> run_loop_;
103 content::TestBrowserThread ui_thread_; 104 content::TestBrowserThread ui_thread_;
104 scoped_ptr<content::TestBrowserContext> context_; 105 scoped_ptr<content::TestBrowserContext> context_;
106 scoped_ptr<PrefService> prefs_;
105 107
106 FeedbackUploader* uploader_; 108 FeedbackUploader* uploader_;
107 109
108 std::map<std::string, unsigned int> dispatched_reports_; 110 std::map<std::string, unsigned int> dispatched_reports_;
109 size_t dispatched_reports_count_; 111 size_t dispatched_reports_count_;
110 size_t expected_reports_; 112 size_t expected_reports_;
111 }; 113 };
112 114
113 #if defined(OS_LINUX) || defined(OS_MACOSX) 115 #if defined(OS_LINUX) || defined(OS_MACOSX)
114 #define MAYBE_QueueMultiple QueueMultiple 116 #define MAYBE_QueueMultiple QueueMultiple
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 155
154 EXPECT_EQ(dispatched_reports_.size(), 5u); 156 EXPECT_EQ(dispatched_reports_.size(), 5u);
155 EXPECT_EQ(dispatched_reports_[kReportOne], 1u); 157 EXPECT_EQ(dispatched_reports_[kReportOne], 1u);
156 EXPECT_EQ(dispatched_reports_[kReportTwo], 2u); 158 EXPECT_EQ(dispatched_reports_[kReportTwo], 2u);
157 EXPECT_EQ(dispatched_reports_[kReportThree], 2u); 159 EXPECT_EQ(dispatched_reports_[kReportThree], 2u);
158 EXPECT_EQ(dispatched_reports_[kReportFour], 1u); 160 EXPECT_EQ(dispatched_reports_[kReportFour], 1u);
159 EXPECT_EQ(dispatched_reports_[kReportFive], 1u); 161 EXPECT_EQ(dispatched_reports_[kReportFive], 1u);
160 } 162 }
161 163
162 } // namespace feedback 164 } // namespace feedback
OLDNEW
« no previous file with comments | « components/feedback/OWNERS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698