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

Side by Side Diff: components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc

Issue 2798963003: Use ScopedTaskEnvironment instead of MessageLoop in components unit tests. (Closed)
Patch Set: Created 3 years, 8 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
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 "components/sync/engine_impl/sync_encryption_handler_impl.h" 5 #include "components/sync/engine_impl/sync_encryption_handler_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/base64.h" 11 #include "base/base64.h"
12 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/test/scoped_task_environment.h"
15 #include "base/tracked_objects.h" 16 #include "base/tracked_objects.h"
16 #include "components/sync/base/fake_encryptor.h" 17 #include "components/sync/base/fake_encryptor.h"
17 #include "components/sync/base/model_type_test_util.h" 18 #include "components/sync/base/model_type_test_util.h"
18 #include "components/sync/protocol/nigori_specifics.pb.h" 19 #include "components/sync/protocol/nigori_specifics.pb.h"
19 #include "components/sync/protocol/sync.pb.h" 20 #include "components/sync/protocol/sync.pb.h"
20 #include "components/sync/syncable/entry.h" 21 #include "components/sync/syncable/entry.h"
21 #include "components/sync/syncable/mutable_entry.h" 22 #include "components/sync/syncable/mutable_entry.h"
22 #include "components/sync/syncable/read_node.h" 23 #include "components/sync/syncable/read_node.h"
23 #include "components/sync/syncable/read_transaction.h" 24 #include "components/sync/syncable/read_transaction.h"
24 #include "components/sync/syncable/syncable_write_transaction.h" 25 #include "components/sync/syncable/syncable_write_transaction.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 VerifyMigratedNigoriWithTimestamp(migration_time, passphrase_type, 351 VerifyMigratedNigoriWithTimestamp(migration_time, passphrase_type,
351 passphrase); 352 passphrase);
352 } 353 }
353 354
354 protected: 355 protected:
355 TestUserShare test_user_share_; 356 TestUserShare test_user_share_;
356 FakeEncryptor encryptor_; 357 FakeEncryptor encryptor_;
357 std::unique_ptr<SyncEncryptionHandlerImpl> encryption_handler_; 358 std::unique_ptr<SyncEncryptionHandlerImpl> encryption_handler_;
358 StrictMock<SyncEncryptionHandlerObserverMock> observer_; 359 StrictMock<SyncEncryptionHandlerObserverMock> observer_;
359 TestIdFactory ids_; 360 TestIdFactory ids_;
360 base::MessageLoop message_loop_; 361 base::test::ScopedTaskEnvironment scoped_task_environment_;
361 }; 362 };
362 363
363 // Verify that the encrypted types are being written to and read from the 364 // Verify that the encrypted types are being written to and read from the
364 // nigori node properly. 365 // nigori node properly.
365 TEST_F(SyncEncryptionHandlerImplTest, NigoriEncryptionTypes) { 366 TEST_F(SyncEncryptionHandlerImplTest, NigoriEncryptionTypes) {
366 sync_pb::NigoriSpecifics nigori; 367 sync_pb::NigoriSpecifics nigori;
367 368
368 StrictMock<SyncEncryptionHandlerObserverMock> observer2; 369 StrictMock<SyncEncryptionHandlerObserverMock> observer2;
369 SyncEncryptionHandlerImpl handler2(user_share(), &encryptor_, std::string(), 370 SyncEncryptionHandlerImpl handler2(user_share(), &encryptor_, std::string(),
370 std::string() /* bootstrap tokens */); 371 std::string() /* bootstrap tokens */);
(...skipping 1926 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 EXPECT_CALL(*observer(), 2298 EXPECT_CALL(*observer(),
2298 OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); 2299 OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN));
2299 { 2300 {
2300 ReadTransaction trans(FROM_HERE, user_share()); 2301 ReadTransaction trans(FROM_HERE, user_share());
2301 encryption_handler()->SetKeystoreKeys( 2302 encryption_handler()->SetKeystoreKeys(
2302 BuildEncryptionKeyProto(kRawKeystoreKey), trans.GetWrappedTrans()); 2303 BuildEncryptionKeyProto(kRawKeystoreKey), trans.GetWrappedTrans());
2303 } 2304 }
2304 } 2305 }
2305 2306
2306 } // namespace syncer 2307 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698