| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/plugin_service.h" | 5 #include "content/browser/plugin_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 bool OffTheRecord() { return false; } | 37 bool OffTheRecord() { return false; } |
| 38 | 38 |
| 39 void OnChannelOpened(const IPC::ChannelHandle& handle) { | 39 void OnChannelOpened(const IPC::ChannelHandle& handle) { |
| 40 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 40 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 41 ASSERT_TRUE(set_plugin_info_called_); | 41 ASSERT_TRUE(set_plugin_info_called_); |
| 42 ASSERT_TRUE(!channel_); | 42 ASSERT_TRUE(!channel_); |
| 43 channel_ = new IPC::Channel(handle, IPC::Channel::MODE_CLIENT, this); | 43 channel_ = new IPC::Channel(handle, IPC::Channel::MODE_CLIENT, this); |
| 44 ASSERT_TRUE(channel_->Connect()); | 44 ASSERT_TRUE(channel_->Connect()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void SetPluginInfo(const webkit::npapi::WebPluginInfo& info) { | 47 void SetPluginInfo(const webkit::WebPluginInfo& info) { |
| 48 ASSERT_TRUE(info.mime_types.size()); | 48 ASSERT_TRUE(info.mime_types.size()); |
| 49 ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); | 49 ASSERT_EQ(kNPAPITestPluginMimeType, info.mime_types[0].mime_type); |
| 50 set_plugin_info_called_ = true; | 50 set_plugin_info_called_ = true; |
| 51 } | 51 } |
| 52 | 52 |
| 53 MOCK_METHOD0(OnError, void()); | 53 MOCK_METHOD0(OnError, void()); |
| 54 | 54 |
| 55 // Listener implementation. | 55 // Listener implementation. |
| 56 MOCK_METHOD1(OnMessageReceived, bool(const IPC::Message& message)); | 56 MOCK_METHOD1(OnMessageReceived, bool(const IPC::Message& message)); |
| 57 void OnChannelConnected(int32 peer_pid) { | 57 void OnChannelConnected(int32 peer_pid) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 // Try to open a channel to the test plugin. Minimal plugin process spawning | 87 // Try to open a channel to the test plugin. Minimal plugin process spawning |
| 88 // test for the PluginService interface. | 88 // test for the PluginService interface. |
| 89 IN_PROC_BROWSER_TEST_F(PluginServiceTest, OpenChannelToPlugin) { | 89 IN_PROC_BROWSER_TEST_F(PluginServiceTest, OpenChannelToPlugin) { |
| 90 MockPluginProcessHostClient mock_client; | 90 MockPluginProcessHostClient mock_client; |
| 91 PluginService::GetInstance()->OpenChannelToNpapiPlugin( | 91 PluginService::GetInstance()->OpenChannelToNpapiPlugin( |
| 92 0, 0, GURL(), kNPAPITestPluginMimeType, &mock_client); | 92 0, 0, GURL(), kNPAPITestPluginMimeType, &mock_client); |
| 93 ui_test_utils::RunMessageLoop(); | 93 ui_test_utils::RunMessageLoop(); |
| 94 } | 94 } |
| OLD | NEW |