OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "sync/notifier/push_client_channel.h" | 5 #include "sync/notifier/push_client_channel.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 EXPECT_EQ(kServiceContext, service_context); | 66 EXPECT_EQ(kServiceContext, service_context); |
67 EXPECT_EQ(kSchedulingHash, scheduling_hash); | 67 EXPECT_EQ(kSchedulingHash, scheduling_hash); |
68 } | 68 } |
69 | 69 |
70 // Encode a message with no context into a notification and then | 70 // Encode a message with no context into a notification and then |
71 // decode it. The decoded message should match the original message, | 71 // decode it. The decoded message should match the original message, |
72 // but the context and hash should be untouched. | 72 // but the context and hash should be untouched. |
73 TEST_F(PushClientChannelTest, EncodeDecodeNoContext) { | 73 TEST_F(PushClientChannelTest, EncodeDecodeNoContext) { |
74 const notifier::Notification& notification = | 74 const notifier::Notification& notification = |
75 PushClientChannel::EncodeMessageForTest( | 75 PushClientChannel::EncodeMessageForTest( |
76 kMessage, "", kSchedulingHash); | 76 kMessage, std::string(), kSchedulingHash); |
77 std::string message; | 77 std::string message; |
78 std::string service_context = kServiceContext; | 78 std::string service_context = kServiceContext; |
79 int64 scheduling_hash = kSchedulingHash + 1; | 79 int64 scheduling_hash = kSchedulingHash + 1; |
80 EXPECT_TRUE(PushClientChannel::DecodeMessageForTest( | 80 EXPECT_TRUE(PushClientChannel::DecodeMessageForTest( |
81 notification, &message, &service_context, &scheduling_hash)); | 81 notification, &message, &service_context, &scheduling_hash)); |
82 EXPECT_EQ(kMessage, message); | 82 EXPECT_EQ(kMessage, message); |
83 EXPECT_EQ(kServiceContext, service_context); | 83 EXPECT_EQ(kServiceContext, service_context); |
84 EXPECT_EQ(kSchedulingHash + 1, scheduling_hash); | 84 EXPECT_EQ(kSchedulingHash + 1, scheduling_hash); |
85 } | 85 } |
86 | 86 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 fake_push_client_->sent_notifications()[1], | 244 fake_push_client_->sent_notifications()[1], |
245 &message, &service_context, &scheduling_hash)); | 245 &message, &service_context, &scheduling_hash)); |
246 EXPECT_EQ(kMessage, message); | 246 EXPECT_EQ(kMessage, message); |
247 EXPECT_EQ(kServiceContext, service_context); | 247 EXPECT_EQ(kServiceContext, service_context); |
248 EXPECT_EQ(kSchedulingHash, scheduling_hash); | 248 EXPECT_EQ(kSchedulingHash, scheduling_hash); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 } // namespace | 252 } // namespace |
253 } // namespace syncer | 253 } // namespace syncer |
OLD | NEW |