2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "test-gl-sync-abstraction.h"
23 TestSyncObject::TestSyncObject(TraceCallStack& trace)
29 TestSyncObject::~TestSyncObject()
33 bool TestSyncObject::IsSynced()
35 mTrace.PushCall("SyncObject::IsSynced", ""); // Trace the method
41 TestGlSyncAbstraction::TestGlSyncAbstraction()
49 TestGlSyncAbstraction::~TestGlSyncAbstraction()
51 for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
58 * Initialize the sync objects - clear down the map
60 void TestGlSyncAbstraction::Initialize()
66 * Create a sync object
67 * @return the sync object
69 Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject( )
71 mTrace.PushCall("CreateSyncObject", ""); // Trace the method
73 TestSyncObject* syncObject = new TestSyncObject(mTrace);
74 mSyncObjects.push_back( syncObject );
79 * Destroy a sync object
80 * @param[in] syncObject The object to destroy
82 void TestGlSyncAbstraction::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject )
84 std::stringstream out;
86 mTrace.PushCall("DestroySyncObject", out.str()); // Trace the method
88 for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
90 if( *iter == syncObject )
93 mSyncObjects.erase(iter);
100 Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject( )
102 if( !mSyncObjects.empty() )
104 return mSyncObjects.back();
110 * Test method to trigger the object sync behaviour.
112 * @param[in] sync The sync value to set
114 void TestGlSyncAbstraction::SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync )
116 TestSyncObject* testSyncObject = static_cast<TestSyncObject*>(syncObject);
117 testSyncObject->synced = sync;
123 void TestGlSyncAbstraction::EnableTrace(bool enable) { mTrace.Enable(enable); }
126 * Reset the trace callstack
128 void TestGlSyncAbstraction::ResetTrace() { mTrace.Reset(); }
131 * Get the trace object (allows test case to find methods on it)
133 TraceCallStack& TestGlSyncAbstraction::GetTrace() { return mTrace; }