summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorposciak@chromium.org <posciak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-04 07:52:32 +0000
committerposciak@chromium.org <posciak@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-04 07:52:32 +0000
commitdeb217342d041800a8725c61e6b3739d7d71200f (patch)
treee7278e23fdd8fcac15574547f07e357243e2db8b /content
parent9328ede42dcbb15d3a96c5a3fa700b584a02a07a (diff)
downloadchromium_src-deb217342d041800a8725c61e6b3739d7d71200f.zip
chromium_src-deb217342d041800a8725c61e6b3739d7d71200f.tar.gz
chromium_src-deb217342d041800a8725c61e6b3739d7d71200f.tar.bz2
veatest: Instantiate AtExitManager before calling GetTestDataFilePath().
Otherwise things won't work properly (and the Debug executable will fail to run). BUG=None TEST=Build and run veatest in Debug. Review URL: https://codereview.chromium.org/216163004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261700 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/common/gpu/media/video_encode_accelerator_unittest.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/content/common/gpu/media/video_encode_accelerator_unittest.cc b/content/common/gpu/media/video_encode_accelerator_unittest.cc
index 2b3f1d6..f28fe67 100644
--- a/content/common/gpu/media/video_encode_accelerator_unittest.cc
+++ b/content/common/gpu/media/video_encode_accelerator_unittest.cc
@@ -52,9 +52,9 @@ const uint32 kDefaultFPS = 30;
// Output stream is saved for the simple encode test only.
// - |requested_bitrate| requested bitrate in bits per second (optional).
// Bitrate is only forced for tests that test bitrate.
-base::FilePath::StringType test_stream_data =
- media::GetTestDataFilePath("sync_192p20_frames.yuv").value() +
- ":320:192:1:out.h264:200000";
+const char* g_default_in_filename = "sync_192p20_frames.yuv";
+const char* g_default_in_parameters = ":320:192:1:out.h264:200000";
+base::FilePath::StringType* g_test_stream_data;
struct TestStream {
TestStream() : requested_bitrate(0) {}
@@ -67,7 +67,7 @@ struct TestStream {
unsigned int requested_bitrate;
};
-static void ParseAndReadTestStreamData(base::FilePath::StringType data,
+static void ParseAndReadTestStreamData(const base::FilePath::StringType& data,
TestStream* test_stream) {
std::vector<base::FilePath::StringType> fields;
base::SplitString(data, ':', &fields);
@@ -681,7 +681,7 @@ TEST_P(VideoEncodeAcceleratorTest, TestSimpleEncode) {
const bool force_bitrate = GetParam().c;
TestStream test_stream;
- ParseAndReadTestStreamData(test_stream_data, &test_stream);
+ ParseAndReadTestStreamData(*g_test_stream_data, &test_stream);
// Disregard save_to_file if we didn't get an output filename.
const bool save_to_file = GetParam().a && !test_stream.out_filename.empty();
@@ -743,6 +743,13 @@ int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args.
CommandLine::Init(argc, argv);
+ base::ShadowingAtExitManager at_exit_manager;
+ scoped_ptr<base::FilePath::StringType> test_stream_data(
+ new base::FilePath::StringType(
+ media::GetTestDataFilePath(content::g_default_in_filename).value() +
+ content::g_default_in_parameters));
+ content::g_test_stream_data = test_stream_data.get();
+
// Needed to enable DVLOG through --vmodule.
logging::LoggingSettings settings;
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
@@ -756,7 +763,7 @@ int main(int argc, char** argv) {
it != switches.end();
++it) {
if (it->first == "test_stream_data") {
- content::test_stream_data = it->second.c_str();
+ test_stream_data->assign(it->second.c_str());
continue;
}
if (it->first == "v" || it->first == "vmodule")
@@ -764,7 +771,5 @@ int main(int argc, char** argv) {
LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
}
- base::ShadowingAtExitManager at_exit_manager;
-
return RUN_ALL_TESTS();
}