| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 virtual void SetUp() OVERRIDE { | 67 virtual void SetUp() OVERRIDE { |
| 68 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); | 68 ASSERT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); |
| 69 file_thread_.Start(); | 69 file_thread_.Start(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 virtual void TearDown() { | 72 virtual void TearDown() { |
| 73 WaitForFileThread(); | 73 WaitForFileThread(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 static void PostQuitToUIThread() { | 76 static void PostQuitToUIThread() { |
| 77 BrowserThread::PostTask(BrowserThread::UI, | 77 BrowserThread::PostTask( |
| 78 FROM_HERE, | 78 BrowserThread::UI, FROM_HERE, base::MessageLoop::QuitClosure()); |
| 79 MessageLoop::QuitClosure()); | |
| 80 } | 79 } |
| 81 | 80 |
| 82 static void WaitForFileThread() { | 81 static void WaitForFileThread() { |
| 83 BrowserThread::PostTask(BrowserThread::FILE, | 82 BrowserThread::PostTask(BrowserThread::FILE, |
| 84 FROM_HERE, | 83 FROM_HERE, |
| 85 base::Bind(&PostQuitToUIThread)); | 84 base::Bind(&PostQuitToUIThread)); |
| 86 MessageLoop::current()->Run(); | 85 base::MessageLoop::current()->Run(); |
| 87 } | 86 } |
| 88 | 87 |
| 89 MessageLoop message_loop_; | 88 base::MessageLoop message_loop_; |
| 90 | 89 |
| 91 private: | 90 private: |
| 92 chrome::test::TestStorageMonitor monitor_; | 91 chrome::test::TestStorageMonitor monitor_; |
| 93 content::TestBrowserThread ui_thread_; | 92 content::TestBrowserThread ui_thread_; |
| 94 content::TestBrowserThread file_thread_; | 93 content::TestBrowserThread file_thread_; |
| 95 base::ScopedTempDir scoped_temp_dir_; | 94 base::ScopedTempDir scoped_temp_dir_; |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 // Test to verify that HasDcim() function returns true for the given media | 97 // Test to verify that HasDcim() function returns true for the given media |
| 99 // device mount point. | 98 // device mount point. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 event.Reset(); | 176 event.Reset(); |
| 178 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 177 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 179 base::Bind(&MediaStorageUtil::FilterAttachedDevices, | 178 base::Bind(&MediaStorageUtil::FilterAttachedDevices, |
| 180 base::Unretained(&devices), signal_event)); | 179 base::Unretained(&devices), signal_event)); |
| 181 event.Wait(); | 180 event.Wait(); |
| 182 | 181 |
| 183 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); | 182 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); |
| 184 } | 183 } |
| 185 | 184 |
| 186 } // namespace chrome | 185 } // namespace chrome |
| OLD | NEW |