| 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" | 6 #include "base/system_monitor/system_monitor.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_
private_api.h" | 8 #include "chrome/browser/extensions/api/media_galleries_private/media_galleries_
private_api.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_system.h" |
| 11 #include "chrome/browser/extensions/extension_test_message_listener.h" | 12 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 12 #include "chrome/browser/system_monitor/media_storage_util.h" | 13 #include "chrome/browser/system_monitor/media_storage_util.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
| 17 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 18 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 19 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
| 20 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPrivateApiTest); | 106 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPrivateApiTest); |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateApiTest, DeviceAttachDetachEvents) { | 109 IN_PROC_BROWSER_TEST_F(MediaGalleriesPrivateApiTest, DeviceAttachDetachEvents) { |
| 109 // Setup. | 110 // Setup. |
| 110 const extensions::Extension* extension = | 111 const extensions::Extension* extension = |
| 111 LoadExtension(test_data_dir_.AppendASCII(kTestExtensionPath)); | 112 LoadExtension(test_data_dir_.AppendASCII(kTestExtensionPath)); |
| 112 ASSERT_TRUE(extension); | 113 ASSERT_TRUE(extension); |
| 113 | 114 |
| 114 content::RenderViewHost* host = | 115 content::RenderViewHost* host = |
| 115 browser()->profile()->GetExtensionProcessManager()-> | 116 extensions::ExtensionSystem::Get(browser()->profile())-> |
| 116 GetBackgroundHostForExtension(extension->id())->render_view_host(); | 117 process_manager()->GetBackgroundHostForExtension(extension->id())-> |
| 118 render_view_host(); |
| 117 ASSERT_TRUE(host); | 119 ASSERT_TRUE(host); |
| 118 | 120 |
| 119 // No listeners, attach and detach a couple times. | 121 // No listeners, attach and detach a couple times. |
| 120 AttachDetach(); | 122 AttachDetach(); |
| 121 AttachDetach(); | 123 AttachDetach(); |
| 122 | 124 |
| 123 // Add attach listener. | 125 // Add attach listener. |
| 124 ChangeListener(host, kAddAttachListenerCmd, kAddAttachListenerOk); | 126 ChangeListener(host, kAddAttachListenerCmd, kAddAttachListenerOk); |
| 125 | 127 |
| 126 // Attach / detach | 128 // Attach / detach |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 Attach(); | 174 Attach(); |
| 173 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); | 175 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); |
| 174 Detach(); | 176 Detach(); |
| 175 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); | 177 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); |
| 176 | 178 |
| 177 Attach(); | 179 Attach(); |
| 178 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); | 180 EXPECT_TRUE(attach_finished_listener.WaitUntilSatisfied()); |
| 179 Detach(); | 181 Detach(); |
| 180 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); | 182 EXPECT_TRUE(detach_finished_listener.WaitUntilSatisfied()); |
| 181 } | 183 } |
| OLD | NEW |