OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/glue/generic_change_processor.h" | 5 #include "chrome/browser/sync/glue/generic_change_processor.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 for (int i = 0; i < kRepeatCount; ++i) { | 105 for (int i = 0; i < kRepeatCount; ++i) { |
106 syncer::SyncDataList sync_data; | 106 syncer::SyncDataList sync_data; |
107 change_processor()->GetSyncDataForType(kType, &sync_data); | 107 change_processor()->GetSyncDataForType(kType, &sync_data); |
108 | 108 |
109 // Start with a simple test. We can add more in-depth testing later. | 109 // Start with a simple test. We can add more in-depth testing later. |
110 EXPECT_EQ(static_cast<size_t>(kNumChildNodes), sync_data.size()); | 110 EXPECT_EQ(static_cast<size_t>(kNumChildNodes), sync_data.size()); |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
| 114 // Similar to above, but focused on the method that implements sync/api |
| 115 // interfaces and is hence exposed to datatypes directly. |
| 116 TEST_F(SyncGenericChangeProcessorTest, StressGetAllSyncData) { |
| 117 const int kNumChildNodes = 1000; |
| 118 const int kRepeatCount = 1; |
| 119 |
| 120 ASSERT_NO_FATAL_FAILURE(BuildChildNodes(kNumChildNodes)); |
| 121 |
| 122 for (int i = 0; i < kRepeatCount; ++i) { |
| 123 syncer::SyncDataList sync_data = |
| 124 change_processor()->GetAllSyncData(kType); |
| 125 |
| 126 // Start with a simple test. We can add more in-depth testing later. |
| 127 EXPECT_EQ(static_cast<size_t>(kNumChildNodes), sync_data.size()); |
| 128 } |
| 129 } |
| 130 |
114 TEST_F(SyncGenericChangeProcessorTest, SetGetPasswords) { | 131 TEST_F(SyncGenericChangeProcessorTest, SetGetPasswords) { |
115 const int kNumPasswords = 10; | 132 const int kNumPasswords = 10; |
116 sync_pb::PasswordSpecificsData password_data; | 133 sync_pb::PasswordSpecificsData password_data; |
117 password_data.set_username_value("user"); | 134 password_data.set_username_value("user"); |
118 | 135 |
119 sync_pb::EntitySpecifics password_holder; | 136 sync_pb::EntitySpecifics password_holder; |
120 | 137 |
121 syncer::SyncChangeList change_list; | 138 syncer::SyncChangeList change_list; |
122 for (int i = 0; i < kNumPasswords; ++i) { | 139 for (int i = 0; i < kNumPasswords; ++i) { |
123 password_data.set_password_value( | 140 password_data.set_password_value( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ASSERT_TRUE(raw_specifics.has_password()); | 257 ASSERT_TRUE(raw_specifics.has_password()); |
241 ASSERT_TRUE(raw_specifics.password().has_encrypted()); | 258 ASSERT_TRUE(raw_specifics.password().has_encrypted()); |
242 ASSERT_FALSE(raw_specifics.password().has_client_only_encrypted_data()); | 259 ASSERT_FALSE(raw_specifics.password().has_client_only_encrypted_data()); |
243 } | 260 } |
244 } | 261 } |
245 | 262 |
246 } // namespace | 263 } // namespace |
247 | 264 |
248 } // namespace browser_sync | 265 } // namespace browser_sync |
249 | 266 |
OLD | NEW |