| 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/in_process_browser_test.h" | 9 #include "chrome/test/in_process_browser_test.h" |
| 10 #include "chrome/test/ui_test_utils.h" | 10 #include "chrome/test/ui_test_utils.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 set_plugin_info_called_(false) { | 27 set_plugin_info_called_(false) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 virtual ~MockPluginProcessHostClient() { | 30 virtual ~MockPluginProcessHostClient() { |
| 31 if (channel_) | 31 if (channel_) |
| 32 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, channel_); | 32 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, channel_); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // Client implementation. | 35 // Client implementation. |
| 36 int ID() { return 42; } | 36 int ID() { return 42; } |
| 37 bool SaveLocalState() { return true; } |
| 37 bool OffTheRecord() { return false; } | 38 bool OffTheRecord() { return false; } |
| 38 | 39 |
| 39 void OnChannelOpened(const IPC::ChannelHandle& handle) { | 40 void OnChannelOpened(const IPC::ChannelHandle& handle) { |
| 40 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 41 ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 41 ASSERT_TRUE(set_plugin_info_called_); | 42 ASSERT_TRUE(set_plugin_info_called_); |
| 42 ASSERT_TRUE(!channel_); | 43 ASSERT_TRUE(!channel_); |
| 43 channel_ = new IPC::Channel(handle, IPC::Channel::MODE_CLIENT, this); | 44 channel_ = new IPC::Channel(handle, IPC::Channel::MODE_CLIENT, this); |
| 44 ASSERT_TRUE(channel_->Connect()); | 45 ASSERT_TRUE(channel_->Connect()); |
| 45 } | 46 } |
| 46 | 47 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 // Try to open a channel to the test plugin. Minimal plugin process spawning | 88 // Try to open a channel to the test plugin. Minimal plugin process spawning |
| 88 // test for the PluginService interface. | 89 // test for the PluginService interface. |
| 89 IN_PROC_BROWSER_TEST_F(PluginServiceTest, OpenChannelToPlugin) { | 90 IN_PROC_BROWSER_TEST_F(PluginServiceTest, OpenChannelToPlugin) { |
| 90 MockPluginProcessHostClient mock_client; | 91 MockPluginProcessHostClient mock_client; |
| 91 PluginService::GetInstance()->OpenChannelToNpapiPlugin( | 92 PluginService::GetInstance()->OpenChannelToNpapiPlugin( |
| 92 0, 0, GURL(), kNPAPITestPluginMimeType, &mock_client); | 93 0, 0, GURL(), kNPAPITestPluginMimeType, &mock_client); |
| 93 ui_test_utils::RunMessageLoop(); | 94 ui_test_utils::RunMessageLoop(); |
| 94 } | 95 } |
| OLD | NEW |