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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host_unittest.cc
diff --git a/content/browser/renderer_host/render_view_host_unittest.cc b/content/browser/renderer_host/render_view_host_unittest.cc
index f523c064edd676ed53164bed804d74a691125df4..52d7d4e47bbe0881608522c1c15123c4d87b1c5b 100644
--- a/content/browser/renderer_host/render_view_host_unittest.cc
+++ b/content/browser/renderer_host/render_view_host_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/path_service.h"
#include "base/utf_string_conversions.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/renderer_host/test_render_view_host.h"
@@ -227,4 +228,41 @@ TEST_F(RenderViewHostTest, BadMessageHandlerInputEventAck) {
#endif
+TEST_F(RenderViewHostTest, MessageWithBadHistoryItemFiles) {
+ base::FilePath file_path;
+ EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path));
+ file_path = file_path.AppendASCII("foo");
+ EXPECT_EQ(0, process()->bad_msg_count());
+ test_rvh()->TestOnUpdateStateWithFile(process()->GetID(), file_path);
+ EXPECT_EQ(1, process()->bad_msg_count());
+
+ ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile(
+ process()->GetID(), file_path,
+ base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
+ base::PLATFORM_FILE_EXCLUSIVE_READ |
+ base::PLATFORM_FILE_ASYNC);
+ test_rvh()->TestOnUpdateStateWithFile(process()->GetID(), file_path);
+ EXPECT_EQ(1, process()->bad_msg_count());
+}
+
+TEST_F(RenderViewHostTest, NavigationWithBadHistoryItemFiles) {
+ GURL url("http://www.google.com");
+ base::FilePath file_path;
+ EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file_path));
+ file_path = file_path.AppendASCII("bar");
+ EXPECT_EQ(0, process()->bad_msg_count());
+ test_rvh()->SendNavigateWithFile(1, url, file_path);
+ EXPECT_EQ(1, process()->bad_msg_count());
+
+ ChildProcessSecurityPolicyImpl::GetInstance()->GrantPermissionsForFile(
+ process()->GetID(), file_path,
+ base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
+ base::PLATFORM_FILE_EXCLUSIVE_READ |
+ base::PLATFORM_FILE_ASYNC);
+ test_rvh()->SendNavigateWithFile(process()->GetID(), url, file_path);
+ EXPECT_EQ(1, process()->bad_msg_count());
+}
+
} // namespace content
« 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