Hook the WebThreadImplForMessageLoop up to post taks through the blink
[chromium-blink-merge.git] / ppapi / shared_impl / media_stream_video_track_shared_unittest.cc
blob55b011953a323f1ea70436142fa1fdfa6a6f97bc
1 // Copyright 2014 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.
5 #include "ppapi/shared_impl/media_stream_video_track_shared.h"
6 #include "testing/gtest/include/gtest/gtest.h"
8 namespace ppapi {
10 TEST(MediaStreamVideoTrackShared, Verify) {
12 MediaStreamVideoTrackShared::Attributes attributes;
13 EXPECT_TRUE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
16 // Verify buffers
18 MediaStreamVideoTrackShared::Attributes attributes;
19 attributes.buffers = 0;
20 EXPECT_TRUE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
22 attributes.buffers = 8;
23 EXPECT_TRUE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
25 attributes.buffers = 1024;
26 EXPECT_TRUE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
28 attributes.buffers = -1;
29 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
32 // Verify format
34 MediaStreamVideoTrackShared::Attributes attributes;
35 for (int32_t i = PP_VIDEOFRAME_FORMAT_UNKNOWN;
36 i <= PP_VIDEOFRAME_FORMAT_LAST;
37 ++i) {
38 attributes.format = static_cast<PP_VideoFrame_Format>(i);
39 EXPECT_TRUE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
42 attributes.format = static_cast<PP_VideoFrame_Format>(-1);
43 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
45 attributes.format =
46 static_cast<PP_VideoFrame_Format>(PP_VIDEOFRAME_FORMAT_LAST + 1);
47 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
50 // Verify width
52 MediaStreamVideoTrackShared::Attributes attributes;
53 attributes.width = 1024;
54 EXPECT_TRUE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
56 attributes.width = 1025;
57 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
59 attributes.width = 1026;
60 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
62 attributes.width = -1;
63 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
65 attributes.width = -4;
66 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
68 attributes.width = 4097;
69 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
72 // Verify height
74 MediaStreamVideoTrackShared::Attributes attributes;
75 attributes.height = 1024;
76 EXPECT_TRUE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
78 attributes.height = 1025;
79 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
81 attributes.height = 1026;
82 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
84 attributes.height = -1;
85 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
87 attributes.height = -4;
88 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
90 attributes.height = 4096 + 4;
91 EXPECT_FALSE(MediaStreamVideoTrackShared::VerifyAttributes(attributes));
96 } // namespace ppapi