| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/stringprintf.h" | 5 #include "base/stringprintf.h" |
| 6 #include "base/system_monitor/system_monitor.h" | |
| 7 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_
private_api.h" | 7 #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_
private_api.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
| 12 #include "chrome/browser/extensions/extension_test_message_listener.h" | 11 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 13 #include "chrome/browser/system_monitor/media_storage_util.h" | 12 #include "chrome/browser/system_monitor/media_storage_util.h" |
| 13 #include "chrome/browser/system_monitor/removable_storage_notifications.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
| 18 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(js_command)); | 79 host->ExecuteJavascriptInWebFrame(string16(), ASCIIToUTF16(js_command)); |
| 80 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 80 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void AttachDetach() { | 83 void AttachDetach() { |
| 84 Attach(); | 84 Attach(); |
| 85 Detach(); | 85 Detach(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void Attach() { | 88 void Attach() { |
| 89 base::SystemMonitor::Get()->ProcessRemovableStorageAttached( | 89 chrome::RemovableStorageNotifications::GetInstance()->ProcessAttach( |
| 90 device_id_, ASCIIToUTF16(kDeviceName), kDevicePath); | 90 device_id_, ASCIIToUTF16(kDeviceName), kDevicePath); |
| 91 WaitForDeviceEvents(); | 91 WaitForDeviceEvents(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void Detach() { | 94 void Detach() { |
| 95 base::SystemMonitor::Get()->ProcessRemovableStorageDetached(device_id_); | 95 chrome::RemovableStorageNotifications::GetInstance()->ProcessDetach( |
| 96 device_id_); |
| 96 WaitForDeviceEvents(); | 97 WaitForDeviceEvents(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 private: | 100 private: |
| 100 void WaitForDeviceEvents() { | 101 void WaitForDeviceEvents() { |
| 101 content::RunAllPendingInMessageLoop(); | 102 content::RunAllPendingInMessageLoop(); |
| 102 } | 103 } |
| 103 | 104 |
| 104 std::string device_id_; | 105 std::string device_id_; |
| 105 | 106 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 Attach(); | 175 Attach(); |
| 175 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); | 176 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); |
| 176 Detach(); | 177 Detach(); |
| 177 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); | 178 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); |
| 178 | 179 |
| 179 Attach(); | 180 Attach(); |
| 180 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); | 181 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); |
| 181 Detach(); | 182 Detach(); |
| 182 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); | 183 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); |
| 183 } | 184 } |
| OLD | NEW |