| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 "media/base/android/media_codec_util.h" |
| 6 #include "base/android/build_info.h" |
| 7 #include "base/macros.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace media { |
| 11 |
| 12 // These will come from mockable BuildInfo, once it exists. |
| 13 using base::android::SDK_VERSION_JELLY_BEAN; |
| 14 using base::android::SDK_VERSION_JELLY_BEAN_MR1; |
| 15 using base::android::SDK_VERSION_JELLY_BEAN_MR2; |
| 16 using base::android::SDK_VERSION_KITKAT; |
| 17 using base::android::SDK_VERSION_LOLLIPOP; |
| 18 using base::android::SDK_VERSION_LOLLIPOP_MR1; |
| 19 using base::android::SDK_VERSION_MARSHMALLOW; |
| 20 using base::android::SDK_VERSION_NOUGAT; |
| 21 |
| 22 class MediaCodecUtilTest : public testing::Test { |
| 23 public: |
| 24 MediaCodecUtilTest() {} |
| 25 ~MediaCodecUtilTest() override {} |
| 26 |
| 27 public: |
| 28 DISALLOW_COPY_AND_ASSIGN(MediaCodecUtilTest); |
| 29 }; |
| 30 |
| 31 TEST_F(MediaCodecUtilTest, TestCodecAvailableIfNewerVersion) { |
| 32 // Test models that should be available above some sdk level. |
| 33 // We probably don't need to test them all; we're more concerned that the |
| 34 // blacklist code is doing the right thing with the entries it has rather than |
| 35 // the map contents are right. |
| 36 struct { |
| 37 const char* model; |
| 38 int last_bad_sdk; |
| 39 } devices[] = {{"LGMS330", SDK_VERSION_LOLLIPOP_MR1}, |
| 40 |
| 41 {"GT-I9100", SDK_VERSION_KITKAT}, |
| 42 {"GT-I9300", SDK_VERSION_KITKAT}, |
| 43 {"GT-N7000", SDK_VERSION_KITKAT}, |
| 44 {"GT-N7100", SDK_VERSION_KITKAT}, |
| 45 {"A6600", SDK_VERSION_KITKAT}, |
| 46 {"A6800", SDK_VERSION_KITKAT}, |
| 47 {"GT-S7262", SDK_VERSION_KITKAT}, |
| 48 {"GT-S5282", SDK_VERSION_KITKAT}, |
| 49 {"GT-I8552", SDK_VERSION_KITKAT}, |
| 50 |
| 51 {"GT-P3113", SDK_VERSION_JELLY_BEAN_MR2}, |
| 52 {"GT-P5110", SDK_VERSION_JELLY_BEAN_MR2}, |
| 53 {"GT-P5100", SDK_VERSION_JELLY_BEAN_MR2}, |
| 54 {"GT-P5113", SDK_VERSION_JELLY_BEAN_MR2}, |
| 55 {"GT-P3110", SDK_VERSION_JELLY_BEAN_MR2}, |
| 56 {"GT-N5110", SDK_VERSION_JELLY_BEAN_MR2}, |
| 57 {"e-tab4", SDK_VERSION_JELLY_BEAN_MR2}, |
| 58 {"GT-I8200Q", SDK_VERSION_JELLY_BEAN_MR2}, |
| 59 |
| 60 {"always_works", 0}, // Some codec that works everywhere. |
| 61 {nullptr, 0}}; |
| 62 |
| 63 for (int sdk = SDK_VERSION_JELLY_BEAN; sdk <= SDK_VERSION_NOUGAT; sdk++) { |
| 64 for (int i = 0; devices[i].model; i++) { |
| 65 bool supported = |
| 66 MediaCodecUtil::IsMediaCodecAvailableFor(sdk, devices[i].model); |
| 67 |
| 68 // Make sure that this model is supported if and only if |sdk| is |
| 69 // newer than |last_bad_sdk|. |
| 70 ASSERT_TRUE(supported == (sdk > devices[i].last_bad_sdk)) |
| 71 << " model: " << devices[i].model << " sdk: " << sdk; |
| 72 } |
| 73 } |
| 74 } |
| 75 |
| 76 } // namespace media |
| OLD | NEW |