| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "mojo/public/cpp/application/application_impl.h" | |
| 8 #include "mojo/public/cpp/application/application_test_base.h" | 7 #include "mojo/public/cpp/application/application_test_base.h" |
| 9 #include "mojo/public/cpp/application/connect.h" | 8 #include "mojo/public/cpp/application/connect.h" |
| 10 #include "mojo/public/cpp/bindings/callback.h" | 9 #include "mojo/public/cpp/bindings/callback.h" |
| 11 #include "mojo/public/cpp/environment/logging.h" | 10 #include "mojo/public/cpp/environment/logging.h" |
| 12 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
| 13 #include "mojo/services/notifications/interfaces/notifications.mojom.h" | 12 #include "mojo/services/notifications/interfaces/notifications.mojom.h" |
| 14 | 13 |
| 15 namespace mojo { | 14 namespace mojo { |
| 16 namespace { | 15 namespace { |
| 17 | 16 |
| 18 // Tests the Notification mojo service on android. | 17 // Tests the Notification mojo service on android. |
| 19 class NotificationsApplicationTest : public test::ApplicationTestBase, | 18 class NotificationsApplicationTest : public test::ApplicationTestBase, |
| 20 public notifications::NotificationClient { | 19 public notifications::NotificationClient { |
| 21 public: | 20 public: |
| 22 NotificationsApplicationTest() : ApplicationTestBase(), binding_(this) {} | 21 NotificationsApplicationTest() : ApplicationTestBase(), binding_(this) {} |
| 23 ~NotificationsApplicationTest() override {} | 22 ~NotificationsApplicationTest() override {} |
| 24 | 23 |
| 25 // notifications::NotificationClient implementation. | 24 // notifications::NotificationClient implementation. |
| 26 void OnSelected() override {} | 25 void OnSelected() override {} |
| 27 | 26 |
| 28 void OnDismissed() override {} | 27 void OnDismissed() override {} |
| 29 | 28 |
| 30 protected: | 29 protected: |
| 31 // ApplicationTestBase: | 30 // ApplicationTestBase: |
| 32 void SetUp() override { | 31 void SetUp() override { |
| 33 ApplicationTestBase::SetUp(); | 32 ApplicationTestBase::SetUp(); |
| 34 ConnectToService(application_impl()->shell(), "mojo:notifications", | 33 ConnectToService(shell(), "mojo:notifications", |
| 35 GetProxy(¬ification_service_)); | 34 GetProxy(¬ification_service_)); |
| 36 } | 35 } |
| 37 | 36 |
| 38 notifications::NotificationServicePtr notification_service_; | 37 notifications::NotificationServicePtr notification_service_; |
| 39 mojo::Binding<notifications::NotificationClient> binding_; | 38 mojo::Binding<notifications::NotificationClient> binding_; |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 MOJO_DISALLOW_COPY_AND_ASSIGN(NotificationsApplicationTest); | 41 MOJO_DISALLOW_COPY_AND_ASSIGN(NotificationsApplicationTest); |
| 43 }; | 42 }; |
| 44 | 43 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 70 notification_client.Pass(), | 69 notification_client.Pass(), |
| 71 GetProxy(¬ification)); | 70 GetProxy(¬ification)); |
| 72 notifications::NotificationDataPtr updated_notification_data = | 71 notifications::NotificationDataPtr updated_notification_data = |
| 73 notifications::NotificationData::New(); | 72 notifications::NotificationData::New(); |
| 74 notification->Update(updated_notification_data.Pass()); | 73 notification->Update(updated_notification_data.Pass()); |
| 75 notification->Cancel(); | 74 notification->Cancel(); |
| 76 } | 75 } |
| 77 | 76 |
| 78 } // namespace | 77 } // namespace |
| 79 } // namespace mojo | 78 } // namespace mojo |
| OLD | NEW |