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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "base/threading/platform_thread.h" | 6 #include "base/threading/platform_thread.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "chrome/browser/notifications/notification_test_util.h" | 8 #include "chrome/browser/notifications/notification_test_util.h" |
9 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 9 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 : public content::DesktopNotificationDelegate { | 21 : public content::DesktopNotificationDelegate { |
22 public: | 22 public: |
23 MockDesktopNotificationDelegate() | 23 MockDesktopNotificationDelegate() |
24 : displayed_(false), | 24 : displayed_(false), |
25 clicked_(false) {} | 25 clicked_(false) {} |
26 | 26 |
27 ~MockDesktopNotificationDelegate() override {} | 27 ~MockDesktopNotificationDelegate() override {} |
28 | 28 |
29 // content::DesktopNotificationDelegate implementation. | 29 // content::DesktopNotificationDelegate implementation. |
30 void NotificationDisplayed() override { displayed_ = true; } | 30 void NotificationDisplayed() override { displayed_ = true; } |
31 void NotificationClosed(bool by_user) override {} | 31 void NotificationClosed() override {} |
32 void NotificationClick() override { clicked_ = true; } | 32 void NotificationClick() override { clicked_ = true; } |
33 | 33 |
34 bool displayed() const { return displayed_; } | 34 bool displayed() const { return displayed_; } |
35 bool clicked() const { return clicked_; } | 35 bool clicked() const { return clicked_; } |
36 | 36 |
37 private: | 37 private: |
38 bool displayed_; | 38 bool displayed_; |
39 bool clicked_; | 39 bool clicked_; |
40 }; | 40 }; |
41 | 41 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 service()->DisplayPersistentNotification( | 245 service()->DisplayPersistentNotification( |
246 profile(), 42 /* sw_registration_id */, origin, SkBitmap(), | 246 profile(), 42 /* sw_registration_id */, origin, SkBitmap(), |
247 content::PlatformNotificationData()); | 247 content::PlatformNotificationData()); |
248 | 248 |
249 base::Time after_persistent_notification = | 249 base::Time after_persistent_notification = |
250 profile()->GetHostContentSettingsMap()->GetLastUsage( | 250 profile()->GetHostContentSettingsMap()->GetLastUsage( |
251 origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 251 origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
252 EXPECT_GT(after_persistent_notification, after_page_notification); | 252 EXPECT_GT(after_persistent_notification, after_page_notification); |
253 } | 253 } |
OLD | NEW |