| 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/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 file_thread_.Start(); | 66 file_thread_.Start(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual void TearDown() { | 69 virtual void TearDown() { |
| 70 WaitForFileThread(); | 70 WaitForFileThread(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 static void PostQuitToUIThread() { | 73 static void PostQuitToUIThread() { |
| 74 BrowserThread::PostTask(BrowserThread::UI, | 74 BrowserThread::PostTask(BrowserThread::UI, |
| 75 FROM_HERE, | 75 FROM_HERE, |
| 76 MessageLoop::QuitClosure()); | 76 base::MessageLoop::QuitClosure()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 static void WaitForFileThread() { | 79 static void WaitForFileThread() { |
| 80 BrowserThread::PostTask(BrowserThread::FILE, | 80 BrowserThread::PostTask(BrowserThread::FILE, |
| 81 FROM_HERE, | 81 FROM_HERE, |
| 82 base::Bind(&PostQuitToUIThread)); | 82 base::Bind(&PostQuitToUIThread)); |
| 83 MessageLoop::current()->Run(); | 83 base::MessageLoop::current()->Run(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 MessageLoop message_loop_; | 86 base::MessageLoop message_loop_; |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 chrome::test::TestStorageMonitor monitor_; | 89 chrome::test::TestStorageMonitor monitor_; |
| 90 content::TestBrowserThread ui_thread_; | 90 content::TestBrowserThread ui_thread_; |
| 91 content::TestBrowserThread file_thread_; | 91 content::TestBrowserThread file_thread_; |
| 92 base::ScopedTempDir scoped_temp_dir_; | 92 base::ScopedTempDir scoped_temp_dir_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 // Test to verify that HasDcim() function returns true for the given media | 95 // Test to verify that HasDcim() function returns true for the given media |
| 96 // device mount point. | 96 // device mount point. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 event.Reset(); | 147 event.Reset(); |
| 148 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 148 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 149 base::Bind(&MediaStorageUtil::FilterAttachedDevices, | 149 base::Bind(&MediaStorageUtil::FilterAttachedDevices, |
| 150 base::Unretained(&devices), signal_event)); | 150 base::Unretained(&devices), signal_event)); |
| 151 event.Wait(); | 151 event.Wait(); |
| 152 | 152 |
| 153 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); | 153 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace chrome | 156 } // namespace chrome |
| OLD | NEW |