Fix emulator build error
[platform/framework/web/chromium-efl.git] / base / android / android_image_reader_compat_unittest.cc
1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/android/android_image_reader_compat.h"
6
7 #include <stdint.h>
8 #include <memory>
9
10 #include "base/android/build_info.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace base {
14 namespace android {
15
16 class AndroidImageReaderTest : public testing::Test {
17  public:
18   AndroidImageReaderTest() = default;
19   ~AndroidImageReaderTest() override = default;
20 };
21
22 // Getting instance of AndroidImageReader will invoke AndroidImageReader
23 // constructor which will dlopen the mediandk and androidndk .so files and do
24 // all the required symbol lookups.
25 TEST_F(AndroidImageReaderTest, GetImageReaderInstance) {
26   // It is expected that image reader support will be available from android
27   // version OREO.
28   EXPECT_EQ(AndroidImageReader::GetInstance().IsSupported(),
29             base::android::BuildInfo::GetInstance()->sdk_int() >=
30                 base::android::SDK_VERSION_P);
31 }
32
33 // There should be only 1 instance of AndroidImageReader im memory. Hence 2
34 // instances should have same memory address.
35 TEST_F(AndroidImageReaderTest, CompareImageReaderInstance) {
36   AndroidImageReader& a1 = AndroidImageReader::GetInstance();
37   AndroidImageReader& a2 = AndroidImageReader::GetInstance();
38   ASSERT_EQ(&a1, &a2);
39 }
40
41 }  // namespace android
42 }  // namespace base