Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: components/storage_monitor/storage_monitor_linux_unittest.cc

Issue 2358493002: Remove MTP support on Linux. (Closed)
Patch Set: move files Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // StorageMonitorLinux unit tests. 5 // StorageMonitorLinux unit tests.
6 6
7 #include "components/storage_monitor/storage_monitor_linux.h" 7 #include "components/storage_monitor/storage_monitor_linux.h"
8 8
9 #include <mntent.h> 9 #include <mntent.h>
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 #include <stdio.h> 12 #include <stdio.h>
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 16
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/files/scoped_temp_dir.h" 18 #include "base/files/scoped_temp_dir.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/run_loop.h" 21 #include "base/run_loop.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/threading/thread_task_runner_handle.h" 23 #include "base/threading/thread_task_runner_handle.h"
24 #include "components/storage_monitor/mock_removable_storage_observer.h" 24 #include "components/storage_monitor/mock_removable_storage_observer.h"
25 #include "components/storage_monitor/removable_device_constants.h" 25 #include "components/storage_monitor/removable_device_constants.h"
26 #include "components/storage_monitor/storage_info.h" 26 #include "components/storage_monitor/storage_info.h"
27 #include "components/storage_monitor/storage_monitor.h" 27 #include "components/storage_monitor/storage_monitor.h"
28 #include "components/storage_monitor/test_media_transfer_protocol_manager_linux. h"
29 #include "components/storage_monitor/test_storage_monitor.h" 28 #include "components/storage_monitor/test_storage_monitor.h"
30 #include "content/public/test/test_browser_thread_bundle.h" 29 #include "content/public/test/test_browser_thread_bundle.h"
31 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
32 31
33 namespace storage_monitor { 32 namespace storage_monitor {
34 33
35 namespace { 34 namespace {
36 35
37 const char kValidFS[] = "vfat"; 36 const char kValidFS[] = "vfat";
38 const char kInvalidFS[] = "invalidfs"; 37 const char kInvalidFS[] = "invalidfs";
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE, 118 return StorageInfo::MakeDeviceId(StorageInfo::FIXED_MASS_STORAGE,
120 kInvalidDevice); 119 kInvalidDevice);
121 } 120 }
122 return std::string(); 121 return std::string();
123 } 122 }
124 123
125 class TestStorageMonitorLinux : public StorageMonitorLinux { 124 class TestStorageMonitorLinux : public StorageMonitorLinux {
126 public: 125 public:
127 explicit TestStorageMonitorLinux(const base::FilePath& path) 126 explicit TestStorageMonitorLinux(const base::FilePath& path)
128 : StorageMonitorLinux(path) { 127 : StorageMonitorLinux(path) {
129 SetMediaTransferProtocolManagerForTest(
130 new TestMediaTransferProtocolManagerLinux());
131 SetGetDeviceInfoCallbackForTest(base::Bind(&GetDeviceInfo)); 128 SetGetDeviceInfoCallbackForTest(base::Bind(&GetDeviceInfo));
132 } 129 }
133 ~TestStorageMonitorLinux() override {} 130 ~TestStorageMonitorLinux() override {}
134 131
135 private: 132 private:
136 void UpdateMtab( 133 void UpdateMtab(
137 const MtabWatcherLinux::MountPointDeviceMap& new_mtab) override { 134 const MtabWatcherLinux::MountPointDeviceMap& new_mtab) override {
138 StorageMonitorLinux::UpdateMtab(new_mtab); 135 StorageMonitorLinux::UpdateMtab(new_mtab);
139 base::ThreadTaskRunnerHandle::Get()->PostTask( 136 base::ThreadTaskRunnerHandle::Get()->PostTask(
140 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 137 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 GetStorageSize(test_path_a)); 678 GetStorageSize(test_path_a));
682 EXPECT_EQ(GetDevicePartitionSize(kDeviceNoDCIM), 679 EXPECT_EQ(GetDevicePartitionSize(kDeviceNoDCIM),
683 GetStorageSize(test_path_b)); 680 GetStorageSize(test_path_b));
684 EXPECT_EQ(GetDevicePartitionSize(kInvalidPath), 681 EXPECT_EQ(GetDevicePartitionSize(kInvalidPath),
685 GetStorageSize(base::FilePath(kInvalidPath))); 682 GetStorageSize(base::FilePath(kInvalidPath)));
686 } 683 }
687 684
688 } // namespace 685 } // namespace
689 686
690 } // namespace storage_monitor 687 } // namespace storage_monitor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698