| 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/system_monitor/media_storage_util.h" | 10 #include "chrome/browser/system_monitor/media_storage_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const char kUniqueId[] = "VendorModelSerial:ABC:1233:1237912873"; | 23 const char kUniqueId[] = "VendorModelSerial:ABC:1233:1237912873"; |
| 24 const char kImageCaptureDeviceId[] = "ic:xyz"; | 24 const char kImageCaptureDeviceId[] = "ic:xyz"; |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 class MediaStorageUtilTest : public testing::Test { | 28 class MediaStorageUtilTest : public testing::Test { |
| 29 public: | 29 public: |
| 30 void ProcessAttach(const std::string& id, | 30 void ProcessAttach(const std::string& id, |
| 31 const string16& name, | 31 const string16& name, |
| 32 const base::FilePath::StringType& location) { | 32 const base::FilePath::StringType& location) { |
| 33 RemovableStorageNotifications::GetInstance()->ProcessAttach( | 33 notifications_.ProcessAttach(id, name, location); |
| 34 id, name, location); | |
| 35 } | 34 } |
| 36 | 35 |
| 37 private: | 36 private: |
| 38 chrome::test::TestRemovableStorageNotifications notifications_; | 37 chrome::test::TestRemovableStorageNotifications notifications_; |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 // Test to verify |MediaStorageUtil::MakeDeviceId| functionality using a sample | 40 // Test to verify |MediaStorageUtil::MakeDeviceId| functionality using a sample |
| 42 // mtp device unique id. | 41 // mtp device unique id. |
| 43 TEST_F(MediaStorageUtilTest, MakeMtpDeviceId) { | 42 TEST_F(MediaStorageUtilTest, MakeMtpDeviceId) { |
| 44 std::string device_id = | 43 std::string device_id = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 event.Reset(); | 93 event.Reset(); |
| 95 MediaStorageUtil::FilterAttachedDevices(&devices, | 94 MediaStorageUtil::FilterAttachedDevices(&devices, |
| 96 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event))); | 95 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event))); |
| 97 loop.RunUntilIdle(); | 96 loop.RunUntilIdle(); |
| 98 event.Wait(); | 97 event.Wait(); |
| 99 | 98 |
| 100 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); | 99 EXPECT_TRUE(devices.find(kImageCaptureDeviceId) != devices.end()); |
| 101 } | 100 } |
| 102 | 101 |
| 103 } // namespace chrome | 102 } // namespace chrome |
| OLD | NEW |