OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/api/system_storage/storage_info_provider.h" | 8 #include "chrome/browser/extensions/api/system_storage/storage_info_provider.h" |
9 #include "chrome/browser/extensions/api/system_storage/test_storage_info_provide
r.h" | 9 #include "chrome/browser/extensions/api/system_storage/test_storage_info_provide
r.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
11 #include "chrome/browser/extensions/extension_test_message_listener.h" | 11 #include "chrome/browser/extensions/extension_test_message_listener.h" |
12 #include "chrome/browser/storage_monitor/storage_info.h" | 12 #include "chrome/browser/storage_monitor/storage_info.h" |
13 #include "chrome/browser/storage_monitor/storage_monitor.h" | 13 #include "chrome/browser/storage_monitor/storage_monitor.h" |
14 #include "chrome/common/chrome_switches.h" | |
15 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "extensions/common/switches.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 using chrome::StorageMonitor; | 19 using chrome::StorageMonitor; |
20 using extensions::api::system_storage::ParseStorageUnitType; | 20 using extensions::api::system_storage::ParseStorageUnitType; |
21 using extensions::api::system_storage::StorageUnitInfo; | 21 using extensions::api::system_storage::StorageUnitInfo; |
22 using extensions::StorageInfoProvider; | 22 using extensions::StorageInfoProvider; |
23 using extensions::StorageUnitInfoList; | 23 using extensions::StorageUnitInfoList; |
24 using extensions::systeminfo::kStorageTypeFixed; | 24 using extensions::systeminfo::kStorageTypeFixed; |
25 using extensions::systeminfo::kStorageTypeRemovable; | 25 using extensions::systeminfo::kStorageTypeRemovable; |
(...skipping 17 matching lines...) Expand all Loading... |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 class SystemStorageApiTest : public ExtensionApiTest { | 46 class SystemStorageApiTest : public ExtensionApiTest { |
47 public: | 47 public: |
48 SystemStorageApiTest() {} | 48 SystemStorageApiTest() {} |
49 virtual ~SystemStorageApiTest() {} | 49 virtual ~SystemStorageApiTest() {} |
50 | 50 |
51 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 51 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
52 ExtensionApiTest::SetUpCommandLine(command_line); | 52 ExtensionApiTest::SetUpCommandLine(command_line); |
53 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 53 command_line->AppendSwitch( |
| 54 extensions::switches::kEnableExperimentalExtensionApis); |
54 } | 55 } |
55 | 56 |
56 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 57 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
57 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 58 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
58 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); | 59 message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); |
59 } | 60 } |
60 | 61 |
61 void AttachRemovableStorage(const std::string& device_id) { | 62 void AttachRemovableStorage(const std::string& device_id) { |
62 for (size_t i = 0; i < arraysize(kRemovableStorageData); ++i) { | 63 for (size_t i = 0; i < arraysize(kRemovableStorageData); ++i) { |
63 if (kRemovableStorageData[i].device_id != device_id) | 64 if (kRemovableStorageData[i].device_id != device_id) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 99 |
99 // Simulate triggering onAttached event. | 100 // Simulate triggering onAttached event. |
100 ASSERT_TRUE(attach_listener.WaitUntilSatisfied()); | 101 ASSERT_TRUE(attach_listener.WaitUntilSatisfied()); |
101 AttachRemovableStorage(kRemovableStorageData[0].device_id); | 102 AttachRemovableStorage(kRemovableStorageData[0].device_id); |
102 // Simulate triggering onDetached event. | 103 // Simulate triggering onDetached event. |
103 ASSERT_TRUE(detach_listener.WaitUntilSatisfied()); | 104 ASSERT_TRUE(detach_listener.WaitUntilSatisfied()); |
104 DetachRemovableStorage(kRemovableStorageData[0].device_id); | 105 DetachRemovableStorage(kRemovableStorageData[0].device_id); |
105 | 106 |
106 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 107 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
107 } | 108 } |
OLD | NEW |