2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
17 #include "test-gl-sync-abstraction.h"
22 TestSyncObject::TestSyncObject(TraceCallStack& trace)
28 TestSyncObject::~TestSyncObject()
32 bool TestSyncObject::IsSynced()
34 mTrace.PushCall("SyncObject::IsSynced", ""); // Trace the method
40 TestGlSyncAbstraction::TestGlSyncAbstraction()
48 TestGlSyncAbstraction::~TestGlSyncAbstraction()
50 for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
57 * Initialize the sync objects - clear down the map
59 void TestGlSyncAbstraction::Initialize()
65 * Create a sync object
66 * @return the sync object
68 Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject( )
70 mTrace.PushCall("CreateSyncObject", ""); // Trace the method
72 TestSyncObject* syncObject = new TestSyncObject(mTrace);
73 mSyncObjects.push_back( syncObject );
78 * Destroy a sync object
79 * @param[in] syncObject The object to destroy
81 void TestGlSyncAbstraction::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject )
83 std::stringstream out;
85 mTrace.PushCall("DestroySyncObject", out.str()); // Trace the method
87 for( SyncIter iter=mSyncObjects.begin(), end=mSyncObjects.end(); iter != end; ++iter )
89 if( *iter == syncObject )
92 mSyncObjects.erase(iter);
99 Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject( )
101 if( !mSyncObjects.empty() )
103 return mSyncObjects.back();
109 * Test method to trigger the object sync behaviour.
111 * @param[in] sync The sync value to set
113 void TestGlSyncAbstraction::SetObjectSynced( Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync )
115 TestSyncObject* testSyncObject = static_cast<TestSyncObject*>(syncObject);
116 testSyncObject->synced = sync;
122 void TestGlSyncAbstraction::EnableTrace(bool enable) { mTrace.Enable(enable); }
125 * Reset the trace callstack
127 void TestGlSyncAbstraction::ResetTrace() { mTrace.Reset(); }
130 * Get the trace object (allows test case to find methods on it)
132 TraceCallStack& TestGlSyncAbstraction::GetTrace() { return mTrace; }