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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/api/system_storage/storage_api_test_util.h" | 9 #include "chrome/browser/extensions/api/system_storage/storage_api_test_util.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 class TestStorageInfoProvider : public extensions::StorageInfoProvider { | 33 class TestStorageInfoProvider : public extensions::StorageInfoProvider { |
34 public: | 34 public: |
35 TestStorageInfoProvider(const struct TestStorageUnitInfo* testing_data, | 35 TestStorageInfoProvider(const struct TestStorageUnitInfo* testing_data, |
36 size_t n); | 36 size_t n); |
37 | 37 |
38 private: | 38 private: |
39 virtual ~TestStorageInfoProvider(); | 39 virtual ~TestStorageInfoProvider(); |
40 | 40 |
41 // StorageInfoProvider implementations. | 41 // StorageInfoProvider implementations. |
42 virtual double GetStorageFreeSpaceFromTransientIdOnFileThread( | 42 virtual double GetStorageFreeSpaceFromTransientIdOnFileThread( |
43 const std::string& transient_id) OVERRIDE; | 43 const std::string& transient_id) override; |
44 | 44 |
45 std::vector<struct TestStorageUnitInfo> testing_data_; | 45 std::vector<struct TestStorageUnitInfo> testing_data_; |
46 }; | 46 }; |
47 | 47 |
48 TestStorageInfoProvider::TestStorageInfoProvider( | 48 TestStorageInfoProvider::TestStorageInfoProvider( |
49 const struct TestStorageUnitInfo* testing_data, size_t n) | 49 const struct TestStorageUnitInfo* testing_data, size_t n) |
50 : testing_data_(testing_data, testing_data + n) { | 50 : testing_data_(testing_data, testing_data + n) { |
51 } | 51 } |
52 | 52 |
53 TestStorageInfoProvider::~TestStorageInfoProvider() { | 53 TestStorageInfoProvider::~TestStorageInfoProvider() { |
(...skipping 10 matching lines...) Expand all Loading... |
64 } | 64 } |
65 } | 65 } |
66 return -1; | 66 return -1; |
67 } | 67 } |
68 | 68 |
69 class SystemStorageApiTest : public ExtensionApiTest { | 69 class SystemStorageApiTest : public ExtensionApiTest { |
70 public: | 70 public: |
71 SystemStorageApiTest() {} | 71 SystemStorageApiTest() {} |
72 virtual ~SystemStorageApiTest() {} | 72 virtual ~SystemStorageApiTest() {} |
73 | 73 |
74 virtual void SetUpOnMainThread() OVERRIDE { | 74 virtual void SetUpOnMainThread() override { |
75 TestStorageMonitor::CreateForBrowserTests(); | 75 TestStorageMonitor::CreateForBrowserTests(); |
76 } | 76 } |
77 | 77 |
78 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 78 virtual void SetUpInProcessBrowserTestFixture() override { |
79 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 79 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
80 message_loop_.reset(new base::MessageLoopForUI); | 80 message_loop_.reset(new base::MessageLoopForUI); |
81 } | 81 } |
82 | 82 |
83 void SetUpAllMockStorageDevices() { | 83 void SetUpAllMockStorageDevices() { |
84 for (size_t i = 0; i < arraysize(kTestingData); ++i) { | 84 for (size_t i = 0; i < arraysize(kTestingData); ++i) { |
85 AttachRemovableStorage(kTestingData[i]); | 85 AttachRemovableStorage(kTestingData[i]); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 removable_storage_transient_id, false); | 140 removable_storage_transient_id, false); |
141 | 141 |
142 // Simulate triggering onDetached event. | 142 // Simulate triggering onDetached event. |
143 ASSERT_TRUE(detach_listener.WaitUntilSatisfied()); | 143 ASSERT_TRUE(detach_listener.WaitUntilSatisfied()); |
144 DetachRemovableStorage(kRemovableStorageData.device_id); | 144 DetachRemovableStorage(kRemovableStorageData.device_id); |
145 | 145 |
146 ASSERT_TRUE(detach_device_id_listener.WaitUntilSatisfied()); | 146 ASSERT_TRUE(detach_device_id_listener.WaitUntilSatisfied()); |
147 | 147 |
148 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 148 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
149 } | 149 } |
OLD | NEW |