Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7206)

Unified Diff: chrome/test/sync/engine/proto_extension_validator.h

Issue 7828055: Move sync test code out of chrome/test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/sync/engine/proto_extension_validator.h
===================================================================
--- chrome/test/sync/engine/proto_extension_validator.h (revision 99413)
+++ chrome/test/sync/engine/proto_extension_validator.h (working copy)
@@ -1,55 +0,0 @@
-// Copyright (c) 2010 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.
-
-// A test utility that makes it easy to assert the exact presence of
-// protobuf extensions in an extensible message. Example code:
-//
-// sync_pb::EntitySpecifics value; // Set up a test value.
-// value.MutableExtension(sync_pb::bookmark);
-//
-// ProtoExtensionValidator<sync_pb::EntitySpecifics> good_expectation(value);
-// good_expectation.ExpectHasExtension(sync_pb::bookmark);
-// good_expectation.ExpectHasNoOtherFieldsOrExtensions();
-//
-// ProtoExtensionValidator<sync_pb::EntitySpecifics> bad_expectation(value);
-// bad_expectation.ExpectHasExtension(sync_pb::preference); // Fails, no pref
-// bad_expectation.ExpectHasNoOtherFieldsOrExtensions(); // Fails, bookmark
-
-#ifndef CHROME_TEST_SYNC_ENGINE_PROTO_EXTENSION_VALIDATOR_H_
-#define CHROME_TEST_SYNC_ENGINE_PROTO_EXTENSION_VALIDATOR_H_
-#pragma once
-
-#include "base/string_util.h"
-#include "chrome/test/sync/engine/syncer_command_test.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace browser_sync {
-
-template<typename MessageType>
-class ProtoExtensionValidator {
- public:
- explicit ProtoExtensionValidator(const MessageType& proto)
- : proto_(proto) {
- }
- template<typename ExtensionTokenType>
- void ExpectHasExtension(ExtensionTokenType token) {
- EXPECT_TRUE(proto_.HasExtension(token))
- << "Proto failed to contain expected extension";
- proto_.ClearExtension(token);
- EXPECT_FALSE(proto_.HasExtension(token));
- }
- void ExpectNoOtherFieldsOrExtensions() {
- EXPECT_EQ(MessageType::default_instance().SerializeAsString(),
- proto_.SerializeAsString())
- << "Proto contained additional unexpected extensions.";
- }
-
- private:
- MessageType proto_;
- DISALLOW_COPY_AND_ASSIGN(ProtoExtensionValidator);
-};
-
-} // namespace browser_sync
-
-#endif // CHROME_TEST_SYNC_ENGINE_PROTO_EXTENSION_VALIDATOR_H_
« no previous file with comments | « chrome/test/sync/engine/mock_gaia_authenticator_unittest.cc ('k') | chrome/test/sync/engine/syncer_command_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698