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

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

Issue 555633003: Use extensions::ResultCatcher; delete ExtensionApiTest::ResultCatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 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
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 <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"
11 #include "chrome/browser/extensions/extension_test_message_listener.h" 11 #include "chrome/browser/extensions/extension_test_message_listener.h"
12 #include "components/storage_monitor/storage_monitor.h" 12 #include "components/storage_monitor/storage_monitor.h"
13 #include "components/storage_monitor/test_storage_monitor.h" 13 #include "components/storage_monitor/test_storage_monitor.h"
14 #include "extensions/browser/api/system_storage/storage_info_provider.h" 14 #include "extensions/browser/api/system_storage/storage_info_provider.h"
15 #include "extensions/test/result_catcher.h"
15 16
16 namespace { 17 namespace {
17 18
18 using extensions::StorageUnitInfoList; 19 using extensions::StorageUnitInfoList;
19 using extensions::test::TestStorageUnitInfo; 20 using extensions::test::TestStorageUnitInfo;
20 using extensions::test::kRemovableStorageData; 21 using extensions::test::kRemovableStorageData;
21 using storage_monitor::StorageMonitor; 22 using storage_monitor::StorageMonitor;
22 using storage_monitor::TestStorageMonitor; 23 using storage_monitor::TestStorageMonitor;
23 24
24 const struct TestStorageUnitInfo kTestingData[] = { 25 const struct TestStorageUnitInfo kTestingData[] = {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 kTestingData[i].device_id), 115 kTestingData[i].device_id),
115 false)); 116 false));
116 device_ids_listeners.push_back(listener); 117 device_ids_listeners.push_back(listener);
117 } 118 }
118 ASSERT_TRUE(RunPlatformAppTest("system/storage")) << message_; 119 ASSERT_TRUE(RunPlatformAppTest("system/storage")) << message_;
119 for (size_t i = 0; i < device_ids_listeners.size(); ++i) 120 for (size_t i = 0; i < device_ids_listeners.size(); ++i)
120 EXPECT_TRUE(device_ids_listeners[i]->WaitUntilSatisfied()); 121 EXPECT_TRUE(device_ids_listeners[i]->WaitUntilSatisfied());
121 } 122 }
122 123
123 IN_PROC_BROWSER_TEST_F(SystemStorageApiTest, StorageAttachment) { 124 IN_PROC_BROWSER_TEST_F(SystemStorageApiTest, StorageAttachment) {
124 ResultCatcher catcher; 125 extensions::ResultCatcher catcher;
125 ExtensionTestMessageListener attach_listener("attach", false); 126 ExtensionTestMessageListener attach_listener("attach", false);
126 ExtensionTestMessageListener detach_listener("detach", false); 127 ExtensionTestMessageListener detach_listener("detach", false);
127 128
128 EXPECT_TRUE(LoadExtension( 129 EXPECT_TRUE(LoadExtension(
129 test_data_dir_.AppendASCII("system/storage_attachment"))); 130 test_data_dir_.AppendASCII("system/storage_attachment")));
130 // Simulate triggering onAttached event. 131 // Simulate triggering onAttached event.
131 ASSERT_TRUE(attach_listener.WaitUntilSatisfied()); 132 ASSERT_TRUE(attach_listener.WaitUntilSatisfied());
132 133
133 AttachRemovableStorage(kRemovableStorageData); 134 AttachRemovableStorage(kRemovableStorageData);
134 135
135 std::string removable_storage_transient_id = 136 std::string removable_storage_transient_id =
136 StorageMonitor::GetInstance()->GetTransientIdForDeviceId( 137 StorageMonitor::GetInstance()->GetTransientIdForDeviceId(
137 kRemovableStorageData.device_id); 138 kRemovableStorageData.device_id);
138 ExtensionTestMessageListener detach_device_id_listener( 139 ExtensionTestMessageListener detach_device_id_listener(
139 removable_storage_transient_id, false); 140 removable_storage_transient_id, false);
140 141
141 // Simulate triggering onDetached event. 142 // Simulate triggering onDetached event.
142 ASSERT_TRUE(detach_listener.WaitUntilSatisfied()); 143 ASSERT_TRUE(detach_listener.WaitUntilSatisfied());
143 DetachRemovableStorage(kRemovableStorageData.device_id); 144 DetachRemovableStorage(kRemovableStorageData.device_id);
144 145
145 ASSERT_TRUE(detach_device_id_listener.WaitUntilSatisfied()); 146 ASSERT_TRUE(detach_device_id_listener.WaitUntilSatisfied());
146 147
147 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 148 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
148 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698