1 // Copyright 2017 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 "mojo/public/cpp/bindings/tests/bindings_test_base.h" 6 7 #include "mojo/public/cpp/bindings/connector.h" 8 9 namespace mojo { 10 BindingsTestBase()11BindingsTestBase::BindingsTestBase() { 12 SetupSerializationBehavior(GetParam()); 13 } 14 15 BindingsTestBase::~BindingsTestBase() = default; 16 17 // static SetupSerializationBehavior(BindingsTestSerializationMode mode)18void BindingsTestBase::SetupSerializationBehavior( 19 BindingsTestSerializationMode mode) { 20 switch (mode) { 21 case BindingsTestSerializationMode::kSerializeBeforeSend: 22 Connector::OverrideDefaultSerializationBehaviorForTesting( 23 Connector::OutgoingSerializationMode::kEager, 24 Connector::IncomingSerializationMode::kDispatchAsIs); 25 break; 26 case BindingsTestSerializationMode::kSerializeBeforeDispatch: 27 Connector::OverrideDefaultSerializationBehaviorForTesting( 28 Connector::OutgoingSerializationMode::kLazy, 29 Connector::IncomingSerializationMode :: 30 kSerializeBeforeDispatchForTesting); 31 break; 32 case BindingsTestSerializationMode::kNeverSerialize: 33 Connector::OverrideDefaultSerializationBehaviorForTesting( 34 Connector::OutgoingSerializationMode::kLazy, 35 Connector::IncomingSerializationMode::kDispatchAsIs); 36 break; 37 } 38 } 39 40 } // namespace mojo 41