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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
8 | 8 |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/message_loop_proxy.h" | 19 #include "base/message_loop_proxy.h" |
20 #include "base/scoped_temp_dir.h" | 20 #include "base/scoped_temp_dir.h" |
21 #include "base/string_number_conversions.h" | 21 #include "base/string_number_conversions.h" |
22 #include "base/stringprintf.h" | 22 #include "base/stringprintf.h" |
23 #include "base/test/values_test_util.h" | 23 #include "base/test/values_test_util.h" |
24 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
25 #include "base/values.h" | 25 #include "base/values.h" |
26 #include "chrome/browser/sync/engine/model_safe_worker.h" | 26 #include "chrome/browser/sync/internal_api/syncapi_internal.h" |
27 #include "chrome/browser/sync/engine/nigori_util.h" | |
28 #include "chrome/browser/sync/engine/polling_constants.h" | |
29 #include "chrome/browser/sync/engine/syncapi_internal.h" | |
30 #include "chrome/browser/sync/internal_api/change_record.h" | 27 #include "chrome/browser/sync/internal_api/change_record.h" |
31 #include "chrome/browser/sync/internal_api/http_post_provider_factory.h" | 28 #include "chrome/browser/sync/internal_api/http_post_provider_factory.h" |
32 #include "chrome/browser/sync/internal_api/http_post_provider_interface.h" | 29 #include "chrome/browser/sync/internal_api/http_post_provider_interface.h" |
33 #include "chrome/browser/sync/internal_api/includes/test_unrecoverable_error_han
dler.h" | |
34 #include "chrome/browser/sync/internal_api/read_node.h" | 30 #include "chrome/browser/sync/internal_api/read_node.h" |
35 #include "chrome/browser/sync/internal_api/read_transaction.h" | 31 #include "chrome/browser/sync/internal_api/read_transaction.h" |
36 #include "chrome/browser/sync/internal_api/sync_manager.h" | 32 #include "chrome/browser/sync/internal_api/sync_manager.h" |
37 #include "chrome/browser/sync/internal_api/write_node.h" | 33 #include "chrome/browser/sync/internal_api/write_node.h" |
38 #include "chrome/browser/sync/internal_api/write_transaction.h" | 34 #include "chrome/browser/sync/internal_api/write_transaction.h" |
39 #include "chrome/browser/sync/js/js_arg_list.h" | |
40 #include "chrome/browser/sync/js/js_backend.h" | |
41 #include "chrome/browser/sync/js/js_event_handler.h" | |
42 #include "chrome/browser/sync/js/js_reply_handler.h" | |
43 #include "chrome/browser/sync/js/js_test_util.h" | |
44 #include "chrome/browser/sync/notifier/sync_notifier.h" | 35 #include "chrome/browser/sync/notifier/sync_notifier.h" |
45 #include "chrome/browser/sync/notifier/sync_notifier_observer.h" | 36 #include "chrome/browser/sync/notifier/sync_notifier_observer.h" |
46 #include "chrome/browser/sync/protocol/proto_value_conversions.h" | |
47 #include "chrome/browser/sync/sessions/sync_session.h" | |
48 #include "chrome/browser/sync/syncable/model_type_test_util.h" | |
49 #include "chrome/browser/sync/syncable/syncable.h" | |
50 #include "chrome/browser/sync/syncable/syncable_id.h" | |
51 #include "chrome/browser/sync/test/engine/test_user_share.h" | 37 #include "chrome/browser/sync/test/engine/test_user_share.h" |
52 #include "chrome/browser/sync/test/fake_encryptor.h" | 38 #include "sync/engine/model_safe_worker.h" |
53 #include "chrome/browser/sync/test/fake_extensions_activity_monitor.h" | 39 #include "sync/engine/nigori_util.h" |
54 #include "chrome/browser/sync/util/cryptographer.h" | 40 #include "sync/engine/polling_constants.h" |
55 #include "chrome/browser/sync/util/extensions_activity_monitor.h" | 41 #include "sync/js/js_arg_list.h" |
56 #include "chrome/browser/sync/util/time.h" | 42 #include "sync/js/js_backend.h" |
| 43 #include "sync/js/js_event_handler.h" |
| 44 #include "sync/js/js_reply_handler.h" |
| 45 #include "sync/js/js_test_util.h" |
57 #include "sync/protocol/bookmark_specifics.pb.h" | 46 #include "sync/protocol/bookmark_specifics.pb.h" |
58 #include "sync/protocol/encryption.pb.h" | 47 #include "sync/protocol/encryption.pb.h" |
59 #include "sync/protocol/extension_specifics.pb.h" | 48 #include "sync/protocol/extension_specifics.pb.h" |
60 #include "sync/protocol/password_specifics.pb.h" | 49 #include "sync/protocol/password_specifics.pb.h" |
61 #include "sync/protocol/preference_specifics.pb.h" | 50 #include "sync/protocol/preference_specifics.pb.h" |
| 51 #include "sync/protocol/proto_value_conversions.h" |
62 #include "sync/protocol/sync.pb.h" | 52 #include "sync/protocol/sync.pb.h" |
| 53 #include "sync/sessions/sync_session.h" |
| 54 #include "sync/syncable/model_type_test_util.h" |
| 55 #include "sync/syncable/syncable.h" |
| 56 #include "sync/syncable/syncable_id.h" |
| 57 #include "sync/test/fake_encryptor.h" |
| 58 #include "sync/test/fake_extensions_activity_monitor.h" |
| 59 #include "sync/util/cryptographer.h" |
| 60 #include "sync/util/extensions_activity_monitor.h" |
| 61 #include "sync/util/test_unrecoverable_error_handler.h" |
| 62 #include "sync/util/time.h" |
63 #include "testing/gmock/include/gmock/gmock.h" | 63 #include "testing/gmock/include/gmock/gmock.h" |
64 #include "testing/gtest/include/gtest/gtest.h" | 64 #include "testing/gtest/include/gtest/gtest.h" |
65 | 65 |
66 using base::ExpectDictStringValue; | 66 using base::ExpectDictStringValue; |
67 using browser_sync::Cryptographer; | 67 using browser_sync::Cryptographer; |
68 using browser_sync::FakeEncryptor; | 68 using browser_sync::FakeEncryptor; |
69 using browser_sync::FakeExtensionsActivityMonitor; | 69 using browser_sync::FakeExtensionsActivityMonitor; |
70 using browser_sync::HasArgsAsList; | 70 using browser_sync::HasArgsAsList; |
71 using browser_sync::HasDetailsAsDictionary; | 71 using browser_sync::HasDetailsAsDictionary; |
72 using browser_sync::KeyParams; | 72 using browser_sync::KeyParams; |
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2433 EXPECT_EQ(title, node.GetTitle()); | 2433 EXPECT_EQ(title, node.GetTitle()); |
2434 EXPECT_EQ(GURL(url2), node.GetURL()); | 2434 EXPECT_EQ(GURL(url2), node.GetURL()); |
2435 const syncable::Entry* node_entry = node.GetEntry(); | 2435 const syncable::Entry* node_entry = node.GetEntry(); |
2436 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); | 2436 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); |
2437 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); | 2437 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); |
2438 EXPECT_TRUE(specifics.has_encrypted()); | 2438 EXPECT_TRUE(specifics.has_encrypted()); |
2439 } | 2439 } |
2440 } | 2440 } |
2441 | 2441 |
2442 } // namespace browser_sync | 2442 } // namespace browser_sync |
OLD | NEW |