Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: content/renderer/pepper_plugin_delegate_impl_unittest.cc

Issue 8436008: Add check on invalid file descriptor at both broker and renderer sides. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made the test fixture much simpler. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698