OLD | NEW |
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" | |
11 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
12 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
13 #import "base/sys_info.h" | 12 #import "base/sys_info.h" |
14 #import "base/threading/platform_thread.h" | 13 #import "base/threading/platform_thread.h" |
15 #import "base/threading/thread.h" | 14 #import "base/threading/thread.h" |
16 #import "ui/base/test/ui_cocoa_test_helper.h" | 15 #import "ui/base/test/ui_cocoa_test_helper.h" |
17 | 16 |
18 namespace { | 17 namespace { |
19 | 18 |
20 // Aribtrary values used to test the callback. | 19 // Aribtrary values used to test the callback. |
21 const int kCallbackFrameID = 10; | 20 const int kCallbackFrameID = 10; |
22 const int kCallbackExpectedStatus = 7; | 21 const int kCallbackExpectedStatus = 7; |
23 | 22 |
24 // Sample movie data to create the decoder. | 23 // Sample movie data to create the decoder. |
25 const int kSampleWidth = 1280; | 24 const int kSampleWidth = 1280; |
26 const int kSampleHeight = 720; | 25 const int kSampleHeight = 720; |
27 const uint8_t kSampleAVCData[] = { | 26 const uint8_t kSampleAVCData[] = { |
28 0x1, 0x64, 0x0, 0x1f, 0xff, 0xe1, 0x0, 0x1a, | 27 0x1, 0x64, 0x0, 0x1f, 0xff, 0xe1, 0x0, 0x1a, |
29 0x67, 0x64, 0x0, 0x1f, 0xac, 0x2c, 0xc5, 0x1, | 28 0x67, 0x64, 0x0, 0x1f, 0xac, 0x2c, 0xc5, 0x1, |
30 0x40, 0x16, 0xec, 0x4, 0x40, 0x0, 0x0, 0x3, | 29 0x40, 0x16, 0xec, 0x4, 0x40, 0x0, 0x0, 0x3, |
31 0x0, 0x40, 0x0, 0x0, 0xf, 0x23, 0xc6, 0xc, | 30 0x0, 0x40, 0x0, 0x0, 0xf, 0x23, 0xc6, 0xc, |
32 0x65, 0x80, 0x1, 0x0, 0x5, 0x68, 0xe9, 0x2b, | 31 0x65, 0x80, 0x1, 0x0, 0x5, 0x68, 0xe9, 0x2b, |
33 0x2c, 0x8b, | 32 0x2c, 0x8b, |
34 }; | 33 }; |
35 | 34 |
36 // Check to see if the OS we're running on should have | 35 // Check to see if the OS we're running on should have |
37 // VideoDecodeAcceleration.framework installed. | 36 // VideoDecodeAcceleration.framework installed. |
38 bool OSShouldHaveFramework() { | 37 bool OSShouldHaveFramework() { |
39 if (base::mac::IsOSLeopardOrEarlier()) | |
40 return false; | |
41 | |
42 // 10.6.2 and earlier doesn't have the framework. | 38 // 10.6.2 and earlier doesn't have the framework. |
43 int32 major, minor, bugfix; | 39 int32 major, minor, bugfix; |
44 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); | 40 base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); |
45 if (major == 10 && minor == 6 && bugfix <= 2) | 41 if (major == 10 && minor == 6 && bugfix <= 2) |
46 return false; | 42 return false; |
47 | 43 |
48 return true; | 44 return true; |
49 } | 45 } |
50 | 46 |
51 // This function is provided as a callback for | 47 // This function is provided as a callback for |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Wait for the thread to complete. | 118 // Wait for the thread to complete. |
123 thread.Stop(); | 119 thread.Stop(); |
124 | 120 |
125 // Verify that the callback occured. | 121 // Verify that the callback occured. |
126 EXPECT_FALSE(callback_done); | 122 EXPECT_FALSE(callback_done); |
127 loop.RunAllPending(); | 123 loop.RunAllPending(); |
128 EXPECT_TRUE(callback_done); | 124 EXPECT_TRUE(callback_done); |
129 } | 125 } |
130 | 126 |
131 } // namespace gfx | 127 } // namespace gfx |
OLD | NEW |