| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gcm_driver/crypto/gcm_encryption_provider.h" | 5 #include "components/gcm_driver/crypto/gcm_encryption_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 "j88ybbehXM7fqi1OMFefDUEi0eJvsKfyVBWYkQjH-lSPJKxjAyslg"; | 51 "j88ybbehXM7fqi1OMFefDUEi0eJvsKfyVBWYkQjH-lSPJKxjAyslg"; |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 class GCMEncryptionProviderTest : public ::testing::Test { | 55 class GCMEncryptionProviderTest : public ::testing::Test { |
| 56 public: | 56 public: |
| 57 void SetUp() override { | 57 void SetUp() override { |
| 58 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); | 58 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); |
| 59 | 59 |
| 60 encryption_provider_.reset(new GCMEncryptionProvider); | 60 encryption_provider_.reset(new GCMEncryptionProvider); |
| 61 encryption_provider_->Init(scoped_temp_dir_.path(), | 61 encryption_provider_->Init(scoped_temp_dir_.GetPath(), |
| 62 message_loop_.task_runner()); | 62 message_loop_.task_runner()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void TearDown() override { | 65 void TearDown() override { |
| 66 encryption_provider_.reset(); | 66 encryption_provider_.reset(); |
| 67 | 67 |
| 68 // |encryption_provider_| owns a ProtoDatabaseImpl whose destructor deletes | 68 // |encryption_provider_| owns a ProtoDatabaseImpl whose destructor deletes |
| 69 // the underlying LevelDB database on the task runner. | 69 // the underlying LevelDB database on the task runner. |
| 70 base::RunLoop().RunUntilIdle(); | 70 base::RunLoop().RunUntilIdle(); |
| 71 } | 71 } |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 } | 537 } |
| 538 | 538 |
| 539 TEST_F(GCMEncryptionProviderTest, EncryptionRoundTripInstanceIDToken) { | 539 TEST_F(GCMEncryptionProviderTest, EncryptionRoundTripInstanceIDToken) { |
| 540 // GCMEncryptionProvider::DecryptMessage should succeed when the message was | 540 // GCMEncryptionProvider::DecryptMessage should succeed when the message was |
| 541 // sent to an InstanceID token (non-empty authorized_entity). | 541 // sent to an InstanceID token (non-empty authorized_entity). |
| 542 ASSERT_NO_FATAL_FAILURE( | 542 ASSERT_NO_FATAL_FAILURE( |
| 543 TestEncryptionRoundTrip(kExampleAppId, kExampleAuthorizedEntity)); | 543 TestEncryptionRoundTrip(kExampleAppId, kExampleAuthorizedEntity)); |
| 544 } | 544 } |
| 545 | 545 |
| 546 } // namespace gcm | 546 } // namespace gcm |
| OLD | NEW |