Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: media/base/android/media_codec_util_unittest.cc

Issue 2686963002: Fix and update MediaCodec blacklist. (Closed)
Patch Set: rebased. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/android/media_codec_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/media_codec_util_unittest.cc
diff --git a/media/base/android/media_codec_util_unittest.cc b/media/base/android/media_codec_util_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..879180df7c93b1bf3dd920a64cacf032c7e7249c
--- /dev/null
+++ b/media/base/android/media_codec_util_unittest.cc
@@ -0,0 +1,76 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/android/media_codec_util.h"
+#include "base/android/build_info.h"
+#include "base/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+// These will come from mockable BuildInfo, once it exists.
+using base::android::SDK_VERSION_JELLY_BEAN;
+using base::android::SDK_VERSION_JELLY_BEAN_MR1;
+using base::android::SDK_VERSION_JELLY_BEAN_MR2;
+using base::android::SDK_VERSION_KITKAT;
+using base::android::SDK_VERSION_LOLLIPOP;
+using base::android::SDK_VERSION_LOLLIPOP_MR1;
+using base::android::SDK_VERSION_MARSHMALLOW;
+using base::android::SDK_VERSION_NOUGAT;
+
+class MediaCodecUtilTest : public testing::Test {
+ public:
+ MediaCodecUtilTest() {}
+ ~MediaCodecUtilTest() override {}
+
+ public:
+ DISALLOW_COPY_AND_ASSIGN(MediaCodecUtilTest);
+};
+
+TEST_F(MediaCodecUtilTest, TestCodecAvailableIfNewerVersion) {
+ // Test models that should be available above some sdk level.
+ // We probably don't need to test them all; we're more concerned that the
+ // blacklist code is doing the right thing with the entries it has rather than
+ // the map contents are right.
+ struct {
+ const char* model;
+ int last_bad_sdk;
+ } devices[] = {{"LGMS330", SDK_VERSION_LOLLIPOP_MR1},
+
+ {"GT-I9100", SDK_VERSION_KITKAT},
+ {"GT-I9300", SDK_VERSION_KITKAT},
+ {"GT-N7000", SDK_VERSION_KITKAT},
+ {"GT-N7100", SDK_VERSION_KITKAT},
+ {"A6600", SDK_VERSION_KITKAT},
+ {"A6800", SDK_VERSION_KITKAT},
+ {"GT-S7262", SDK_VERSION_KITKAT},
+ {"GT-S5282", SDK_VERSION_KITKAT},
+ {"GT-I8552", SDK_VERSION_KITKAT},
+
+ {"GT-P3113", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-P5110", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-P5100", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-P5113", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-P3110", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-N5110", SDK_VERSION_JELLY_BEAN_MR2},
+ {"e-tab4", SDK_VERSION_JELLY_BEAN_MR2},
+ {"GT-I8200Q", SDK_VERSION_JELLY_BEAN_MR2},
+
+ {"always_works", 0}, // Some codec that works everywhere.
+ {nullptr, 0}};
+
+ for (int sdk = SDK_VERSION_JELLY_BEAN; sdk <= SDK_VERSION_NOUGAT; sdk++) {
+ for (int i = 0; devices[i].model; i++) {
+ bool supported =
+ MediaCodecUtil::IsMediaCodecAvailableFor(sdk, devices[i].model);
+
+ // Make sure that this model is supported if and only if |sdk| is
+ // newer than |last_bad_sdk|.
+ ASSERT_TRUE(supported == (sdk > devices[i].last_bad_sdk))
+ << " model: " << devices[i].model << " sdk: " << sdk;
+ }
+ }
+}
+
+} // namespace media
« no previous file with comments | « media/base/android/media_codec_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698