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

Unified Diff: chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc

Issue 11689004: Move PromoResourceService from Profile to BrowserProcessImpl/local_state(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android x 4 Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc
diff --git a/chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc b/chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc
index 89c7488f888d9722fbf53fcefce5b2005392232d..72b4854daa28e1692cdfe1695f39c0dab5eb09b4 100644
--- a/chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc
+++ b/chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc
@@ -19,7 +19,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_browser_process.h"
#include "chrome/test/base/testing_pref_service.h"
-#include "chrome/test/base/testing_profile.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -30,11 +29,10 @@ class PromoResourceServiceMobileNtpTest : public testing::Test {
public:
PromoResourceServiceMobileNtpTest()
: local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)),
- web_resource_service_(new PromoResourceService(&profile_)) {
+ web_resource_service_(new PromoResourceService(local_state_.Get())) {
}
protected:
- TestingProfile profile_;
ScopedTestingLocalState local_state_;
scoped_refptr<PromoResourceService> web_resource_service_;
MessageLoop loop_;
@@ -42,10 +40,9 @@ class PromoResourceServiceMobileNtpTest : public testing::Test {
class NotificationPromoMobileNtpTest {
public:
- explicit NotificationPromoMobileNtpTest(Profile* profile)
- : profile_(profile),
- prefs_(profile->GetPrefs()),
- mobile_promo_(profile),
+ explicit NotificationPromoMobileNtpTest(PrefServiceSimple* prefs)
+ : prefs_(prefs),
+ mobile_promo_(prefs),
received_notification_(false) {
}
@@ -102,7 +99,7 @@ class NotificationPromoMobileNtpTest {
// Create a new NotificationPromo from prefs and compare to current
// notification.
void TestInitFromPrefs() {
- NotificationPromoMobileNtp prefs_mobile_promo(profile_);
+ NotificationPromoMobileNtp prefs_mobile_promo(prefs_);
const bool rv = prefs_mobile_promo.InitFromPrefs();
EXPECT_TRUE(rv);
EXPECT_TRUE(prefs_mobile_promo.valid());
@@ -131,8 +128,7 @@ class NotificationPromoMobileNtpTest {
}
private:
- Profile* profile_;
- PrefService* prefs_;
+ PrefServiceSimple* prefs_;
NotificationPromoMobileNtp mobile_promo_;
bool received_notification_;
scoped_ptr<DictionaryValue> test_json_;
@@ -144,11 +140,7 @@ class NotificationPromoMobileNtpTest {
};
TEST_F(PromoResourceServiceMobileNtpTest, NotificationPromoMobileNtpTest) {
- // Check that prefs are set correctly.
- PrefService* prefs = profile_.GetPrefs();
- ASSERT_TRUE(prefs);
-
- NotificationPromoMobileNtpTest promo_test(&profile_);
+ NotificationPromoMobileNtpTest promo_test(local_state_.Get());
// Set up start and end dates and promo line in a Dictionary as if parsed
// from the service.
@@ -175,7 +167,6 @@ TEST_F(PromoResourceServiceMobileNtpTest, NotificationPromoMobileNtpTest) {
" \"payload\":"
" {"
" \"payload_format_version\":3,"
- " \"gplus_required\":false,"
" \"promo_message_long\":"
" \"MOBILE_PROMO_CHROME_LONG_TEXT\","
" \"promo_message_short\":"

Powered by Google App Engine
This is Rietveld 408576698