OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 ~MediaFileValidatorTest() override {} | 78 ~MediaFileValidatorTest() override {} |
79 | 79 |
80 void TearDownOnMainThread() override { | 80 void TearDownOnMainThread() override { |
81 // Release our ref to |file_system_context_| before the test framework winds | 81 // Release our ref to |file_system_context_| before the test framework winds |
82 // down, otherwise releasing it in the destructor posts a destruction task | 82 // down, otherwise releasing it in the destructor posts a destruction task |
83 // to the FILE thread after it has been shutdown (which base/task_scheduler | 83 // to the FILE thread after it has been shutdown (which base/task_scheduler |
84 // guards against in the RedirectNonUINonIOBrowserThreads experiment per the | 84 // guards against in the RedirectNonUINonIOBrowserThreads experiment per the |
85 // FILE thread's tasks being marked as shutdown blocking for legacy | 85 // FILE thread's tasks being marked as shutdown blocking for legacy |
86 // reasons). | 86 // reasons). |
87 file_system_context_ = nullptr; | 87 file_system_context_ = nullptr; |
88 InProcessBrowserTest::TearDownOnMainThread(); | |
89 } | 88 } |
90 | 89 |
91 // Write |content| into |filename| in a test file system and try to move | 90 // Write |content| into |filename| in a test file system and try to move |
92 // it into a media file system. The result is compared to |expected_result|. | 91 // it into a media file system. The result is compared to |expected_result|. |
93 void MoveTest(const std::string& filename, const std::string& content, | 92 void MoveTest(const std::string& filename, const std::string& content, |
94 bool expected_result) { | 93 bool expected_result) { |
95 content::BrowserThread::PostTask( | 94 content::BrowserThread::PostTask( |
96 content::BrowserThread::FILE, FROM_HERE, | 95 content::BrowserThread::FILE, FROM_HERE, |
97 base::BindOnce(&MediaFileValidatorTest::SetupOnFileThread, | 96 base::BindOnce(&MediaFileValidatorTest::SetupOnFileThread, |
98 base::Unretained(this), filename, content, | 97 base::Unretained(this), filename, content, |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 test_file = test_file.AppendASCII("no_streams.webm"); | 299 test_file = test_file.AppendASCII("no_streams.webm"); |
301 MoveTestFromFile("no_streams.webm", test_file, false); | 300 MoveTestFromFile("no_streams.webm", test_file, false); |
302 } | 301 } |
303 | 302 |
304 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { | 303 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { |
305 base::FilePath test_file = GetMediaTestDir(); | 304 base::FilePath test_file = GetMediaTestDir(); |
306 ASSERT_FALSE(test_file.empty()); | 305 ASSERT_FALSE(test_file.empty()); |
307 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); | 306 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); |
308 MoveTestFromFile("multitrack.webm", test_file, true); | 307 MoveTestFromFile("multitrack.webm", test_file, true); |
309 } | 308 } |
OLD | NEW |