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

Side by Side Diff: media/base/mock_ffmpeg.h

Issue 6539021: Move MockFFmpeg instance setting into the constructor/destructor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/mock_ffmpeg.cc » ('j') | media/filters/ffmpeg_glue_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef MEDIA_BASE_MOCK_FFMPEG_H_ 5 #ifndef MEDIA_BASE_MOCK_FFMPEG_H_
6 #define MEDIA_BASE_MOCK_FFMPEG_H_ 6 #define MEDIA_BASE_MOCK_FFMPEG_H_
7 7
8 // TODO(scherkus): See if we can remove ffmpeg_common from this file. 8 // TODO(scherkus): See if we can remove ffmpeg_common from this file.
9 #include "media/ffmpeg/ffmpeg_common.h" 9 #include "media/ffmpeg/ffmpeg_common.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
11 11
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 MOCK_METHOD2(AVNewPacket, int(AVPacket* packet, int size)); 58 MOCK_METHOD2(AVNewPacket, int(AVPacket* packet, int size));
59 MOCK_METHOD1(AVFreePacket, void(AVPacket* packet)); 59 MOCK_METHOD1(AVFreePacket, void(AVPacket* packet));
60 MOCK_METHOD1(AVFree, void(void* ptr)); 60 MOCK_METHOD1(AVFree, void(void* ptr));
61 MOCK_METHOD1(AVDupPacket, int(AVPacket* packet)); 61 MOCK_METHOD1(AVDupPacket, int(AVPacket* packet));
62 62
63 MOCK_METHOD1(AVLogSetLevel, void(int level)); 63 MOCK_METHOD1(AVLogSetLevel, void(int level));
64 64
65 // Used for verifying check points during tests. 65 // Used for verifying check points during tests.
66 MOCK_METHOD1(CheckPoint, void(int id)); 66 MOCK_METHOD1(CheckPoint, void(int id));
67 67
68 // Setter/getter for the global instance of MockFFmpeg.
69 static void set(MockFFmpeg* instance);
70 static MockFFmpeg* get();
71
72 // Returns the URLProtocol registered by the FFmpegGlue singleton. 68 // Returns the URLProtocol registered by the FFmpegGlue singleton.
73 static URLProtocol* protocol(); 69 static URLProtocol* protocol();
74 70
75 // AVPacket destructor for packets allocated by av_new_packet(). 71 // AVPacket destructor for packets allocated by av_new_packet().
76 static void DestructPacket(AVPacket* packet); 72 static void DestructPacket(AVPacket* packet);
77 73
78 // Modifies the number of outstanding packets. 74 // Modifies the number of outstanding packets.
79 void inc_outstanding_packets(); 75 void inc_outstanding_packets();
80 void dec_outstanding_packets(); 76 void dec_outstanding_packets();
81 77
82 private: 78 private:
83 static MockFFmpeg* instance_;
84 static URLProtocol* protocol_; 79 static URLProtocol* protocol_;
85 80
86 // Tracks the number of packets allocated by calls to av_read_frame() and 81 // Tracks the number of packets allocated by calls to av_read_frame() and
87 // av_free_packet(). We crash the unit test if this is not zero at time of 82 // av_free_packet(). We crash the unit test if this is not zero at time of
88 // destruction. 83 // destruction.
89 int outstanding_packets_; 84 int outstanding_packets_;
90 }; 85 };
91 86
92 // Used for simulating av_read_frame(). 87 // Used for simulating av_read_frame().
93 ACTION_P3(CreatePacket, stream_index, data, size) { 88 ACTION_P3(CreatePacket, stream_index, data, size) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 arg0->destruct(arg0); 135 arg0->destruct(arg0);
141 } 136 }
142 137
143 // Decrement number of packets allocated. 138 // Decrement number of packets allocated.
144 MockFFmpeg::get()->dec_outstanding_packets(); 139 MockFFmpeg::get()->dec_outstanding_packets();
145 } 140 }
146 141
147 } // namespace media 142 } // namespace media
148 143
149 #endif // MEDIA_BASE_MOCK_FFMPEG_H_ 144 #endif // MEDIA_BASE_MOCK_FFMPEG_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/mock_ffmpeg.cc » ('j') | media/filters/ffmpeg_glue_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698