OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/syncer_proto_util.h" | 5 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "chrome/browser/sync/engine/syncproto.h" | 11 #include "chrome/browser/sync/engine/syncproto.h" |
12 #include "chrome/browser/sync/syncable/blob.h" | 12 #include "chrome/browser/sync/syncable/blob.h" |
13 #include "chrome/browser/sync/syncable/directory_manager.h" | 13 #include "chrome/browser/sync/syncable/directory_manager.h" |
14 #include "chrome/browser/sync/syncable/syncable.h" | 14 #include "chrome/browser/sync/syncable/syncable.h" |
15 #include "chrome/browser/sync/test/engine/mock_connection_manager.h" | 15 #include "chrome/browser/sync/test/engine/mock_connection_manager.h" |
16 #include "chrome/browser/sync/test/engine/test_directory_setter_upper.h" | 16 #include "chrome/browser/sync/test/engine/test_directory_setter_upper.h" |
17 | 17 |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using syncable::Blob; | 20 using syncable::Blob; |
21 using syncable::ScopedDirLookup; | 21 using syncable::ScopedDirLookup; |
22 using syncable::SyncName; | |
23 | 22 |
24 namespace browser_sync { | 23 namespace browser_sync { |
25 | 24 |
26 TEST(SyncerProtoUtil, TestBlobToProtocolBufferBytesUtilityFunctions) { | 25 TEST(SyncerProtoUtil, TestBlobToProtocolBufferBytesUtilityFunctions) { |
27 unsigned char test_data1[] = {1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 4, 2, 9}; | 26 unsigned char test_data1[] = {1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 4, 2, 9}; |
28 unsigned char test_data2[] = {1, 99, 3, 4, 5, 6, 7, 8, 0, 1, 4, 2, 9}; | 27 unsigned char test_data2[] = {1, 99, 3, 4, 5, 6, 7, 8, 0, 1, 4, 2, 9}; |
29 unsigned char test_data3[] = {99, 2, 3, 4, 5, 6, 7, 8}; | 28 unsigned char test_data3[] = {99, 2, 3, 4, 5, 6, 7, 8}; |
30 | 29 |
31 syncable::Blob test_blob1, test_blob2, test_blob3; | 30 syncable::Blob test_blob1, test_blob2, test_blob3; |
32 for (size_t i = 0; i < arraysize(test_data1); ++i) | 31 for (size_t i = 0; i < arraysize(test_data1); ++i) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 dcm.set_send_error(false); | 232 dcm.set_send_error(false); |
234 EXPECT_TRUE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, | 233 EXPECT_TRUE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, |
235 msg, &response)); | 234 msg, &response)); |
236 | 235 |
237 dcm.set_access_denied(true); | 236 dcm.set_access_denied(true); |
238 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, | 237 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, |
239 msg, &response)); | 238 msg, &response)); |
240 } | 239 } |
241 | 240 |
242 } // namespace browser_sync | 241 } // namespace browser_sync |
OLD | NEW |