blob: 359b71c821324ce2fa9da09edff866e529bc6b1b [file] [log] [blame]
Jamie Gennis134f0422011-03-08 12:18:54 -08001/*
2 * Copyright (C) 2011 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#include <gui/SurfaceTextureClient.h>
18#include <gtest/gtest.h>
19
20namespace android {
21
22class SurfaceTextureClientTest : public ::testing::Test {
23protected:
24 virtual void SetUp() {
25 mST = new SurfaceTexture(123);
26 mSTC = new SurfaceTextureClient(mST);
27 }
28
29 virtual void TearDown() {
30 mST.clear();
31 mSTC.clear();
32 }
33
34 sp<SurfaceTexture> mST;
35 sp<SurfaceTextureClient> mSTC;
36};
37
38TEST_F(SurfaceTextureClientTest, QueuesToWindowCompositorIsFalse) {
39 sp<ANativeWindow> anw(mSTC);
40 int result = -123;
41 int err = anw->query(anw.get(), NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER,
42 &result);
43 EXPECT_EQ(NO_ERROR, err);
44 EXPECT_EQ(0, result);
45}
46
Jamie Gennis391bbe22011-03-14 15:00:06 -070047TEST_F(SurfaceTextureClientTest, ConcreteTypeIsSurfaceTextureClient) {
48 sp<ANativeWindow> anw(mSTC);
49 int result = -123;
50 int err = anw->query(anw.get(), NATIVE_WINDOW_CONCRETE_TYPE, &result);
51 EXPECT_EQ(NO_ERROR, err);
52 EXPECT_EQ(NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT, result);
53}
54
Jamie Gennis134f0422011-03-08 12:18:54 -080055}