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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 } // namespace | 72 } // namespace |
73 | 73 |
74 class MediaFileValidatorTest : public InProcessBrowserTest { | 74 class MediaFileValidatorTest : public InProcessBrowserTest { |
75 public: | 75 public: |
76 MediaFileValidatorTest() : test_file_size_(0) {} | 76 MediaFileValidatorTest() : test_file_size_(0) {} |
77 | 77 |
78 ~MediaFileValidatorTest() override {} | 78 ~MediaFileValidatorTest() override {} |
79 | 79 |
| 80 void TearDownOnMainThread() override { |
| 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 |
| 83 // to the FILE thread after it has been shutdown (which base/task_scheduler |
| 84 // guards against in the RedirectNonUINonIOBrowserThreads experiment per the |
| 85 // FILE thread's tasks being marked as shutdown blocking for legacy |
| 86 // reasons). |
| 87 file_system_context_ = nullptr; |
| 88 InProcessBrowserTest::TearDownOnMainThread(); |
| 89 } |
| 90 |
80 // Write |content| into |filename| in a test file system and try to move | 91 // Write |content| into |filename| in a test file system and try to move |
81 // it into a media file system. The result is compared to |expected_result|. | 92 // it into a media file system. The result is compared to |expected_result|. |
82 void MoveTest(const std::string& filename, const std::string& content, | 93 void MoveTest(const std::string& filename, const std::string& content, |
83 bool expected_result) { | 94 bool expected_result) { |
84 content::BrowserThread::PostTask( | 95 content::BrowserThread::PostTask( |
85 content::BrowserThread::FILE, | 96 content::BrowserThread::FILE, |
86 FROM_HERE, | 97 FROM_HERE, |
87 base::Bind(&MediaFileValidatorTest::SetupOnFileThread, | 98 base::Bind(&MediaFileValidatorTest::SetupOnFileThread, |
88 base::Unretained(this), filename, content, expected_result)); | 99 base::Unretained(this), filename, content, expected_result)); |
89 loop_runner_ = new content::MessageLoopRunner; | 100 loop_runner_ = new content::MessageLoopRunner; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 test_file = test_file.AppendASCII("no_streams.webm"); | 301 test_file = test_file.AppendASCII("no_streams.webm"); |
291 MoveTestFromFile("no_streams.webm", test_file, false); | 302 MoveTestFromFile("no_streams.webm", test_file, false); |
292 } | 303 } |
293 | 304 |
294 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { | 305 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { |
295 base::FilePath test_file = GetMediaTestDir(); | 306 base::FilePath test_file = GetMediaTestDir(); |
296 ASSERT_FALSE(test_file.empty()); | 307 ASSERT_FALSE(test_file.empty()); |
297 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); | 308 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); |
298 MoveTestFromFile("multitrack.webm", test_file, true); | 309 MoveTestFromFile("multitrack.webm", test_file, true); |
299 } | 310 } |
OLD | NEW |