OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/renderer/pepper_plugin_delegate_impl.h" | |
6 #include "content/test/mock_render_process.h" | |
7 #include "testing/gtest/include/gtest/gtest.h" | |
8 | |
9 class PepperPluginDelegateImplTest : public ::testing::Test { | |
10 protected: | |
11 MessageLoopForIO message_loop_; | |
12 // ppapi::proxy::ProxyChannel needs to be initialized on the render process. | |
Paweł Hajdan Jr.
2011/11/04 16:58:39
nit: The comment seems quite confusing now in this
xhwang
2011/11/04 22:34:04
Done.
| |
13 MockRenderProcess mock_process_; | |
14 }; | |
15 | |
16 // Try to initialize BrokerDispatcherWrapper with invalid ChannelHandle. | |
ddorwin
2011/11/04 23:10:03
Are there some positive tests we should add while
xhwang
2011/11/07 22:00:14
Done.
| |
17 // Initialization should fail. | |
18 TEST_F(PepperPluginDelegateImplTest, BrokerDispatcherWrapperInitFailure) { | |
19 BrokerDispatcherWrapper dispatcher_wrapper; | |
20 base::ProcessHandle broker_process_handle = base::kNullProcessHandle; | |
21 IPC::ChannelHandle channel_handle; // Invalid by default. | |
22 | |
23 // Try BrokerDispatcherWrapper.Init() TWICE to trigger the LOG(FATAL) | |
ddorwin
2011/11/04 23:10:03
This block could probably be simplified. See if so
xhwang
2011/11/07 22:00:14
Done.
| |
24 // of "Denying attempt to reuse initial IPC channel for ..." in | |
25 // IPC::Channel::ChannelImpl::CreatePipe() in case invalid ChannelHandle is | |
26 // not checked properly. If invalid ChannelHandle is not checked and passed | |
27 // all the way down to IPC::Channel::ChannelImpl::CreatePipe(), CreatePipe | |
28 // will be called in client mode with channel_handle.socket.fd == -1. There | |
29 // is a static variable "bool used_initial_channel = false" in this function. | |
30 // In the first test it will be set to true. In the second test the | |
31 // LOG(FATAL) error will be triggered. | |
32 EXPECT_FALSE(dispatcher_wrapper.Init(broker_process_handle, channel_handle)); | |
33 EXPECT_FALSE(dispatcher_wrapper.Init(broker_process_handle, channel_handle)); | |
34 } | |
OLD | NEW |