1 // Copyright (c) 2012 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.
7 #include "base/strings/string_util.h"
8 #include "jingle/notifier/listener/notification_defines.h"
9 #include "testing/gtest/include/gtest/gtest.h"
14 class NotificationTest : public testing::Test {};
16 // Create a notification with binary data in the data field.
17 // Converting it to string shouldn't cause a crash.
18 TEST_F(NotificationTest, BinaryData) {
19 const char kNonUtf8Data[] = { '\xff', '\0' };
20 EXPECT_FALSE(IsStringUTF8(kNonUtf8Data));
21 Notification notification;
22 notification.data = kNonUtf8Data;
23 EXPECT_EQ("{ channel: \"\", data: \"\\u00FF\" }", notification.ToString());
27 } // namespace notifier