| 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/engine/traffic_recorder.h" | 5 #include "sync/engine/traffic_recorder.h" |
| 6 | 6 |
| 7 #include "sync/protocol/sync.pb.h" | 7 #include "sync/protocol/sync.pb.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace csync { | 10 namespace syncer { |
| 11 | 11 |
| 12 const unsigned int kMaxMessages = 10; | 12 const unsigned int kMaxMessages = 10; |
| 13 const unsigned int kMaxMessageSize = 5 * 1024; | 13 const unsigned int kMaxMessageSize = 5 * 1024; |
| 14 | 14 |
| 15 // Ensure the number of records don't exceed |kMaxMessages|. | 15 // Ensure the number of records don't exceed |kMaxMessages|. |
| 16 TEST(TrafficRecorderTest, MaxRecordsTest) { | 16 TEST(TrafficRecorderTest, MaxRecordsTest) { |
| 17 TrafficRecorder recorder(kMaxMessages, kMaxMessageSize); | 17 TrafficRecorder recorder(kMaxMessages, kMaxMessageSize); |
| 18 sync_pb::ClientToServerResponse response; | 18 sync_pb::ClientToServerResponse response; |
| 19 | 19 |
| 20 for (unsigned int i = 0; i < 2*kMaxMessages; ++i) | 20 for (unsigned int i = 0; i < 2*kMaxMessages; ++i) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 error->set_error_description(error_description); | 32 error->set_error_description(error_description); |
| 33 | 33 |
| 34 TrafficRecorder recorder(kMaxMessages, kMaxMessageSize); | 34 TrafficRecorder recorder(kMaxMessages, kMaxMessageSize); |
| 35 recorder.RecordClientToServerResponse(response); | 35 recorder.RecordClientToServerResponse(response); |
| 36 | 36 |
| 37 TrafficRecorder::TrafficRecord record = recorder.records().front(); | 37 TrafficRecorder::TrafficRecord record = recorder.records().front(); |
| 38 EXPECT_TRUE(record.truncated); | 38 EXPECT_TRUE(record.truncated); |
| 39 EXPECT_TRUE(record.message.empty()); | 39 EXPECT_TRUE(record.message.empty()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } //namespace csync | 42 } // namespace syncer |
| 43 | |
| OLD | NEW |