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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "sync/internal_api/public/base/model_type.h" | 11 #include "sync/internal_api/public/base/model_type.h" |
12 #include "sync/internal_api/public/util/sync_string_conversions.h" | 12 #include "sync/internal_api/public/util/sync_string_conversions.h" |
13 #include "sync/internal_api/public/util/weak_handle.h" | 13 #include "sync/internal_api/public/util/weak_handle.h" |
14 #include "sync/js/js_event_details.h" | 14 #include "sync/js/js_event_details.h" |
15 #include "sync/js/js_test_util.h" | 15 #include "sync/js/js_test_util.h" |
16 #include "sync/test/fake_encryptor.h" | 16 #include "sync/test/fake_encryptor.h" |
17 #include "sync/util/cryptographer.h" | 17 #include "sync/util/cryptographer.h" |
18 #include "sync/util/time.h" | 18 #include "sync/util/time.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 14 matching lines...) Expand all Loading... |
34 private: | 34 private: |
35 // This must be destroyed after the member variables below in order | 35 // This must be destroyed after the member variables below in order |
36 // for WeakHandles to be destroyed properly. | 36 // for WeakHandles to be destroyed properly. |
37 base::MessageLoop message_loop_; | 37 base::MessageLoop message_loop_; |
38 | 38 |
39 protected: | 39 protected: |
40 StrictMock<MockJsEventHandler> mock_js_event_handler_; | 40 StrictMock<MockJsEventHandler> mock_js_event_handler_; |
41 JsSyncEncryptionHandlerObserver js_sync_encryption_handler_observer_; | 41 JsSyncEncryptionHandlerObserver js_sync_encryption_handler_observer_; |
42 | 42 |
43 void PumpLoop() { | 43 void PumpLoop() { |
44 message_loop_.RunUntilIdle(); | 44 base::RunLoop().RunUntilIdle(); |
45 } | 45 } |
46 }; | 46 }; |
47 | 47 |
48 TEST_F(JsSyncEncryptionHandlerObserverTest, NoArgNotifiations) { | 48 TEST_F(JsSyncEncryptionHandlerObserverTest, NoArgNotifiations) { |
49 InSequence dummy; | 49 InSequence dummy; |
50 | 50 |
51 EXPECT_CALL(mock_js_event_handler_, | 51 EXPECT_CALL(mock_js_event_handler_, |
52 HandleJsEvent("onEncryptionComplete", | 52 HandleJsEvent("onEncryptionComplete", |
53 HasDetails(JsEventDetails()))); | 53 HasDetails(JsEventDetails()))); |
54 | 54 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 HandleJsEvent("onPassphraseTypeChanged", | 164 HandleJsEvent("onPassphraseTypeChanged", |
165 HasDetailsAsDictionary(passphrase_type_details))); | 165 HasDetailsAsDictionary(passphrase_type_details))); |
166 | 166 |
167 js_sync_encryption_handler_observer_.OnPassphraseTypeChanged( | 167 js_sync_encryption_handler_observer_.OnPassphraseTypeChanged( |
168 IMPLICIT_PASSPHRASE, ProtoTimeToTime(10)); | 168 IMPLICIT_PASSPHRASE, ProtoTimeToTime(10)); |
169 PumpLoop(); | 169 PumpLoop(); |
170 } | 170 } |
171 | 171 |
172 } // namespace | 172 } // namespace |
173 } // namespace syncer | 173 } // namespace syncer |
OLD | NEW |