| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 monitor_ = TestStorageMonitor::CreateAndInstall(); | 64 monitor_ = TestStorageMonitor::CreateAndInstall(); |
| 65 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); | 65 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void TearDown() override { | 68 void TearDown() override { |
| 69 WaitForFileThread(); | 69 WaitForFileThread(); |
| 70 TestStorageMonitor::Destroy(); | 70 TestStorageMonitor::Destroy(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 static void PostQuitToUIThread() { | 73 static void PostQuitToUIThread() { |
| 74 BrowserThread::PostTask(BrowserThread::UI, | 74 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 75 FROM_HERE, | 75 base::MessageLoop::QuitWhenIdleClosure()); |
| 76 base::MessageLoop::QuitClosure()); | |
| 77 } | 76 } |
| 78 | 77 |
| 79 static void WaitForFileThread() { | 78 static void WaitForFileThread() { |
| 80 BrowserThread::PostTask(BrowserThread::FILE, | 79 BrowserThread::PostTask(BrowserThread::FILE, |
| 81 FROM_HERE, | 80 FROM_HERE, |
| 82 base::Bind(&PostQuitToUIThread)); | 81 base::Bind(&PostQuitToUIThread)); |
| 83 base::MessageLoop::current()->Run(); | 82 base::MessageLoop::current()->Run(); |
| 84 } | 83 } |
| 85 | 84 |
| 86 private: | 85 private: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 event.Reset(); | 146 event.Reset(); |
| 148 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 147 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 149 base::Bind(&MediaStorageUtil::FilterAttachedDevices, | 148 base::Bind(&MediaStorageUtil::FilterAttachedDevices, |
| 150 base::Unretained(&devices), signal_event)); | 149 base::Unretained(&devices), signal_event)); |
| 151 event.Wait(); | 150 event.Wait(); |
| 152 | 151 |
| 153 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); | 152 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); |
| 154 } | 153 } |
| 155 | 154 |
| 156 } // namespace storage_monitor | 155 } // namespace storage_monitor |
| OLD | NEW |