1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 #ifndef TESTCONTEXT_H 18 #define TESTCONTEXT_H 19 20 #include <gui/DisplayEventReceiver.h> 21 #include <gui/ISurfaceComposer.h> 22 #include <gui/SurfaceComposerClient.h> 23 #include <gui/SurfaceControl.h> 24 #include <gui/Surface.h> 25 #include <ui/DisplayInfo.h> 26 #include <utils/Looper.h> 27 28 namespace android { 29 namespace uirenderer { 30 namespace test { 31 32 extern DisplayInfo gDisplay; 33 #define dp(x) ((x) * android::uirenderer::test::gDisplay.density) 34 35 class TestContext { 36 public: 37 TestContext(); 38 ~TestContext(); 39 40 sp<Surface> surface(); 41 42 void waitForVsync(); 43 44 private: 45 sp<SurfaceComposerClient> mSurfaceComposerClient; 46 sp<SurfaceControl> mSurfaceControl; 47 DisplayEventReceiver mDisplayEventReceiver; 48 sp<Looper> mLooper; 49 }; 50 51 } // namespace test 52 } // namespace uirenderer 53 } // namespace android 54 55 #endif 56