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

Unified Diff: components/feedback/feedback_uploader_unittest.cc

Issue 225183018: Move feedback files into src/components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to latest 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 side-by-side diff with in-line comments
Download patch
Index: components/feedback/feedback_uploader_unittest.cc
diff --git a/chrome/browser/feedback/feedback_uploader_unittest.cc b/components/feedback/feedback_uploader_unittest.cc
similarity index 83%
rename from chrome/browser/feedback/feedback_uploader_unittest.cc
rename to components/feedback/feedback_uploader_unittest.cc
index b504be03f633f57af3af7c1c9a9a2b9272b6c04b..9c98759f54aa769b3cf44d907db5fd3773c8cc11 100644
--- a/chrome/browser/feedback/feedback_uploader_unittest.cc
+++ b/components/feedback/feedback_uploader_unittest.cc
@@ -2,17 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/feedback/feedback_uploader.h"
+#include "components/feedback/feedback_uploader.h"
#include <set>
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
+#include "base/prefs/testing_pref_service.h"
#include "base/run_loop.h"
-#include "chrome/browser/feedback/feedback_uploader_chrome.h"
-#include "chrome/browser/feedback/feedback_uploader_factory.h"
-#include "chrome/test/base/testing_profile.h"
+#include "base/stl_util.h"
+#include "components/feedback/feedback_uploader_chrome.h"
+#include "components/feedback/feedback_uploader_factory.h"
+#include "components/user_prefs/user_prefs.h"
+#include "content/public/test/test_browser_context.h"
#include "content/public/test/test_browser_thread.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -27,8 +31,7 @@ const base::TimeDelta kRetryDelayForTest =
base::TimeDelta::FromMilliseconds(100);
KeyedService* CreateFeedbackUploaderService(content::BrowserContext* context) {
- return new feedback::FeedbackUploaderChrome(
- Profile::FromBrowserContext(context));
+ return new feedback::FeedbackUploaderChrome(context);
}
} // namespace
@@ -39,13 +42,14 @@ class FeedbackUploaderTest : public testing::Test {
protected:
FeedbackUploaderTest()
: ui_thread_(content::BrowserThread::UI, &message_loop_),
- profile_(new TestingProfile()),
+ context_(new content::TestBrowserContext()),
dispatched_reports_count_(0),
expected_reports_(0) {
+ user_prefs::UserPrefs::Set(context_.get(), new TestingPrefServiceSimple());
FeedbackUploaderFactory::GetInstance()->SetTestingFactory(
- profile_.get(), &CreateFeedbackUploaderService);
+ context_.get(), &CreateFeedbackUploaderService);
- uploader_ = FeedbackUploaderFactory::GetForBrowserContext(profile_.get());
+ uploader_ = FeedbackUploaderFactory::GetForBrowserContext(context_.get());
uploader_->setup_for_test(
base::Bind(&FeedbackUploaderTest::MockDispatchReport,
base::Unretained(this)),
@@ -54,7 +58,7 @@ class FeedbackUploaderTest : public testing::Test {
virtual ~FeedbackUploaderTest() {
FeedbackUploaderFactory::GetInstance()->SetTestingFactory(
- profile_.get(), NULL);
+ context_.get(), NULL);
}
void QueueReport(const std::string& data) {
@@ -97,7 +101,7 @@ class FeedbackUploaderTest : public testing::Test {
base::MessageLoop message_loop_;
scoped_ptr<base::RunLoop> run_loop_;
content::TestBrowserThread ui_thread_;
- scoped_ptr<TestingProfile> profile_;
+ scoped_ptr<content::TestBrowserContext> context_;
FeedbackUploader* uploader_;

Powered by Google App Engine
This is Rietveld 408576698