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

Side by Side Diff: content/browser/renderer_host/render_view_host_unittest.cc

Issue 14727006: Check that the files the renderer wants to preserve as part of a session restore are already availa… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . not -> Created 7 years, 7 months 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 | Annotate | Revision Log
OLDNEW
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/path_service.h"
5 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
6 #include "content/browser/child_process_security_policy_impl.h" 7 #include "content/browser/child_process_security_policy_impl.h"
7 #include "content/browser/renderer_host/test_render_view_host.h" 8 #include "content/browser/renderer_host/test_render_view_host.h"
8 #include "content/browser/web_contents/navigation_controller_impl.h" 9 #include "content/browser/web_contents/navigation_controller_impl.h"
9 #include "content/common/input_messages.h" 10 #include "content/common/input_messages.h"
10 #include "content/common/view_messages.h" 11 #include "content/common/view_messages.h"
11 #include "content/port/browser/render_view_host_delegate_view.h" 12 #include "content/port/browser/render_view_host_delegate_view.h"
12 #include "content/public/browser/navigation_entry.h" 13 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/common/bindings_policy.h" 14 #include "content/public/common/bindings_policy.h"
14 #include "content/public/common/page_transition_types.h" 15 #include "content/public/common/page_transition_types.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // bogus message will not fail at de-serialization but should fail in 221 // bogus message will not fail at de-serialization but should fail in
221 // OnInputEventAck() processing. 222 // OnInputEventAck() processing.
222 IPC::Message message(0, InputHostMsg_HandleInputEvent_ACK::ID, 223 IPC::Message message(0, InputHostMsg_HandleInputEvent_ACK::ID,
223 IPC::Message::PRIORITY_NORMAL); 224 IPC::Message::PRIORITY_NORMAL);
224 test_rvh()->OnMessageReceived(message); 225 test_rvh()->OnMessageReceived(message);
225 EXPECT_EQ(1, process()->bad_msg_count()); 226 EXPECT_EQ(1, process()->bad_msg_count());
226 } 227 }
227 228
228 #endif 229 #endif
229 230
231 TEST_F(RenderViewHostTest, MessageWithBadHistoryItemFiles) {
232 base::FilePath file_path;
233 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path));
234 file_path = file_path.AppendASCII("foo");
235 EXPECT_EQ(0, process()->bad_msg_count());
236 test_rvh()->TestOnUpdateStateWithFile(process()->GetID(), file_path);
237 EXPECT_EQ(1, process()->bad_msg_count());
238
239 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile(
240 process()->GetID(), file_path,
241 base::PLATFORM_FILE_OPEN |
242 base::PLATFORM_FILE_READ |
243 base::PLATFORM_FILE_EXCLUSIVE_READ |
244 base::PLATFORM_FILE_ASYNC);
245 test_rvh()->TestOnUpdateStateWithFile(process()->GetID(), file_path);
246 EXPECT_EQ(1, process()->bad_msg_count());
247 }
248
249 TEST_F(RenderViewHostTest, NavigationWithBadHistoryItemFiles) {
250 GURL url("http://www.google.com");
251 base::FilePath file_path;
252 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path));
253 file_path = file_path.AppendASCII("bar");
254 EXPECT_EQ(0, process()->bad_msg_count());
255 test_rvh()->SendNavigateWithFile(1, url, file_path);
256 EXPECT_EQ(1, process()->bad_msg_count());
257
258 ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile(
259 process()->GetID(), file_path,
260 base::PLATFORM_FILE_OPEN |
261 base::PLATFORM_FILE_READ |
262 base::PLATFORM_FILE_EXCLUSIVE_READ |
263 base::PLATFORM_FILE_ASYNC);
264 test_rvh()->SendNavigateWithFile(process()->GetID(), url, file_path);
265 EXPECT_EQ(1, process()->bad_msg_count());
266 }
267
230 } // namespace content 268 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/renderer_host/test_render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698