Chromium Code Reviews| Index: components/sync/protocol/proto_memory_estimations_unittest.cc |
| diff --git a/components/sync/protocol/proto_memory_estimations_unittest.cc b/components/sync/protocol/proto_memory_estimations_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c04ee177676b1b6aee048e116a8888ca1d70777f |
| --- /dev/null |
| +++ b/components/sync/protocol/proto_memory_estimations_unittest.cc |
| @@ -0,0 +1,130 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/allocator/features.h" |
| +#include "base/logging.h" |
| +#include "base/test/scoped_memory_usage.h" |
|
pavely
2016/10/28 22:55:32
I can't find scoped_memory_usage.h either.
|
| +#include "build/build_config.h" |
| +#include "components/sync/protocol/app_list_specifics.pb.h" |
| +#include "components/sync/protocol/app_notification_specifics.pb.h" |
| +#include "components/sync/protocol/app_setting_specifics.pb.h" |
| +#include "components/sync/protocol/app_specifics.pb.h" |
| +#include "components/sync/protocol/arc_package_specifics.pb.h" |
| +#include "components/sync/protocol/autofill_specifics.pb.h" |
| +#include "components/sync/protocol/bookmark_specifics.pb.h" |
| +#include "components/sync/protocol/dictionary_specifics.pb.h" |
| +#include "components/sync/protocol/encryption.pb.h" |
| +#include "components/sync/protocol/entity_metadata.pb.h" |
| +#include "components/sync/protocol/experiments_specifics.pb.h" |
| +#include "components/sync/protocol/extension_setting_specifics.pb.h" |
| +#include "components/sync/protocol/extension_specifics.pb.h" |
| +#include "components/sync/protocol/favicon_image_specifics.pb.h" |
| +#include "components/sync/protocol/favicon_tracking_specifics.pb.h" |
| +#include "components/sync/protocol/history_delete_directive_specifics.pb.h" |
| +#include "components/sync/protocol/nigori_specifics.pb.h" |
| +#include "components/sync/protocol/password_specifics.pb.h" |
| +#include "components/sync/protocol/preference_specifics.pb.h" |
| +#include "components/sync/protocol/printer_specifics.pb.h" |
| +#include "components/sync/protocol/priority_preference_specifics.pb.h" |
| +#include "components/sync/protocol/proto_enum_conversions.h" |
| +#include "components/sync/protocol/proto_memory_estimations.h" |
| +#include "components/sync/protocol/proto_unittest_serialized_data.h" |
| +#include "components/sync/protocol/reading_list_specifics.pb.h" |
| +#include "components/sync/protocol/search_engine_specifics.pb.h" |
| +#include "components/sync/protocol/session_specifics.pb.h" |
| +#include "components/sync/protocol/sync.pb.h" |
| +#include "components/sync/protocol/theme_specifics.pb.h" |
| +#include "components/sync/protocol/typed_url_specifics.pb.h" |
| +#include "components/sync/protocol/unique_position.pb.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +#if BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |
| + |
| +namespace syncer { |
| +namespace { |
| + |
| +class ProtoSizeEstimationsTest : public testing::Test { |
| + public: |
| + void SetUp() override { |
| + base::test::ScopedMemoryUsage::Initialize(); |
| + } |
| +}; |
| + |
| +#define IMPLEMENT_TEST(Proto) \ |
| + TEST_F(ProtoSizeEstimationsTest, Proto) { \ |
| + sync_pb::Proto proto; \ |
| + base::test::ScopedMemoryUsage scoped_memory_usage; \ |
| + EXPECT_TRUE(proto.ParseFromArray( \ |
| + SerializedProto<sync_pb::Proto>::data, \ |
| + SerializedProto<sync_pb::Proto>::kDataSize)); \ |
| + size_t estimated_memory_usage = sync_pb::EstimateMemoryUsage(proto); \ |
| + EXPECT_EQ(scoped_memory_usage.Usage(), estimated_memory_usage); \ |
| + } |
| + |
| +IMPLEMENT_TEST(EncryptedData) |
| +IMPLEMENT_TEST(AppListSpecifics) |
| +IMPLEMENT_TEST(AppNotificationSettings) |
| +IMPLEMENT_TEST(LinkedAppIconInfo) |
| +IMPLEMENT_TEST(ArcPackageSpecifics) |
| +IMPLEMENT_TEST(SessionHeader) |
| +IMPLEMENT_TEST(SessionTab) |
| +IMPLEMENT_TEST(SessionWindow) |
| +IMPLEMENT_TEST(TabNavigation) |
| +IMPLEMENT_TEST(NavigationRedirect) |
| +IMPLEMENT_TEST(PasswordSpecificsData) |
| +IMPLEMENT_TEST(GlobalIdDirective) |
| +IMPLEMENT_TEST(TimeRangeDirective) |
| +IMPLEMENT_TEST(SessionSpecifics) |
| +IMPLEMENT_TEST(PrinterPPDReference) |
| +IMPLEMENT_TEST(AppNotification) |
| +IMPLEMENT_TEST(AppSettingSpecifics) |
| +IMPLEMENT_TEST(AppSpecifics) |
| +IMPLEMENT_TEST(ArticleSpecifics) |
| +IMPLEMENT_TEST(AutofillSpecifics) |
| +IMPLEMENT_TEST(AutofillProfileSpecifics) |
| +IMPLEMENT_TEST(WalletMetadataSpecifics) |
| +IMPLEMENT_TEST(AutofillWalletSpecifics) |
| +IMPLEMENT_TEST(BookmarkSpecifics) |
| +IMPLEMENT_TEST(DeviceInfoSpecifics) |
| +IMPLEMENT_TEST(DictionarySpecifics) |
| +IMPLEMENT_TEST(ExperimentsSpecifics) |
| +IMPLEMENT_TEST(PriorityPreferenceSpecifics) |
| +IMPLEMENT_TEST(ExtensionSettingSpecifics) |
| +IMPLEMENT_TEST(ExtensionSpecifics) |
| +IMPLEMENT_TEST(FaviconImageSpecifics) |
| +IMPLEMENT_TEST(FaviconTrackingSpecifics) |
| +IMPLEMENT_TEST(HistoryDeleteDirectiveSpecifics) |
| +IMPLEMENT_TEST(ManagedUserSettingSpecifics) |
| +IMPLEMENT_TEST(ManagedUserSpecifics) |
| +IMPLEMENT_TEST(ManagedUserSharedSettingSpecifics) |
| +IMPLEMENT_TEST(ManagedUserWhitelistSpecifics) |
| +IMPLEMENT_TEST(NigoriSpecifics) |
| +IMPLEMENT_TEST(PasswordSpecifics) |
| +IMPLEMENT_TEST(PreferenceSpecifics) |
| +IMPLEMENT_TEST(PrinterSpecifics) |
| +IMPLEMENT_TEST(ReadingListSpecifics) |
| +IMPLEMENT_TEST(SyncedNotificationAppInfoSpecifics) |
| +IMPLEMENT_TEST(SyncedNotificationSpecifics) |
| +IMPLEMENT_TEST(SearchEngineSpecifics) |
| +IMPLEMENT_TEST(ThemeSpecifics) |
| +IMPLEMENT_TEST(TypedUrlSpecifics) |
| +IMPLEMENT_TEST(WalletMaskedCreditCard) |
| +IMPLEMENT_TEST(WalletPostalAddress) |
| +IMPLEMENT_TEST(WifiCredentialSpecifics) |
| +IMPLEMENT_TEST(EntitySpecifics) |
| +IMPLEMENT_TEST(SyncEntity) |
| +// IMPLEMENT_TEST(ClientToServerMessage) |
| +// IMPLEMENT_TEST(ClientToServerResponse) |
| +IMPLEMENT_TEST(DatatypeAssociationStats) |
| +IMPLEMENT_TEST(DebugEventInfo) |
| +IMPLEMENT_TEST(DebugInfo) |
| +IMPLEMENT_TEST(SyncCycleCompletedEventInfo) |
| +IMPLEMENT_TEST(ClientConfigParams) |
| +IMPLEMENT_TEST(AttachmentIdProto) |
| +IMPLEMENT_TEST(EntityMetadata) |
| + |
| +} // namespace |
| +} // namespace syncer |
| + |
| +#endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) |