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

Side by Side Diff: extensions/browser/api/system_storage/system_storage_apitest.cc

Issue 2294653002: Some linked_ptr -> unique_ptr conversion in extensions/browser. (Closed)
Patch Set: address comments Created 4 years, 3 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
« no previous file with comments | « extensions/browser/api/storage/settings_test_util.h ('k') | extensions/browser/blob_holder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "components/storage_monitor/storage_monitor.h" 13 #include "components/storage_monitor/storage_monitor.h"
14 #include "components/storage_monitor/test_storage_monitor.h" 14 #include "components/storage_monitor/test_storage_monitor.h"
15 #include "extensions/browser/api/system_storage/storage_api_test_util.h" 15 #include "extensions/browser/api/system_storage/storage_api_test_util.h"
16 #include "extensions/browser/api/system_storage/storage_info_provider.h" 16 #include "extensions/browser/api/system_storage/storage_info_provider.h"
17 #include "extensions/shell/test/shell_apitest.h" 17 #include "extensions/shell/test/shell_apitest.h"
18 #include "extensions/test/extension_test_message_listener.h" 18 #include "extensions/test/extension_test_message_listener.h"
19 #include "extensions/test/result_catcher.h" 19 #include "extensions/test/result_catcher.h"
20 20
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 private: 104 private:
105 std::unique_ptr<base::MessageLoop> message_loop_; 105 std::unique_ptr<base::MessageLoop> message_loop_;
106 }; 106 };
107 107
108 IN_PROC_BROWSER_TEST_F(SystemStorageApiTest, Storage) { 108 IN_PROC_BROWSER_TEST_F(SystemStorageApiTest, Storage) {
109 SetUpAllMockStorageDevices(); 109 SetUpAllMockStorageDevices();
110 TestStorageInfoProvider* provider = 110 TestStorageInfoProvider* provider =
111 new TestStorageInfoProvider(kTestingData, arraysize(kTestingData)); 111 new TestStorageInfoProvider(kTestingData, arraysize(kTestingData));
112 extensions::StorageInfoProvider::InitializeForTesting(provider); 112 extensions::StorageInfoProvider::InitializeForTesting(provider);
113 std::vector<linked_ptr<ExtensionTestMessageListener>> device_ids_listeners; 113 std::vector<std::unique_ptr<ExtensionTestMessageListener>>
114 device_ids_listeners;
114 for (size_t i = 0; i < arraysize(kTestingData); ++i) { 115 for (size_t i = 0; i < arraysize(kTestingData); ++i) {
115 linked_ptr<ExtensionTestMessageListener> listener( 116 device_ids_listeners.push_back(
116 new ExtensionTestMessageListener( 117 base::MakeUnique<ExtensionTestMessageListener>(
117 StorageMonitor::GetInstance()->GetTransientIdForDeviceId( 118 StorageMonitor::GetInstance()->GetTransientIdForDeviceId(
118 kTestingData[i].device_id), 119 kTestingData[i].device_id),
119 false)); 120 false));
120 device_ids_listeners.push_back(listener);
121 } 121 }
122 ASSERT_TRUE(RunAppTest("system/storage")) << message_; 122 ASSERT_TRUE(RunAppTest("system/storage")) << message_;
123 for (size_t i = 0; i < device_ids_listeners.size(); ++i) 123 for (size_t i = 0; i < device_ids_listeners.size(); ++i)
124 EXPECT_TRUE(device_ids_listeners[i]->WaitUntilSatisfied()); 124 EXPECT_TRUE(device_ids_listeners[i]->WaitUntilSatisfied());
125 } 125 }
126 126
127 IN_PROC_BROWSER_TEST_F(SystemStorageApiTest, StorageAttachment) { 127 IN_PROC_BROWSER_TEST_F(SystemStorageApiTest, StorageAttachment) {
128 extensions::ResultCatcher catcher; 128 extensions::ResultCatcher catcher;
129 ExtensionTestMessageListener attach_listener("attach", false); 129 ExtensionTestMessageListener attach_listener("attach", false);
130 ExtensionTestMessageListener detach_listener("detach", false); 130 ExtensionTestMessageListener detach_listener("detach", false);
(...skipping 11 matching lines...) Expand all
142 removable_storage_transient_id, false); 142 removable_storage_transient_id, false);
143 143
144 // Simulate triggering onDetached event. 144 // Simulate triggering onDetached event.
145 ASSERT_TRUE(detach_listener.WaitUntilSatisfied()); 145 ASSERT_TRUE(detach_listener.WaitUntilSatisfied());
146 DetachRemovableStorage(kRemovableStorageData.device_id); 146 DetachRemovableStorage(kRemovableStorageData.device_id);
147 147
148 ASSERT_TRUE(detach_device_id_listener.WaitUntilSatisfied()); 148 ASSERT_TRUE(detach_device_id_listener.WaitUntilSatisfied());
149 149
150 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 150 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
151 } 151 }
OLDNEW
« no previous file with comments | « extensions/browser/api/storage/settings_test_util.h ('k') | extensions/browser/blob_holder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698