| 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 21 matching lines...) Expand all Loading... |
| 32 const char kNotificationActionAction[] = "my_action"; | 32 const char kNotificationActionAction[] = "my_action"; |
| 33 const char kNotificationActionTitle[] = "My Action"; | 33 const char kNotificationActionTitle[] = "My Action"; |
| 34 | 34 |
| 35 const unsigned kNotificationVibrationUnnormalized[] = { 10, 1000000, 50, 42 }; | 35 const unsigned kNotificationVibrationUnnormalized[] = { 10, 1000000, 50, 42 }; |
| 36 const int kNotificationVibrationNormalized[] = { 10, 10000, 50 }; | 36 const int kNotificationVibrationNormalized[] = { 10, 10000, 50 }; |
| 37 | 37 |
| 38 class NotificationDataTest : public ::testing::Test { | 38 class NotificationDataTest : public ::testing::Test { |
| 39 public: | 39 public: |
| 40 void SetUp() override | 40 void SetUp() override |
| 41 { | 41 { |
| 42 m_executionContext = adoptRefWillBeNoop(new NullExecutionContext()); | 42 m_executionContext = (new NullExecutionContext()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 ExecutionContext* executionContext() { return m_executionContext.get(); } | 45 ExecutionContext* executionContext() { return m_executionContext.get(); } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 RefPtrWillBePersistent<ExecutionContext> m_executionContext; | 48 Persistent<ExecutionContext> m_executionContext; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 TEST_F(NotificationDataTest, ReflectProperties) | 51 TEST_F(NotificationDataTest, ReflectProperties) |
| 52 { | 52 { |
| 53 Vector<unsigned> vibrationPattern; | 53 Vector<unsigned> vibrationPattern; |
| 54 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibration); ++i) | 54 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNotificationVibration); ++i) |
| 55 vibrationPattern.append(kNotificationVibration[i]); | 55 vibrationPattern.append(kNotificationVibration[i]); |
| 56 | 56 |
| 57 UnsignedLongOrUnsignedLongSequence vibrationSequence; | 57 UnsignedLongOrUnsignedLongSequence vibrationSequence; |
| 58 vibrationSequence.setUnsignedLongSequence(vibrationPattern); | 58 vibrationSequence.setUnsignedLongSequence(vibrationPattern); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 ASSERT_EQ(Notification::maxActions(), notificationData.actions.size()); | 217 ASSERT_EQ(Notification::maxActions(), notificationData.actions.size()); |
| 218 | 218 |
| 219 for (size_t i = 0; i < Notification::maxActions(); ++i) { | 219 for (size_t i = 0; i < Notification::maxActions(); ++i) { |
| 220 WebString expectedAction = String::number(i); | 220 WebString expectedAction = String::number(i); |
| 221 EXPECT_EQ(expectedAction, notificationData.actions[i].action); | 221 EXPECT_EQ(expectedAction, notificationData.actions[i].action); |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace | 225 } // namespace |
| 226 } // namespace blink | 226 } // namespace blink |
| OLD | NEW |