Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: sync/internal_api/sync_encryption_handler_impl_unittest.cc

Issue 11958029: [Sync] Add support for proxy types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Switch to ProxyTypes Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/internal_api/sync_encryption_handler_impl.h" 5 #include "sync/internal_api/sync_encryption_handler_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 364 }
365 EXPECT_TRUE(encrypted_types.Equals( 365 EXPECT_TRUE(encrypted_types.Equals(
366 encryption_handler()->GetEncryptedTypesUnsafe())); 366 encryption_handler()->GetEncryptedTypesUnsafe()));
367 EXPECT_TRUE(encrypted_types.Equals( 367 EXPECT_TRUE(encrypted_types.Equals(
368 handler2.GetEncryptedTypesUnsafe())); 368 handler2.GetEncryptedTypesUnsafe()));
369 369
370 Mock::VerifyAndClearExpectations(observer()); 370 Mock::VerifyAndClearExpectations(observer());
371 Mock::VerifyAndClearExpectations(&observer2); 371 Mock::VerifyAndClearExpectations(&observer2);
372 372
373 ModelTypeSet encrypted_user_types = EncryptableUserTypes(); 373 ModelTypeSet encrypted_user_types = EncryptableUserTypes();
374 // We never encrypt history delete directives.
375 encrypted_user_types.Remove(HISTORY_DELETE_DIRECTIVES);
376 374
377 EXPECT_CALL(*observer(), 375 EXPECT_CALL(*observer(),
378 OnEncryptedTypesChanged( 376 OnEncryptedTypesChanged(
379 HasModelTypes(encrypted_user_types), false)); 377 HasModelTypes(encrypted_user_types), false));
380 EXPECT_CALL(observer2, 378 EXPECT_CALL(observer2,
381 OnEncryptedTypesChanged( 379 OnEncryptedTypesChanged(
382 HasModelTypes(encrypted_user_types), false)); 380 HasModelTypes(encrypted_user_types), false));
383 381
384 // Set all encrypted types 382 // Set all encrypted types
385 encrypted_types = EncryptableUserTypes(); 383 encrypted_types = EncryptableUserTypes();
386 { 384 {
387 WriteTransaction trans(FROM_HERE, user_share()); 385 WriteTransaction trans(FROM_HERE, user_share());
388 encryption_handler()->MergeEncryptedTypes( 386 encryption_handler()->MergeEncryptedTypes(
389 encrypted_types, 387 encrypted_types,
390 trans.GetWrappedTrans()); 388 trans.GetWrappedTrans());
391 encryption_handler()->UpdateNigoriFromEncryptedTypes( 389 encryption_handler()->UpdateNigoriFromEncryptedTypes(
392 &nigori, 390 &nigori,
393 trans.GetWrappedTrans()); 391 trans.GetWrappedTrans());
394 handler2.UpdateEncryptedTypesFromNigori(nigori, trans.GetWrappedTrans()); 392 handler2.UpdateEncryptedTypesFromNigori(nigori, trans.GetWrappedTrans());
395 } 393 }
396 EXPECT_TRUE(encrypted_types.Equals( 394 EXPECT_TRUE(encrypted_types.Equals(
397 encryption_handler()->GetEncryptedTypesUnsafe())); 395 encryption_handler()->GetEncryptedTypesUnsafe()));
398 //EXPECT_TRUE(encrypted_types.Equals(handler2.GetEncryptedTypesUnsafe())); 396 EXPECT_TRUE(encrypted_types.Equals(handler2.GetEncryptedTypesUnsafe()));
399 397
400 // Receiving an empty nigori should not reset any encrypted types or trigger 398 // Receiving an empty nigori should not reset any encrypted types or trigger
401 // an observer notification. 399 // an observer notification.
402 Mock::VerifyAndClearExpectations(observer()); 400 Mock::VerifyAndClearExpectations(observer());
403 Mock::VerifyAndClearExpectations(&observer2); 401 Mock::VerifyAndClearExpectations(&observer2);
404 nigori = sync_pb::NigoriSpecifics(); 402 nigori = sync_pb::NigoriSpecifics();
405 { 403 {
406 WriteTransaction trans(FROM_HERE, user_share()); 404 WriteTransaction trans(FROM_HERE, user_share());
407 handler2.UpdateEncryptedTypesFromNigori(nigori, trans.GetWrappedTrans()); 405 handler2.UpdateEncryptedTypesFromNigori(nigori, trans.GetWrappedTrans());
408 } 406 }
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 encryption_handler()->SetKeystoreKeys(keys, 2240 encryption_handler()->SetKeystoreKeys(keys,
2243 trans.GetWrappedTrans()); 2241 trans.GetWrappedTrans());
2244 } 2242 }
2245 PumpLoop(); 2243 PumpLoop();
2246 Mock::VerifyAndClearExpectations(observer()); 2244 Mock::VerifyAndClearExpectations(observer());
2247 2245
2248 VerifyMigratedNigoriWithTimestamp(1, CUSTOM_PASSPHRASE, kCustomPass); 2246 VerifyMigratedNigoriWithTimestamp(1, CUSTOM_PASSPHRASE, kCustomPass);
2249 } 2247 }
2250 2248
2251 } // namespace syncer 2249 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/public/base/model_type.h ('k') | sync/internal_api/sync_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698