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 DisplayInfo getBuiltInDisplay();
36 
37 class TestContext {
38 public:
39     TestContext();
40     ~TestContext();
41 
42     sp<Surface> surface();
43 
44     void waitForVsync();
45 
46 private:
47     sp<SurfaceComposerClient> mSurfaceComposerClient;
48     sp<SurfaceControl> mSurfaceControl;
49     DisplayEventReceiver mDisplayEventReceiver;
50     sp<Looper> mLooper;
51 };
52 
53 } // namespace test
54 } // namespace uirenderer
55 } // namespace android
56 
57 #endif
58