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/scoped_temp_dir.h" | 19 #include "base/scoped_temp_dir.h" |
20 #include "base/string_number_conversions.h" | 20 #include "base/string_number_conversions.h" |
21 #include "base/stringprintf.h" | 21 #include "base/stringprintf.h" |
22 #include "base/test/thread_test_helper.h" | 22 #include "base/test/thread_test_helper.h" |
| 23 #include "base/test/values_test_util.h" |
23 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
24 #include "base/values.h" | 25 #include "base/values.h" |
25 #include "chrome/browser/password_manager/encryptor.h" | 26 #include "chrome/browser/password_manager/encryptor.h" |
26 #include "chrome/browser/sync/engine/model_safe_worker.h" | 27 #include "chrome/browser/sync/engine/model_safe_worker.h" |
27 #include "chrome/browser/sync/engine/nigori_util.h" | 28 #include "chrome/browser/sync/engine/nigori_util.h" |
28 #include "chrome/browser/sync/engine/polling_constants.h" | 29 #include "chrome/browser/sync/engine/polling_constants.h" |
29 #include "chrome/browser/sync/engine/syncapi_internal.h" | 30 #include "chrome/browser/sync/engine/syncapi_internal.h" |
30 #include "chrome/browser/sync/internal_api/change_record.h" | 31 #include "chrome/browser/sync/internal_api/change_record.h" |
31 #include "chrome/browser/sync/internal_api/http_post_provider_factory.h" | 32 #include "chrome/browser/sync/internal_api/http_post_provider_factory.h" |
32 #include "chrome/browser/sync/internal_api/http_post_provider_interface.h" | 33 #include "chrome/browser/sync/internal_api/http_post_provider_interface.h" |
(...skipping 19 matching lines...) Expand all Loading... |
52 #include "chrome/browser/sync/protocol/sync.pb.h" | 53 #include "chrome/browser/sync/protocol/sync.pb.h" |
53 #include "chrome/browser/sync/sessions/sync_session.h" | 54 #include "chrome/browser/sync/sessions/sync_session.h" |
54 #include "chrome/browser/sync/syncable/model_type_test_util.h" | 55 #include "chrome/browser/sync/syncable/model_type_test_util.h" |
55 #include "chrome/browser/sync/syncable/syncable.h" | 56 #include "chrome/browser/sync/syncable/syncable.h" |
56 #include "chrome/browser/sync/syncable/syncable_id.h" | 57 #include "chrome/browser/sync/syncable/syncable_id.h" |
57 #include "chrome/browser/sync/test/engine/test_user_share.h" | 58 #include "chrome/browser/sync/test/engine/test_user_share.h" |
58 #include "chrome/browser/sync/test/fake_extensions_activity_monitor.h" | 59 #include "chrome/browser/sync/test/fake_extensions_activity_monitor.h" |
59 #include "chrome/browser/sync/util/cryptographer.h" | 60 #include "chrome/browser/sync/util/cryptographer.h" |
60 #include "chrome/browser/sync/util/extensions_activity_monitor.h" | 61 #include "chrome/browser/sync/util/extensions_activity_monitor.h" |
61 #include "chrome/browser/sync/util/time.h" | 62 #include "chrome/browser/sync/util/time.h" |
62 #include "chrome/test/base/values_test_util.h" | |
63 #include "content/test/test_browser_thread.h" | 63 #include "content/test/test_browser_thread.h" |
64 #include "testing/gmock/include/gmock/gmock.h" | 64 #include "testing/gmock/include/gmock/gmock.h" |
65 #include "testing/gtest/include/gtest/gtest.h" | 65 #include "testing/gtest/include/gtest/gtest.h" |
66 | 66 |
| 67 using base::ExpectDictStringValue; |
67 using browser_sync::Cryptographer; | 68 using browser_sync::Cryptographer; |
68 using browser_sync::FakeExtensionsActivityMonitor; | 69 using browser_sync::FakeExtensionsActivityMonitor; |
69 using browser_sync::HasArgsAsList; | 70 using browser_sync::HasArgsAsList; |
70 using browser_sync::HasDetailsAsDictionary; | 71 using browser_sync::HasDetailsAsDictionary; |
71 using browser_sync::KeyParams; | 72 using browser_sync::KeyParams; |
72 using browser_sync::kNigoriTag; | 73 using browser_sync::kNigoriTag; |
73 using browser_sync::JsArgList; | 74 using browser_sync::JsArgList; |
74 using browser_sync::JsBackend; | 75 using browser_sync::JsBackend; |
75 using browser_sync::JsEventHandler; | 76 using browser_sync::JsEventHandler; |
76 using browser_sync::JsReplyHandler; | 77 using browser_sync::JsReplyHandler; |
77 using browser_sync::MockJsEventHandler; | 78 using browser_sync::MockJsEventHandler; |
78 using browser_sync::MockJsReplyHandler; | 79 using browser_sync::MockJsReplyHandler; |
79 using browser_sync::ModelSafeRoutingInfo; | 80 using browser_sync::ModelSafeRoutingInfo; |
80 using browser_sync::ModelSafeWorker; | 81 using browser_sync::ModelSafeWorker; |
81 using browser_sync::ModelSafeWorkerRegistrar; | 82 using browser_sync::ModelSafeWorkerRegistrar; |
82 using browser_sync::sessions::SyncSessionSnapshot; | 83 using browser_sync::sessions::SyncSessionSnapshot; |
83 using browser_sync::WeakHandle; | 84 using browser_sync::WeakHandle; |
84 using content::BrowserThread; | 85 using content::BrowserThread; |
85 using syncable::IS_DEL; | 86 using syncable::IS_DEL; |
86 using syncable::IS_UNSYNCED; | 87 using syncable::IS_UNSYNCED; |
87 using syncable::kEncryptedString; | 88 using syncable::kEncryptedString; |
88 using syncable::ModelTypeSet; | 89 using syncable::ModelTypeSet; |
89 using syncable::ModelType; | 90 using syncable::ModelType; |
90 using syncable::NON_UNIQUE_NAME; | 91 using syncable::NON_UNIQUE_NAME; |
91 using syncable::SPECIFICS; | 92 using syncable::SPECIFICS; |
92 using test::ExpectDictStringValue; | |
93 using testing::_; | 93 using testing::_; |
94 using testing::AnyNumber; | 94 using testing::AnyNumber; |
95 using testing::AtLeast; | 95 using testing::AtLeast; |
96 using testing::InSequence; | 96 using testing::InSequence; |
97 using testing::Invoke; | 97 using testing::Invoke; |
98 using testing::SaveArg; | 98 using testing::SaveArg; |
99 using testing::StrictMock; | 99 using testing::StrictMock; |
100 | 100 |
101 namespace sync_api { | 101 namespace sync_api { |
102 | 102 |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 EXPECT_EQ(title, node.GetTitle()); | 2448 EXPECT_EQ(title, node.GetTitle()); |
2449 EXPECT_EQ(GURL(url2), node.GetURL()); | 2449 EXPECT_EQ(GURL(url2), node.GetURL()); |
2450 const syncable::Entry* node_entry = node.GetEntry(); | 2450 const syncable::Entry* node_entry = node.GetEntry(); |
2451 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); | 2451 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); |
2452 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); | 2452 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); |
2453 EXPECT_TRUE(specifics.has_encrypted()); | 2453 EXPECT_TRUE(specifics.has_encrypted()); |
2454 } | 2454 } |
2455 } | 2455 } |
2456 | 2456 |
2457 } // namespace browser_sync | 2457 } // namespace browser_sync |
OLD | NEW |