| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 7 #include "base/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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)); | 133 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)); |
| 134 | 134 |
| 135 // We need signal_event to be executed on the FILE thread, as the test thread | 135 // We need signal_event to be executed on the FILE thread, as the test thread |
| 136 // is blocked. Therefore, we invoke FilterAttachedDevices on the FILE thread. | 136 // is blocked. Therefore, we invoke FilterAttachedDevices on the FILE thread. |
| 137 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 137 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 138 base::Bind(&MediaStorageUtil::FilterAttachedDevices, | 138 base::Bind(&MediaStorageUtil::FilterAttachedDevices, |
| 139 base::Unretained(&devices), signal_event)); | 139 base::Unretained(&devices), signal_event)); |
| 140 event.Wait(); | 140 event.Wait(); |
| 141 EXPECT_FALSE(devices.find(kImageCaptureDeviceId) != devices.end()); | 141 EXPECT_FALSE(devices.find(kImageCaptureDeviceId) != devices.end()); |
| 142 | 142 |
| 143 ProcessAttach(kImageCaptureDeviceId, ASCIIToUTF16("name"), | 143 ProcessAttach(kImageCaptureDeviceId, base::ASCIIToUTF16("name"), |
| 144 FILE_PATH_LITERAL("/location")); | 144 FILE_PATH_LITERAL("/location")); |
| 145 devices.insert(kImageCaptureDeviceId); | 145 devices.insert(kImageCaptureDeviceId); |
| 146 event.Reset(); | 146 event.Reset(); |
| 147 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 147 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 148 base::Bind(&MediaStorageUtil::FilterAttachedDevices, | 148 base::Bind(&MediaStorageUtil::FilterAttachedDevices, |
| 149 base::Unretained(&devices), signal_event)); | 149 base::Unretained(&devices), signal_event)); |
| 150 event.Wait(); | 150 event.Wait(); |
| 151 | 151 |
| 152 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); | 152 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); |
| 153 } | 153 } |
| OLD | NEW |