| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 display_service()->GetDisplayed(base::Bind( | 158 display_service()->GetDisplayed(base::Bind( |
| 159 &PlatformNotificationServiceTest::DidGetDisplayedNotifications, | 159 &PlatformNotificationServiceTest::DidGetDisplayedNotifications, |
| 160 base::Unretained(this))); | 160 base::Unretained(this))); |
| 161 base::RunLoop().RunUntilIdle(); | 161 base::RunLoop().RunUntilIdle(); |
| 162 | 162 |
| 163 EXPECT_TRUE(displayed_notifications_.get()); | 163 EXPECT_TRUE(displayed_notifications_.get()); |
| 164 return displayed_notifications_->size(); | 164 return displayed_notifications_->size(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 Notification GetDisplayedNotification() { | 167 Notification GetDisplayedNotification() { |
| 168 #if defined(OS_ANDROID) | 168 #if BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) |
| 169 return static_cast<StubNotificationPlatformBridge*>( | |
| 170 g_browser_process->notification_platform_bridge()) | |
| 171 ->GetNotificationAt(profile_->GetPath().BaseName().value(), 0); | |
| 172 #elif BUILDFLAG(ENABLE_NATIVE_NOTIFICATIONS) | |
| 173 if (base::FeatureList::IsEnabled(features::kNativeNotifications)) { | 169 if (base::FeatureList::IsEnabled(features::kNativeNotifications)) { |
| 174 return static_cast<StubNotificationPlatformBridge*>( | 170 return static_cast<StubNotificationPlatformBridge*>( |
| 175 g_browser_process->notification_platform_bridge()) | 171 g_browser_process->notification_platform_bridge()) |
| 176 ->GetNotificationAt(profile_->GetPath().BaseName().value(), 0); | 172 ->GetNotificationAt(profile_->GetPath().BaseName().value(), 0); |
| 177 } else { | 173 } else { |
| 178 return static_cast<StubNotificationUIManager*>( | 174 return static_cast<StubNotificationUIManager*>( |
| 179 g_browser_process->notification_ui_manager()) | 175 g_browser_process->notification_ui_manager()) |
| 180 ->GetNotificationAt(0); | 176 ->GetNotificationAt(0); |
| 181 } | 177 } |
| 182 #else | 178 #else |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 profile(), | 433 profile(), |
| 438 GURL() /* service_worker_scope */, | 434 GURL() /* service_worker_scope */, |
| 439 GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"), | 435 GURL("chrome-extension://honijodknafkokifofgiaalefdiedpko/main.html"), |
| 440 notification_data, NotificationResources(), | 436 notification_data, NotificationResources(), |
| 441 new MockNotificationDelegate("hello")); | 437 new MockNotificationDelegate("hello")); |
| 442 EXPECT_EQ("NotificationTest", | 438 EXPECT_EQ("NotificationTest", |
| 443 base::UTF16ToUTF8(notification.context_message())); | 439 base::UTF16ToUTF8(notification.context_message())); |
| 444 } | 440 } |
| 445 | 441 |
| 446 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 442 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
| OLD | NEW |