Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "modules/push_messaging/PushMessageData.h" | |
| 6 | |
| 7 #include "testing/gtest/include/gtest/gtest.h" | |
| 8 #include "third_party/WebKit/public/platform/WebString.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 namespace { | |
|
Mike West
2016/01/27 06:32:14
Why do you need the extra namespace?
harkness
2016/01/27 11:52:18
I was trying to take the approach of other tests,
| |
| 12 | |
| 13 const char kPushMessageData[] = "Push Message valid data string."; | |
| 14 | |
| 15 TEST(PushMessageDataTest, ValidPayload) | |
| 16 { | |
| 17 // Create a WebString with the test message, then create a | |
| 18 // PushMessageData from that. | |
| 19 WebString s(blink::WebString::fromUTF8(kPushMessageData)); | |
| 20 PushMessageData* data = PushMessageData::create(s); | |
| 21 | |
| 22 ASSERT_NE(data, nullptr); | |
| 23 EXPECT_TRUE(s.equals(data->text())); | |
|
Mike West
2016/01/27 06:32:14
Nit: Why not EXPECT_STREQ?
harkness
2016/01/27 11:52:18
Done.
| |
| 24 } | |
| 25 | |
| 26 TEST(PushMessageDataTest, ValidEmptyPayload) | |
| 27 { | |
| 28 // Create a WebString with a valid but empty test message, then create | |
| 29 // a PushMessageData from that. | |
| 30 WebString s(""); | |
| 31 PushMessageData* data = PushMessageData::create(s); | |
| 32 | |
| 33 ASSERT_NE(data, nullptr); | |
| 34 EXPECT_TRUE(s.equals(data->text())); | |
| 35 } | |
| 36 | |
| 37 TEST(PushMessageDataTest, NullPayload) | |
| 38 { | |
| 39 // Create a PushMessageData with a null payload. | |
| 40 WebString s; | |
| 41 PushMessageData* data = PushMessageData::create(s); | |
| 42 | |
| 43 EXPECT_EQ(data, nullptr); | |
| 44 } | |
| 45 } | |
| 46 } // namespace blink | |
|
Mike West
2016/01/27 06:32:14
Nit: If you keep the extra namespace, label the cl
harkness
2016/01/27 11:52:18
Done.
| |
| OLD | NEW |