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

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

Issue 2562733003: Remove duplicated user_prefs::TestingPrefServiceSyncable (Closed)
Patch Set: Fixed usage from .mm files Created 4 years 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/DEPS ('k') | components/invalidation/impl/BUILD.gn » ('j') | 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/stl_util.h" 16 #include "base/stl_util.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "components/feedback/feedback_uploader_chrome.h" 18 #include "components/feedback/feedback_uploader_chrome.h"
19 #include "components/feedback/feedback_uploader_factory.h" 19 #include "components/feedback/feedback_uploader_factory.h"
20 #include "components/pref_registry/testing_pref_service_syncable.h" 20 #include "components/sync_preferences/testing_pref_service_syncable.h"
21 #include "components/user_prefs/user_prefs.h" 21 #include "components/user_prefs/user_prefs.h"
22 #include "content/public/test/test_browser_context.h" 22 #include "content/public/test/test_browser_context.h"
23 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
24 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 26
27 namespace { 27 namespace {
28 28
29 const char kReportOne[] = "one"; 29 const char kReportOne[] = "one";
30 const char kReportTwo[] = "two"; 30 const char kReportTwo[] = "two";
31 const char kReportThree[] = "three"; 31 const char kReportThree[] = "three";
32 const char kReportFour[] = "four"; 32 const char kReportFour[] = "four";
33 const char kReportFive[] = "five"; 33 const char kReportFive[] = "five";
34 34
35 const base::TimeDelta kRetryDelayForTest = 35 const base::TimeDelta kRetryDelayForTest =
36 base::TimeDelta::FromMilliseconds(100); 36 base::TimeDelta::FromMilliseconds(100);
37 37
38 std::unique_ptr<KeyedService> CreateFeedbackUploaderService( 38 std::unique_ptr<KeyedService> CreateFeedbackUploaderService(
39 content::BrowserContext* context) { 39 content::BrowserContext* context) {
40 return base::MakeUnique<feedback::FeedbackUploaderChrome>(context); 40 return base::MakeUnique<feedback::FeedbackUploaderChrome>(context);
41 } 41 }
42 42
43 } // namespace 43 } // namespace
44 44
45 namespace feedback { 45 namespace feedback {
46 46
47 class FeedbackUploaderTest : public testing::Test { 47 class FeedbackUploaderTest : public testing::Test {
48 protected: 48 protected:
49 FeedbackUploaderTest() 49 FeedbackUploaderTest()
50 : ui_thread_(content::BrowserThread::UI, &message_loop_), 50 : ui_thread_(content::BrowserThread::UI, &message_loop_),
51 context_(new content::TestBrowserContext()), 51 context_(new content::TestBrowserContext()),
52 prefs_(new user_prefs::TestingPrefServiceSyncable()), 52 prefs_(new sync_preferences::TestingPrefServiceSyncable()),
53 dispatched_reports_count_(0), 53 dispatched_reports_count_(0),
54 expected_reports_(0) { 54 expected_reports_(0) {
55 user_prefs::UserPrefs::Set(context_.get(), prefs_.get()); 55 user_prefs::UserPrefs::Set(context_.get(), prefs_.get());
56 FeedbackUploaderFactory::GetInstance()->SetTestingFactory( 56 FeedbackUploaderFactory::GetInstance()->SetTestingFactory(
57 context_.get(), &CreateFeedbackUploaderService); 57 context_.get(), &CreateFeedbackUploaderService);
58 58
59 uploader_ = FeedbackUploaderFactory::GetForBrowserContext(context_.get()); 59 uploader_ = FeedbackUploaderFactory::GetForBrowserContext(context_.get());
60 uploader_->setup_for_test( 60 uploader_->setup_for_test(
61 base::Bind(&FeedbackUploaderTest::MockDispatchReport, 61 base::Bind(&FeedbackUploaderTest::MockDispatchReport,
62 base::Unretained(this)), 62 base::Unretained(this)),
63 kRetryDelayForTest); 63 kRetryDelayForTest);
64 } 64 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 EXPECT_EQ(dispatched_reports_.size(), 5u); 162 EXPECT_EQ(dispatched_reports_.size(), 5u);
163 EXPECT_EQ(dispatched_reports_[kReportOne], 1u); 163 EXPECT_EQ(dispatched_reports_[kReportOne], 1u);
164 EXPECT_EQ(dispatched_reports_[kReportTwo], 2u); 164 EXPECT_EQ(dispatched_reports_[kReportTwo], 2u);
165 EXPECT_EQ(dispatched_reports_[kReportThree], 2u); 165 EXPECT_EQ(dispatched_reports_[kReportThree], 2u);
166 EXPECT_EQ(dispatched_reports_[kReportFour], 1u); 166 EXPECT_EQ(dispatched_reports_[kReportFour], 1u);
167 EXPECT_EQ(dispatched_reports_[kReportFive], 1u); 167 EXPECT_EQ(dispatched_reports_[kReportFive], 1u);
168 } 168 }
169 169
170 } // namespace feedback 170 } // namespace feedback
OLDNEW
« no previous file with comments | « components/feedback/DEPS ('k') | components/invalidation/impl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698