| 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 "modules/notifications/NotificationData.h" | 5 #include "modules/notifications/NotificationData.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/modules/v8/UnionTypesModules.h" | 8 #include "bindings/modules/v8/UnionTypesModules.h" |
| 9 #include "core/testing/NullExecutionContext.h" | 9 #include "core/testing/NullExecutionContext.h" |
| 10 #include "modules/notifications/Notification.h" | 10 #include "modules/notifications/Notification.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const char kNotificationActionTitle[] = "My Action"; | 37 const char kNotificationActionTitle[] = "My Action"; |
| 38 const char kNotificationActionIcon[] = "https://example.com/action_icon.png"; | 38 const char kNotificationActionIcon[] = "https://example.com/action_icon.png"; |
| 39 | 39 |
| 40 const unsigned kNotificationVibrationUnnormalized[] = { 10, 1000000, 50, 42 }; | 40 const unsigned kNotificationVibrationUnnormalized[] = { 10, 1000000, 50, 42 }; |
| 41 const int kNotificationVibrationNormalized[] = { 10, 10000, 50 }; | 41 const int kNotificationVibrationNormalized[] = { 10, 10000, 50 }; |
| 42 | 42 |
| 43 class NotificationDataTest : public ::testing::Test { | 43 class NotificationDataTest : public ::testing::Test { |
| 44 public: | 44 public: |
| 45 void SetUp() override | 45 void SetUp() override |
| 46 { | 46 { |
| 47 m_executionContext = adoptRefWillBeNoop(new NullExecutionContext()); | 47 m_executionContext = new NullExecutionContext(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 ExecutionContext* getExecutionContext() { return m_executionContext.get(); } | 50 ExecutionContext* getExecutionContext() { return m_executionContext.get(); } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 RefPtrWillBePersistent<ExecutionContext> m_executionContext; | 53 Persistent<ExecutionContext> m_executionContext; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 TEST_F(NotificationDataTest, ReflectProperties) | 56 TEST_F(NotificationDataTest, ReflectProperties) |
| 57 { | 57 { |
| 58 Vector<unsigned> vibrationPattern; | 58 Vector<unsigned> vibrationPattern; |
| 59 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibration); ++i) | 59 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibration); ++i) |
| 60 vibrationPattern.append(kNotificationVibration[i]); | 60 vibrationPattern.append(kNotificationVibration[i]); |
| 61 | 61 |
| 62 UnsignedLongOrUnsignedLongSequence vibrationSequence; | 62 UnsignedLongOrUnsignedLongSequence vibrationSequence; |
| 63 vibrationSequence.setUnsignedLongSequence(vibrationPattern); | 63 vibrationSequence.setUnsignedLongSequence(vibrationPattern); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ASSERT_EQ(Notification::maxActions(), notificationData.actions.size()); | 257 ASSERT_EQ(Notification::maxActions(), notificationData.actions.size()); |
| 258 | 258 |
| 259 for (size_t i = 0; i < Notification::maxActions(); ++i) { | 259 for (size_t i = 0; i < Notification::maxActions(); ++i) { |
| 260 WebString expectedAction = String::number(i); | 260 WebString expectedAction = String::number(i); |
| 261 EXPECT_EQ(expectedAction, notificationData.actions[i].action); | 261 EXPECT_EQ(expectedAction, notificationData.actions[i].action); |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace | 265 } // namespace |
| 266 } // namespace blink | 266 } // namespace blink |
| OLD | NEW |