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

Side by Side Diff: ui/gfx/video_decode_acceleration_support_mac_unittest.mm

Issue 10388108: Implement media::VideoDecodeAccelerator on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/video_decode_acceleration_support_mac.h" 5 #include "ui/gfx/video_decode_acceleration_support_mac.h"
6 6
7 #import "base/bind.h" 7 #import "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #import "base/mac/foundation_util.h" 9 #import "base/mac/foundation_util.h"
10 #import "base/mac/mac_util.h" 10 #import "base/mac/mac_util.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // supports it. 74 // supports it.
75 TEST_F(VideoDecodeAccelerationSupportTest, Create) { 75 TEST_F(VideoDecodeAccelerationSupportTest, Create) {
76 scoped_refptr<gfx::VideoDecodeAccelerationSupport> vda( 76 scoped_refptr<gfx::VideoDecodeAccelerationSupport> vda(
77 new gfx::VideoDecodeAccelerationSupport); 77 new gfx::VideoDecodeAccelerationSupport);
78 gfx::VideoDecodeAccelerationSupport::Status status = vda->Create( 78 gfx::VideoDecodeAccelerationSupport::Status status = vda->Create(
79 kSampleWidth, kSampleHeight, kCVPixelFormatType_422YpCbCr8, 79 kSampleWidth, kSampleHeight, kCVPixelFormatType_422YpCbCr8,
80 kSampleAVCData, arraysize(kSampleAVCData)); 80 kSampleAVCData, arraysize(kSampleAVCData));
81 81
82 // We should get an error loading the framework on 10.6.2 and earlier. 82 // We should get an error loading the framework on 10.6.2 and earlier.
83 if (!OSShouldHaveFramework()) { 83 if (!OSShouldHaveFramework()) {
84 EXPECT_EQ(gfx::VideoDecodeAccelerationSupport::VDA_LOAD_FRAMEWORK_ERROR, 84 EXPECT_EQ(gfx::VideoDecodeAccelerationSupport::LOAD_FRAMEWORK_ERROR,
85 status); 85 status);
86 return; 86 return;
87 } 87 }
88 88
89 // If the hardware is not supported then there's not much we can do. 89 // If the hardware is not supported then there's not much we can do.
90 if (status == 90 if (status ==
91 gfx::VideoDecodeAccelerationSupport::VDA_HARDWARE_NOT_SUPPORTED_ERROR) { 91 gfx::VideoDecodeAccelerationSupport::HARDWARE_NOT_SUPPORTED_ERROR) {
92 return; 92 return;
93 } 93 }
94 94
95 EXPECT_EQ(gfx::VideoDecodeAccelerationSupport::VDA_SUCCESS, status); 95 EXPECT_EQ(gfx::VideoDecodeAccelerationSupport::SUCCESS, status);
96 EXPECT_EQ(gfx::VideoDecodeAccelerationSupport::VDA_SUCCESS, 96 EXPECT_EQ(gfx::VideoDecodeAccelerationSupport::SUCCESS,
97 vda->Flush(false)); 97 vda->Flush(false));
98 EXPECT_EQ(gfx::VideoDecodeAccelerationSupport::VDA_SUCCESS, vda->Destroy()); 98 EXPECT_EQ(gfx::VideoDecodeAccelerationSupport::SUCCESS, vda->Destroy());
99 } 99 }
100 100
101 // Test that callback works. 101 // Test that callback works.
102 TEST_F(VideoDecodeAccelerationSupportTest, Callback) { 102 TEST_F(VideoDecodeAccelerationSupportTest, Callback) {
103 MessageLoop loop; 103 MessageLoop loop;
104 bool callback_done = false; 104 bool callback_done = false;
105 105
106 scoped_refptr<gfx::VideoDecodeAccelerationSupport> vda( 106 scoped_refptr<gfx::VideoDecodeAccelerationSupport> vda(
107 new gfx::VideoDecodeAccelerationSupport); 107 new gfx::VideoDecodeAccelerationSupport);
108 vda->frame_ready_callbacks_[kCallbackFrameID] = base::Bind( 108 vda->frame_ready_callbacks_[kCallbackFrameID] = base::Bind(
(...skipping 13 matching lines...) Expand all
122 // Wait for the thread to complete. 122 // Wait for the thread to complete.
123 thread.Stop(); 123 thread.Stop();
124 124
125 // Verify that the callback occured. 125 // Verify that the callback occured.
126 EXPECT_FALSE(callback_done); 126 EXPECT_FALSE(callback_done);
127 loop.RunAllPending(); 127 loop.RunAllPending();
128 EXPECT_TRUE(callback_done); 128 EXPECT_TRUE(callback_done);
129 } 129 }
130 130
131 } // namespace gfx 131 } // namespace gfx
OLDNEW
« base/memory/scoped_policy.h ('K') | « ui/gfx/video_decode_acceleration_support_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698