| 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> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "sync/test/fake_encryptor.h" | 60 #include "sync/test/fake_encryptor.h" |
| 61 #include "sync/test/fake_extensions_activity_monitor.h" | 61 #include "sync/test/fake_extensions_activity_monitor.h" |
| 62 #include "sync/util/cryptographer.h" | 62 #include "sync/util/cryptographer.h" |
| 63 #include "sync/util/extensions_activity_monitor.h" | 63 #include "sync/util/extensions_activity_monitor.h" |
| 64 #include "sync/util/test_unrecoverable_error_handler.h" | 64 #include "sync/util/test_unrecoverable_error_handler.h" |
| 65 #include "sync/util/time.h" | 65 #include "sync/util/time.h" |
| 66 #include "testing/gmock/include/gmock/gmock.h" | 66 #include "testing/gmock/include/gmock/gmock.h" |
| 67 #include "testing/gtest/include/gtest/gtest.h" | 67 #include "testing/gtest/include/gtest/gtest.h" |
| 68 | 68 |
| 69 using base::ExpectDictStringValue; | 69 using base::ExpectDictStringValue; |
| 70 using syncer::Cryptographer; | |
| 71 using syncer::FakeEncryptor; | |
| 72 using syncer::FakeExtensionsActivityMonitor; | |
| 73 using syncer::HasArgsAsList; | |
| 74 using syncer::HasDetailsAsDictionary; | |
| 75 using syncer::KeyParams; | |
| 76 using syncer::kNigoriTag; | |
| 77 using syncer::JsArgList; | |
| 78 using syncer::JsBackend; | |
| 79 using syncer::JsEventHandler; | |
| 80 using syncer::JsReplyHandler; | |
| 81 using syncer::MockJsEventHandler; | |
| 82 using syncer::MockJsReplyHandler; | |
| 83 using syncer::ModelSafeRoutingInfo; | |
| 84 using syncer::ModelSafeWorker; | |
| 85 using syncer::sessions::SyncSessionSnapshot; | |
| 86 using syncer::TestUnrecoverableErrorHandler; | |
| 87 using syncer::WeakHandle; | |
| 88 using syncable::IS_DEL; | |
| 89 using syncable::IS_UNSYNCED; | |
| 90 using syncable::kEncryptedString; | |
| 91 using syncable::ModelTypeSet; | |
| 92 using syncable::ModelType; | |
| 93 using syncable::NON_UNIQUE_NAME; | |
| 94 using syncable::SPECIFICS; | |
| 95 using testing::_; | 70 using testing::_; |
| 96 using testing::AnyNumber; | 71 using testing::AnyNumber; |
| 97 using testing::AtLeast; | 72 using testing::AtLeast; |
| 98 using testing::InSequence; | 73 using testing::InSequence; |
| 99 using testing::Invoke; | 74 using testing::Invoke; |
| 100 using testing::SaveArg; | 75 using testing::SaveArg; |
| 101 using testing::StrictMock; | 76 using testing::StrictMock; |
| 102 | 77 |
| 103 namespace syncer { | 78 namespace syncer { |
| 104 | 79 |
| 80 using sessions::SyncSessionSnapshot; |
| 81 using syncable::IS_DEL; |
| 82 using syncable::IS_UNSYNCED; |
| 83 using syncable::kEncryptedString; |
| 84 using syncable::ModelTypeSet; |
| 85 using syncable::ModelType; |
| 86 using syncable::NON_UNIQUE_NAME; |
| 87 using syncable::SPECIFICS; |
| 88 |
| 105 namespace { | 89 namespace { |
| 106 | 90 |
| 107 const char kTestChromeVersion[] = "test chrome version"; | 91 const char kTestChromeVersion[] = "test chrome version"; |
| 108 | 92 |
| 109 void DoNothing() {} | 93 void DoNothing() {} |
| 110 | 94 |
| 111 void ExpectInt64Value(int64 expected_value, | 95 void ExpectInt64Value(int64 expected_value, |
| 112 const DictionaryValue& value, const std::string& key) { | 96 const DictionaryValue& value, const std::string& key) { |
| 113 std::string int64_str; | 97 std::string int64_str; |
| 114 EXPECT_TRUE(value.GetString(key, &int64_str)); | 98 EXPECT_TRUE(value.GetString(key, &int64_str)); |
| (...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2504 EXPECT_EQ(title, node.GetTitle()); | 2488 EXPECT_EQ(title, node.GetTitle()); |
| 2505 EXPECT_EQ(GURL(url2), node.GetURL()); | 2489 EXPECT_EQ(GURL(url2), node.GetURL()); |
| 2506 const syncable::Entry* node_entry = node.GetEntry(); | 2490 const syncable::Entry* node_entry = node.GetEntry(); |
| 2507 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); | 2491 EXPECT_EQ(kEncryptedString, node_entry->Get(NON_UNIQUE_NAME)); |
| 2508 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); | 2492 const sync_pb::EntitySpecifics& specifics = node_entry->Get(SPECIFICS); |
| 2509 EXPECT_TRUE(specifics.has_encrypted()); | 2493 EXPECT_TRUE(specifics.has_encrypted()); |
| 2510 } | 2494 } |
| 2511 } | 2495 } |
| 2512 | 2496 |
| 2513 } // namespace syncer | 2497 } // namespace syncer |
| OLD | NEW |