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

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

Issue 10878015: [Sync] Move keystore key handling to SyncEncryptionHandlerImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/js_sync_encryption_handler_observer.h" 5 #include "sync/internal_api/js_sync_encryption_handler_observer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 js_sync_encryption_handler_observer_.OnPassphraseRequired( 86 js_sync_encryption_handler_observer_.OnPassphraseRequired(
87 REASON_PASSPHRASE_NOT_REQUIRED, 87 REASON_PASSPHRASE_NOT_REQUIRED,
88 sync_pb::EncryptedData()); 88 sync_pb::EncryptedData());
89 js_sync_encryption_handler_observer_.OnPassphraseRequired(REASON_ENCRYPTION, 89 js_sync_encryption_handler_observer_.OnPassphraseRequired(REASON_ENCRYPTION,
90 sync_pb::EncryptedData()); 90 sync_pb::EncryptedData());
91 js_sync_encryption_handler_observer_.OnPassphraseRequired(REASON_DECRYPTION, 91 js_sync_encryption_handler_observer_.OnPassphraseRequired(REASON_DECRYPTION,
92 sync_pb::EncryptedData()); 92 sync_pb::EncryptedData());
93 PumpLoop(); 93 PumpLoop();
94 } 94 }
95 95
96 TEST_F(JsSyncEncryptionHandlerObserverTest, SensitiveNotifiations) { 96 TEST_F(JsSyncEncryptionHandlerObserverTest, OnBootstrapTokenUpdated) {
97 DictionaryValue redacted_token_details; 97 DictionaryValue bootstrap_token_details;
98 redacted_token_details.SetString("token", "<redacted>"); 98 bootstrap_token_details.SetString("bootstrapTokenUpdated",
99 DictionaryValue redacted_bootstrap_token_details; 99 "PASSPHRASE_BOOTSTRAP_TOKEN");
100 redacted_bootstrap_token_details.SetString("bootstrapToken", "<redacted>");
101 100
102 EXPECT_CALL(mock_js_event_handler_, 101 EXPECT_CALL(mock_js_event_handler_,
103 HandleJsEvent( 102 HandleJsEvent(
104 "OnBootstrapTokenUpdated", 103 "OnBootstrapTokenUpdated",
105 HasDetailsAsDictionary(redacted_bootstrap_token_details))); 104 HasDetailsAsDictionary(bootstrap_token_details)));
106 105
107 js_sync_encryption_handler_observer_.OnBootstrapTokenUpdated( 106 js_sync_encryption_handler_observer_.OnBootstrapTokenUpdated(
108 "sensitive_token"); 107 "sensitive_token", PASSPHRASE_BOOTSTRAP_TOKEN);
109 PumpLoop(); 108 PumpLoop();
110 } 109 }
111 110
112 TEST_F(JsSyncEncryptionHandlerObserverTest, OnEncryptedTypesChanged) { 111 TEST_F(JsSyncEncryptionHandlerObserverTest, OnEncryptedTypesChanged) {
113 DictionaryValue expected_details; 112 DictionaryValue expected_details;
114 ListValue* encrypted_type_values = new ListValue(); 113 ListValue* encrypted_type_values = new ListValue();
115 const bool encrypt_everything = false; 114 const bool encrypt_everything = false;
116 expected_details.Set("encryptedTypes", encrypted_type_values); 115 expected_details.Set("encryptedTypes", encrypted_type_values);
117 expected_details.SetBoolean("encryptEverything", encrypt_everything); 116 expected_details.SetBoolean("encryptEverything", encrypt_everything);
118 ModelTypeSet encrypted_types; 117 ModelTypeSet encrypted_types;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 HandleJsEvent("onPassphraseStateChanged", 162 HandleJsEvent("onPassphraseStateChanged",
164 HasDetailsAsDictionary(passphrase_state_details))); 163 HasDetailsAsDictionary(passphrase_state_details)));
165 164
166 js_sync_encryption_handler_observer_.OnPassphraseStateChanged( 165 js_sync_encryption_handler_observer_.OnPassphraseStateChanged(
167 IMPLICIT_PASSPHRASE); 166 IMPLICIT_PASSPHRASE);
168 PumpLoop(); 167 PumpLoop();
169 } 168 }
170 169
171 } // namespace 170 } // namespace
172 } // namespace syncer 171 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698