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

Side by Side Diff: media/base/container_names_unittest.cc

Issue 109043002: Move more file_util functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « media/audio/win/audio_unified_win_unittest.cc ('k') | media/base/test_data_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "media/base/container_names.h" 6 #include "media/base/container_names.h"
7 #include "media/base/test_data_util.h" 7 #include "media/base/test_data_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // Determine the container type of a specified file. 104 // Determine the container type of a specified file.
105 void TestFile(MediaContainerName expected, const base::FilePath& filename) { 105 void TestFile(MediaContainerName expected, const base::FilePath& filename) {
106 char buffer[8192]; 106 char buffer[8192];
107 107
108 // Windows implementation of ReadFile fails if file smaller than desired size, 108 // Windows implementation of ReadFile fails if file smaller than desired size,
109 // so use file length if file less than 8192 bytes (http://crbug.com/243885). 109 // so use file length if file less than 8192 bytes (http://crbug.com/243885).
110 int read_size = sizeof(buffer); 110 int read_size = sizeof(buffer);
111 int64 actual_size; 111 int64 actual_size;
112 if (base::GetFileSize(filename, &actual_size) && actual_size < read_size) 112 if (base::GetFileSize(filename, &actual_size) && actual_size < read_size)
113 read_size = actual_size; 113 read_size = actual_size;
114 int read = file_util::ReadFile(filename, buffer, read_size); 114 int read = base::ReadFile(filename, buffer, read_size);
115 115
116 // Now verify the type. 116 // Now verify the type.
117 EXPECT_EQ(expected, 117 EXPECT_EQ(expected,
118 DetermineContainer(reinterpret_cast<const uint8*>(buffer), read)) 118 DetermineContainer(reinterpret_cast<const uint8*>(buffer), read))
119 << "Failure with file " << filename.value(); 119 << "Failure with file " << filename.value();
120 } 120 }
121 121
122 TEST(ContainerNamesTest, FileCheckOGG) { 122 TEST(ContainerNamesTest, FileCheckOGG) {
123 TestFile(CONTAINER_OGG, GetTestDataFilePath("bear.ogv")); 123 TestFile(CONTAINER_OGG, GetTestDataFilePath("bear.ogv"));
124 TestFile(CONTAINER_OGG, GetTestDataFilePath("9ch.ogg")); 124 TestFile(CONTAINER_OGG, GetTestDataFilePath("9ch.ogg"));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("ten_byte_file")); 211 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("ten_byte_file"));
212 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("README")); 212 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("README"));
213 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("bali_640x360_P422.yuv")); 213 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("bali_640x360_P422.yuv"));
214 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("bali_640x360_RGB24.rgb")); 214 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("bali_640x360_RGB24.rgb"));
215 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("webm_vp8_track_entry")); 215 TestFile(CONTAINER_UNKNOWN, GetTestDataFilePath("webm_vp8_track_entry"));
216 } 216 }
217 217
218 } // namespace container_names 218 } // namespace container_names
219 219
220 } // namespace media 220 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_unified_win_unittest.cc ('k') | media/base/test_data_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698