1 // Copyright 2018 The Chromium Authors. All rights reserved. 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 "base/test/scoped_feature_list.h" 12 #include "testing/gtest/include/gtest/gtest.h" 13 14 namespace base { 15 namespace android { 16 17 class AndroidImageReaderTest : public testing::Test { 18 public: 19 AndroidImageReaderTest() = default; 20 ~AndroidImageReaderTest() override = default; 21 }; 22 23 // Getting instance of AndroidImageReader will invoke AndroidImageReader 24 // constructor which will dlopen the mediandk and androidndk .so files and do 25 // all the required symbol lookups. TEST_F(AndroidImageReaderTest,GetImageReaderInstance)26TEST_F(AndroidImageReaderTest, GetImageReaderInstance) { 27 // It is expected that image reader support will be available from android 28 // version OREO. 29 EXPECT_EQ(AndroidImageReader::GetInstance().IsSupported(), 30 base::android::BuildInfo::GetInstance()->sdk_int() >= 31 base::android::SDK_VERSION_OREO); 32 } 33 34 // There should be only 1 instance of AndroidImageReader im memory. Hence 2 35 // instances should have same memory address. TEST_F(AndroidImageReaderTest,CompareImageReaderInstance)36TEST_F(AndroidImageReaderTest, CompareImageReaderInstance) { 37 AndroidImageReader& a1 = AndroidImageReader::GetInstance(); 38 AndroidImageReader& a2 = AndroidImageReader::GetInstance(); 39 ASSERT_EQ(&a1, &a2); 40 } 41 42 } // namespace android 43 } // namespace base 44