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 "components/storage_monitor/storage_monitor_mac.h" | 5 #include "components/storage_monitor/storage_monitor_mac.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
8 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
10 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
11 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
12 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
14 #include "components/storage_monitor/mock_removable_storage_observer.h" | 16 #include "components/storage_monitor/mock_removable_storage_observer.h" |
15 #include "components/storage_monitor/removable_device_constants.h" | 17 #include "components/storage_monitor/removable_device_constants.h" |
16 #include "components/storage_monitor/storage_info.h" | 18 #include "components/storage_monitor/storage_info.h" |
17 #include "components/storage_monitor/test_storage_monitor.h" | 19 #include "components/storage_monitor/test_storage_monitor.h" |
18 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/test/test_browser_thread_bundle.h" | 21 #include "content/public/test/test_browser_thread_bundle.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
21 | 23 |
22 uint64 kTestSize = 1000000ULL; | 24 uint64_t kTestSize = 1000000ULL; |
23 | 25 |
24 namespace storage_monitor { | 26 namespace storage_monitor { |
25 | 27 |
26 namespace { | 28 namespace { |
27 | 29 |
28 StorageInfo CreateStorageInfo( | 30 StorageInfo CreateStorageInfo(const std::string& device_id, |
29 const std::string& device_id, | 31 const std::string& model_name, |
30 const std::string& model_name, | 32 const base::FilePath& mount_point, |
31 const base::FilePath& mount_point, | 33 uint64_t size_bytes) { |
32 uint64 size_bytes) { | |
33 return StorageInfo( | 34 return StorageInfo( |
34 device_id, mount_point.value(), base::string16(), base::string16(), | 35 device_id, mount_point.value(), base::string16(), base::string16(), |
35 base::UTF8ToUTF16(model_name), size_bytes); | 36 base::UTF8ToUTF16(model_name), size_bytes); |
36 } | 37 } |
37 | 38 |
38 } // namespace | 39 } // namespace |
39 | 40 |
40 class StorageMonitorMacTest : public testing::Test { | 41 class StorageMonitorMacTest : public testing::Test { |
41 public: | 42 public: |
42 StorageMonitorMacTest() {} | 43 StorageMonitorMacTest() {} |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 162 |
162 // Test that mounting a DMG doesn't send a notification. | 163 // Test that mounting a DMG doesn't send a notification. |
163 TEST_F(StorageMonitorMacTest, DMG) { | 164 TEST_F(StorageMonitorMacTest, DMG) { |
164 StorageInfo info = CreateStorageInfo( | 165 StorageInfo info = CreateStorageInfo( |
165 device_id_, "Disk Image", mount_point_, kTestSize); | 166 device_id_, "Disk Image", mount_point_, kTestSize); |
166 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); | 167 UpdateDisk(info, StorageMonitorMac::UPDATE_DEVICE_ADDED); |
167 EXPECT_EQ(0, mock_storage_observer_->attach_calls()); | 168 EXPECT_EQ(0, mock_storage_observer_->attach_calls()); |
168 } | 169 } |
169 | 170 |
170 } // namespace storage_monitor | 171 } // namespace storage_monitor |
OLD | NEW |