| OLD | NEW |
| 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/location.h" | 7 #include "base/location.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 base::DictionaryValue expected_details; | 112 base::DictionaryValue expected_details; |
| 113 base::ListValue* encrypted_type_values = new base::ListValue(); | 113 base::ListValue* encrypted_type_values = new base::ListValue(); |
| 114 const bool encrypt_everything = false; | 114 const bool encrypt_everything = false; |
| 115 expected_details.Set("encryptedTypes", encrypted_type_values); | 115 expected_details.Set("encryptedTypes", encrypted_type_values); |
| 116 expected_details.SetBoolean("encryptEverything", encrypt_everything); | 116 expected_details.SetBoolean("encryptEverything", encrypt_everything); |
| 117 ModelTypeSet encrypted_types; | 117 ModelTypeSet encrypted_types; |
| 118 | 118 |
| 119 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 119 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 120 ModelType type = ModelTypeFromInt(i); | 120 ModelType type = ModelTypeFromInt(i); |
| 121 encrypted_types.Put(type); | 121 encrypted_types.Put(type); |
| 122 encrypted_type_values->Append(new base::StringValue( | 122 encrypted_type_values->AppendString(ModelTypeToString(type)); |
| 123 ModelTypeToString(type))); | |
| 124 } | 123 } |
| 125 | 124 |
| 126 EXPECT_CALL(mock_js_event_handler_, | 125 EXPECT_CALL(mock_js_event_handler_, |
| 127 HandleJsEvent("onEncryptedTypesChanged", | 126 HandleJsEvent("onEncryptedTypesChanged", |
| 128 HasDetailsAsDictionary(expected_details))); | 127 HasDetailsAsDictionary(expected_details))); |
| 129 | 128 |
| 130 js_sync_encryption_handler_observer_.OnEncryptedTypesChanged( | 129 js_sync_encryption_handler_observer_.OnEncryptedTypesChanged( |
| 131 encrypted_types, encrypt_everything); | 130 encrypted_types, encrypt_everything); |
| 132 PumpLoop(); | 131 PumpLoop(); |
| 133 } | 132 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 163 HandleJsEvent("onPassphraseTypeChanged", | 162 HandleJsEvent("onPassphraseTypeChanged", |
| 164 HasDetailsAsDictionary(passphrase_type_details))); | 163 HasDetailsAsDictionary(passphrase_type_details))); |
| 165 | 164 |
| 166 js_sync_encryption_handler_observer_.OnPassphraseTypeChanged( | 165 js_sync_encryption_handler_observer_.OnPassphraseTypeChanged( |
| 167 IMPLICIT_PASSPHRASE, ProtoTimeToTime(10)); | 166 IMPLICIT_PASSPHRASE, ProtoTimeToTime(10)); |
| 168 PumpLoop(); | 167 PumpLoop(); |
| 169 } | 168 } |
| 170 | 169 |
| 171 } // namespace | 170 } // namespace |
| 172 } // namespace syncer | 171 } // namespace syncer |
| OLD | NEW |