| OLD | NEW |
| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class PromoResourceServiceMobileNtpTest : public testing::Test { | 26 class PromoResourceServiceMobileNtpTest : public testing::Test { |
| 27 public: | 27 public: |
| 28 // |promo_resource_service_| must be created after |local_state_|. | 28 // |promo_resource_service_| must be created after |local_state_|. |
| 29 PromoResourceServiceMobileNtpTest() | 29 PromoResourceServiceMobileNtpTest() |
| 30 : local_state_(TestingBrowserProcess::GetGlobal()), | 30 : local_state_(TestingBrowserProcess::GetGlobal()), |
| 31 promo_resource_service_(new PromoResourceService) {} | 31 promo_resource_service_(new PromoResourceService) {} |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 ScopedTestingLocalState local_state_; | 34 ScopedTestingLocalState local_state_; |
| 35 scoped_refptr<PromoResourceService> promo_resource_service_; | 35 scoped_refptr<PromoResourceService> promo_resource_service_; |
| 36 MessageLoop loop_; | 36 base::MessageLoop loop_; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 class NotificationPromoMobileNtpTest { | 39 class NotificationPromoMobileNtpTest { |
| 40 public: | 40 public: |
| 41 NotificationPromoMobileNtpTest() : received_notification_(false) {} | 41 NotificationPromoMobileNtpTest() : received_notification_(false) {} |
| 42 | 42 |
| 43 void Init(const std::string& json, | 43 void Init(const std::string& json, |
| 44 const std::string& promo_text, | 44 const std::string& promo_text, |
| 45 const std::string& promo_text_long, | 45 const std::string& promo_text_long, |
| 46 const std::string& promo_action_type, | 46 const std::string& promo_action_type, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 "It\'s simple. Go http://www.google.com/chrome/", | 173 "It\'s simple. Go http://www.google.com/chrome/", |
| 174 "ACTION_EMAIL", "This is the body.", "XXX value"); | 174 "ACTION_EMAIL", "This is the body.", "XXX value"); |
| 175 | 175 |
| 176 promo_test.InitPromoFromJson(true); | 176 promo_test.InitPromoFromJson(true); |
| 177 | 177 |
| 178 // Second time should not trigger a notification. | 178 // Second time should not trigger a notification. |
| 179 promo_test.InitPromoFromJson(false); | 179 promo_test.InitPromoFromJson(false); |
| 180 | 180 |
| 181 promo_test.TestInitFromPrefs(); | 181 promo_test.TestInitFromPrefs(); |
| 182 } | 182 } |
| OLD | NEW |