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

Side by Side Diff: media/base/android/media_codec_util_unittest.cc

Issue 2686963002: Fix and update MediaCodec blacklist. (Closed)
Patch Set: when i left you, i was but the test. now i am the unit. 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 unified diff | Download patch
OLDNEW
(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/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 /*
DaleCurtis 2017/02/09 18:31:14 Cleanup?
liberato (no reviews please) 2017/02/09 18:38:56 oops, thanks.
12 using ::testing::_;
13 using ::testing::AtLeast;
14 using ::testing::Eq;
15 using ::testing::Field;
16 using ::testing::InSequence;
17 using ::testing::Mock;
18 using ::testing::Return;
19 using ::testing::SetArgPointee;
20 using ::testing::StrictMock;
21 */
22
23 namespace media {
24
25 // These will come from mockable BuildInfo, once it exists.
26 using base::android::SDK_VERSION_JELLY_BEAN;
27 using base::android::SDK_VERSION_JELLY_BEAN_MR1;
28 using base::android::SDK_VERSION_JELLY_BEAN_MR2;
29 using base::android::SDK_VERSION_KITKAT;
30 using base::android::SDK_VERSION_LOLLIPOP;
31 using base::android::SDK_VERSION_LOLLIPOP_MR1;
32 using base::android::SDK_VERSION_MARSHMALLOW;
33 using base::android::SDK_VERSION_NOUGAT;
34
35 class MediaCodecUtilTest : public testing::Test {
36 public:
37 MediaCodecUtilTest() {}
38 ~MediaCodecUtilTest() override {}
39
40 public:
41 DISALLOW_COPY_AND_ASSIGN(MediaCodecUtilTest);
42 };
43
44 TEST_F(MediaCodecUtilTest, TestCodecAvailableIfNewerVersion) {
45 // Test models that should be available above some sdk level.
46 // We probably don't need to test them all; we're more concerned that the
47 // blacklist code is doing the right thing with the entries it has rather than
48 // the map contents are right.
49 struct {
50 const char* model;
51 int last_bad_sdk;
52 } devices[] = {{"LGMS330", SDK_VERSION_LOLLIPOP_MR1},
53
54 {"GT-I9100", SDK_VERSION_KITKAT},
55 {"GT-I9300", SDK_VERSION_KITKAT},
56 {"GT-N7000", SDK_VERSION_KITKAT},
57 {"GT-N7100", SDK_VERSION_KITKAT},
58 {"A6600", SDK_VERSION_KITKAT},
59 {"A6800", SDK_VERSION_KITKAT},
60 {"GT-S7262", SDK_VERSION_KITKAT},
61 {"GT-S5282", SDK_VERSION_KITKAT},
62 {"GT-I8552", SDK_VERSION_KITKAT},
63
64 {"GT-P3113", SDK_VERSION_JELLY_BEAN_MR2},
65 {"GT-P5110", SDK_VERSION_JELLY_BEAN_MR2},
66 {"GT-P5100", SDK_VERSION_JELLY_BEAN_MR2},
67 {"GT-P5113", SDK_VERSION_JELLY_BEAN_MR2},
68 {"GT-P3110", SDK_VERSION_JELLY_BEAN_MR2},
69 {"GT-N5110", SDK_VERSION_JELLY_BEAN_MR2},
70 {"e-tab4", SDK_VERSION_JELLY_BEAN_MR2},
71 {"GT-I8200Q", SDK_VERSION_JELLY_BEAN_MR2},
72
73 {"always_works", 0}, // Some codec that works everywhere.
74 {nullptr, 0}};
75
76 for (int sdk = SDK_VERSION_JELLY_BEAN; sdk <= SDK_VERSION_NOUGAT; sdk++) {
77 for (int i = 0; devices[i].model; i++) {
78 bool supported =
79 MediaCodecUtil::IsMediaCodecAvailableForSdk(sdk, devices[i].model);
80
81 // Make sure that this model is supported if and only if |sdk| is
82 // newer than |last_bad_sdk|.
83 ASSERT_TRUE(supported == (sdk > devices[i].last_bad_sdk))
84 << " model: " << devices[i].model << " sdk: " << sdk;
85 }
86 }
87 }
88
89 } // namespace media
OLDNEW
« media/base/android/media_codec_util.cc ('K') | « 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