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

Side by Side Diff: chrome/browser/web_resource/promo_resource_service_unittest.cc

Issue 1291543004: Inject JSON parsing in WebResource as a callback rather than inheritance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webResources1
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 5 #include <utility>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 date_string); 53 date_string);
54 } 54 }
55 55
56 } // namespace 56 } // namespace
57 57
58 class PromoResourceServiceTest : public testing::Test { 58 class PromoResourceServiceTest : public testing::Test {
59 public: 59 public:
60 // |promo_resource_service_| must be created after |local_state_|. 60 // |promo_resource_service_| must be created after |local_state_|.
61 PromoResourceServiceTest() 61 PromoResourceServiceTest()
62 : local_state_(TestingBrowserProcess::GetGlobal()), 62 : local_state_(TestingBrowserProcess::GetGlobal()),
63 promo_resource_service_( 63 promo_resource_service_(new PromoResourceService(
64 new PromoResourceService(g_browser_process->local_state(), 64 g_browser_process->local_state(),
65 kChannel)) {} 65 kChannel,
66 "en",
67 nullptr,
68 nullptr,
69 web_resource::WebResourceService::ParseJSONCallback())) {}
66 70
67 protected: 71 protected:
68 ScopedTestingLocalState local_state_; 72 ScopedTestingLocalState local_state_;
69 scoped_ptr<PromoResourceService> promo_resource_service_; 73 scoped_ptr<PromoResourceService> promo_resource_service_;
70 base::MessageLoop loop_; 74 base::MessageLoop loop_;
71 }; 75 };
72 76
73 class NotificationPromoTest { 77 class NotificationPromoTest {
74 public: 78 public:
75 explicit NotificationPromoTest(PrefService* local_state) 79 explicit NotificationPromoTest(PrefService* local_state)
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 "What do you think of Chrome?", 581 "What do you think of Chrome?",
578 // The starting date is in 1999 to make tests pass 582 // The starting date is in 1999 to make tests pass
579 // on Android devices with incorrect or unset date/time. 583 // on Android devices with incorrect or unset date/time.
580 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT. 584 933672366, // unix epoch for 3 Aug 1999 9:26:06 GMT.
581 1000, 200, 100, 3600, 400, 30); 585 1000, 200, 100, 3600, 400, 30);
582 promo_test.InitPromoFromJson(true); 586 promo_test.InitPromoFromJson(true);
583 local_state_.Get()->SetBoolean(prefs::kAppLauncherHasBeenEnabled, true); 587 local_state_.Get()->SetBoolean(prefs::kAppLauncherHasBeenEnabled, true);
584 EXPECT_FALSE(promo_test.promo().CanShow()); 588 EXPECT_FALSE(promo_test.promo().CanShow());
585 } 589 }
586 #endif 590 #endif
OLDNEW
« no previous file with comments | « chrome/browser/web_resource/promo_resource_service_mobile_ntp_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698