OLD | NEW |
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 "chrome/browser/notifications/extension_welcome_notification.h" | 5 #include "chrome/browser/notifications/extension_welcome_notification.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <string> | 9 #include <string> |
8 | 10 |
| 11 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
11 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
12 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
13 #include "base/test/test_simple_task_runner.h" | 16 #include "base/test/test_simple_task_runner.h" |
14 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
15 #include "chrome/browser/notifications/notification.h" | 18 #include "chrome/browser/notifications/notification.h" |
16 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 19 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
17 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
18 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 191 } |
189 void SetElapsedTime(base::TimeDelta elapsed_time) const { | 192 void SetElapsedTime(base::TimeDelta elapsed_time) const { |
190 delegate_->SetElapsedTime(elapsed_time); | 193 delegate_->SetElapsedTime(elapsed_time); |
191 } | 194 } |
192 bool GetBooleanPref(const char* path) const { | 195 bool GetBooleanPref(const char* path) const { |
193 return profile_->GetPrefs()->GetBoolean(path); | 196 return profile_->GetPrefs()->GetBoolean(path); |
194 } | 197 } |
195 void SetBooleanPref(const char* path, bool value) const { | 198 void SetBooleanPref(const char* path, bool value) const { |
196 profile_->GetPrefs()->SetBoolean(path, value); | 199 profile_->GetPrefs()->SetBoolean(path, value); |
197 } | 200 } |
198 int64 GetInt64Pref(const char* path) const { | 201 int64_t GetInt64Pref(const char* path) const { |
199 return profile_->GetPrefs()->GetInt64(path); | 202 return profile_->GetPrefs()->GetInt64(path); |
200 } | 203 } |
201 void SetInt64Pref(const char* path, int64 value) const { | 204 void SetInt64Pref(const char* path, int64_t value) const { |
202 profile_->GetPrefs()->SetInt64(path, value); | 205 profile_->GetPrefs()->SetInt64(path, value); |
203 } | 206 } |
204 | 207 |
205 private: | 208 private: |
206 class TestNotificationDelegate : public NotificationDelegate { | 209 class TestNotificationDelegate : public NotificationDelegate { |
207 public: | 210 public: |
208 explicit TestNotificationDelegate(const std::string& id) : id_(id) {} | 211 explicit TestNotificationDelegate(const std::string& id) : id_(id) {} |
209 | 212 |
210 // Overridden from NotificationDelegate: | 213 // Overridden from NotificationDelegate: |
211 std::string id() const override { return id_; } | 214 std::string id() const override { return id_; } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 | 528 |
526 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); | 529 EXPECT_TRUE(task_runner()->GetPendingTasks().empty()); |
527 EXPECT_EQ(message_center()->add_notification_calls(), 0); | 530 EXPECT_EQ(message_center()->add_notification_calls(), 0); |
528 EXPECT_EQ(message_center()->remove_notification_calls(), 0); | 531 EXPECT_EQ(message_center()->remove_notification_calls(), 0); |
529 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); | 532 EXPECT_EQ(message_center()->notifications_with_shown_as_popup(), 0); |
530 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); | 533 EXPECT_FALSE(GetBooleanPref(prefs::kWelcomeNotificationDismissed)); |
531 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); | 534 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationDismissedLocal)); |
532 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); | 535 EXPECT_TRUE(GetBooleanPref(prefs::kWelcomeNotificationPreviouslyPoppedUp)); |
533 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); | 536 EXPECT_EQ(GetInt64Pref(prefs::kWelcomeNotificationExpirationTimestamp), 1); |
534 } | 537 } |
OLD | NEW |