Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/allocator/features.h" | |
| 6 #include "base/logging.h" | |
| 7 #include "base/test/scoped_memory_usage.h" | |
|
pavely
2016/10/28 22:55:32
I can't find scoped_memory_usage.h either.
| |
| 8 #include "build/build_config.h" | |
| 9 #include "components/sync/protocol/app_list_specifics.pb.h" | |
| 10 #include "components/sync/protocol/app_notification_specifics.pb.h" | |
| 11 #include "components/sync/protocol/app_setting_specifics.pb.h" | |
| 12 #include "components/sync/protocol/app_specifics.pb.h" | |
| 13 #include "components/sync/protocol/arc_package_specifics.pb.h" | |
| 14 #include "components/sync/protocol/autofill_specifics.pb.h" | |
| 15 #include "components/sync/protocol/bookmark_specifics.pb.h" | |
| 16 #include "components/sync/protocol/dictionary_specifics.pb.h" | |
| 17 #include "components/sync/protocol/encryption.pb.h" | |
| 18 #include "components/sync/protocol/entity_metadata.pb.h" | |
| 19 #include "components/sync/protocol/experiments_specifics.pb.h" | |
| 20 #include "components/sync/protocol/extension_setting_specifics.pb.h" | |
| 21 #include "components/sync/protocol/extension_specifics.pb.h" | |
| 22 #include "components/sync/protocol/favicon_image_specifics.pb.h" | |
| 23 #include "components/sync/protocol/favicon_tracking_specifics.pb.h" | |
| 24 #include "components/sync/protocol/history_delete_directive_specifics.pb.h" | |
| 25 #include "components/sync/protocol/nigori_specifics.pb.h" | |
| 26 #include "components/sync/protocol/password_specifics.pb.h" | |
| 27 #include "components/sync/protocol/preference_specifics.pb.h" | |
| 28 #include "components/sync/protocol/printer_specifics.pb.h" | |
| 29 #include "components/sync/protocol/priority_preference_specifics.pb.h" | |
| 30 #include "components/sync/protocol/proto_enum_conversions.h" | |
| 31 #include "components/sync/protocol/proto_memory_estimations.h" | |
| 32 #include "components/sync/protocol/proto_unittest_serialized_data.h" | |
| 33 #include "components/sync/protocol/reading_list_specifics.pb.h" | |
| 34 #include "components/sync/protocol/search_engine_specifics.pb.h" | |
| 35 #include "components/sync/protocol/session_specifics.pb.h" | |
| 36 #include "components/sync/protocol/sync.pb.h" | |
| 37 #include "components/sync/protocol/theme_specifics.pb.h" | |
| 38 #include "components/sync/protocol/typed_url_specifics.pb.h" | |
| 39 #include "components/sync/protocol/unique_position.pb.h" | |
| 40 #include "testing/gtest/include/gtest/gtest.h" | |
| 41 | |
| 42 #if BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) | |
| 43 | |
| 44 namespace syncer { | |
| 45 namespace { | |
| 46 | |
| 47 class ProtoSizeEstimationsTest : public testing::Test { | |
| 48 public: | |
| 49 void SetUp() override { | |
| 50 base::test::ScopedMemoryUsage::Initialize(); | |
| 51 } | |
| 52 }; | |
| 53 | |
| 54 #define IMPLEMENT_TEST(Proto) \ | |
| 55 TEST_F(ProtoSizeEstimationsTest, Proto) { \ | |
| 56 sync_pb::Proto proto; \ | |
| 57 base::test::ScopedMemoryUsage scoped_memory_usage; \ | |
| 58 EXPECT_TRUE(proto.ParseFromArray( \ | |
| 59 SerializedProto<sync_pb::Proto>::data, \ | |
| 60 SerializedProto<sync_pb::Proto>::kDataSize)); \ | |
| 61 size_t estimated_memory_usage = sync_pb::EstimateMemoryUsage(proto); \ | |
| 62 EXPECT_EQ(scoped_memory_usage.Usage(), estimated_memory_usage); \ | |
| 63 } | |
| 64 | |
| 65 IMPLEMENT_TEST(EncryptedData) | |
| 66 IMPLEMENT_TEST(AppListSpecifics) | |
| 67 IMPLEMENT_TEST(AppNotificationSettings) | |
| 68 IMPLEMENT_TEST(LinkedAppIconInfo) | |
| 69 IMPLEMENT_TEST(ArcPackageSpecifics) | |
| 70 IMPLEMENT_TEST(SessionHeader) | |
| 71 IMPLEMENT_TEST(SessionTab) | |
| 72 IMPLEMENT_TEST(SessionWindow) | |
| 73 IMPLEMENT_TEST(TabNavigation) | |
| 74 IMPLEMENT_TEST(NavigationRedirect) | |
| 75 IMPLEMENT_TEST(PasswordSpecificsData) | |
| 76 IMPLEMENT_TEST(GlobalIdDirective) | |
| 77 IMPLEMENT_TEST(TimeRangeDirective) | |
| 78 IMPLEMENT_TEST(SessionSpecifics) | |
| 79 IMPLEMENT_TEST(PrinterPPDReference) | |
| 80 IMPLEMENT_TEST(AppNotification) | |
| 81 IMPLEMENT_TEST(AppSettingSpecifics) | |
| 82 IMPLEMENT_TEST(AppSpecifics) | |
| 83 IMPLEMENT_TEST(ArticleSpecifics) | |
| 84 IMPLEMENT_TEST(AutofillSpecifics) | |
| 85 IMPLEMENT_TEST(AutofillProfileSpecifics) | |
| 86 IMPLEMENT_TEST(WalletMetadataSpecifics) | |
| 87 IMPLEMENT_TEST(AutofillWalletSpecifics) | |
| 88 IMPLEMENT_TEST(BookmarkSpecifics) | |
| 89 IMPLEMENT_TEST(DeviceInfoSpecifics) | |
| 90 IMPLEMENT_TEST(DictionarySpecifics) | |
| 91 IMPLEMENT_TEST(ExperimentsSpecifics) | |
| 92 IMPLEMENT_TEST(PriorityPreferenceSpecifics) | |
| 93 IMPLEMENT_TEST(ExtensionSettingSpecifics) | |
| 94 IMPLEMENT_TEST(ExtensionSpecifics) | |
| 95 IMPLEMENT_TEST(FaviconImageSpecifics) | |
| 96 IMPLEMENT_TEST(FaviconTrackingSpecifics) | |
| 97 IMPLEMENT_TEST(HistoryDeleteDirectiveSpecifics) | |
| 98 IMPLEMENT_TEST(ManagedUserSettingSpecifics) | |
| 99 IMPLEMENT_TEST(ManagedUserSpecifics) | |
| 100 IMPLEMENT_TEST(ManagedUserSharedSettingSpecifics) | |
| 101 IMPLEMENT_TEST(ManagedUserWhitelistSpecifics) | |
| 102 IMPLEMENT_TEST(NigoriSpecifics) | |
| 103 IMPLEMENT_TEST(PasswordSpecifics) | |
| 104 IMPLEMENT_TEST(PreferenceSpecifics) | |
| 105 IMPLEMENT_TEST(PrinterSpecifics) | |
| 106 IMPLEMENT_TEST(ReadingListSpecifics) | |
| 107 IMPLEMENT_TEST(SyncedNotificationAppInfoSpecifics) | |
| 108 IMPLEMENT_TEST(SyncedNotificationSpecifics) | |
| 109 IMPLEMENT_TEST(SearchEngineSpecifics) | |
| 110 IMPLEMENT_TEST(ThemeSpecifics) | |
| 111 IMPLEMENT_TEST(TypedUrlSpecifics) | |
| 112 IMPLEMENT_TEST(WalletMaskedCreditCard) | |
| 113 IMPLEMENT_TEST(WalletPostalAddress) | |
| 114 IMPLEMENT_TEST(WifiCredentialSpecifics) | |
| 115 IMPLEMENT_TEST(EntitySpecifics) | |
| 116 IMPLEMENT_TEST(SyncEntity) | |
| 117 // IMPLEMENT_TEST(ClientToServerMessage) | |
| 118 // IMPLEMENT_TEST(ClientToServerResponse) | |
| 119 IMPLEMENT_TEST(DatatypeAssociationStats) | |
| 120 IMPLEMENT_TEST(DebugEventInfo) | |
| 121 IMPLEMENT_TEST(DebugInfo) | |
| 122 IMPLEMENT_TEST(SyncCycleCompletedEventInfo) | |
| 123 IMPLEMENT_TEST(ClientConfigParams) | |
| 124 IMPLEMENT_TEST(AttachmentIdProto) | |
| 125 IMPLEMENT_TEST(EntityMetadata) | |
| 126 | |
| 127 } // namespace | |
| 128 } // namespace syncer | |
| 129 | |
| 130 #endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) | |
| OLD | NEW |