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

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: Add test coverage. 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..0eb899b2b66c8dad221346186ddc3bcf851ecf2c 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/files/file_path.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,22 @@ TEST_F(RenderViewHostTest, BadMessageHandlerInputEventAck) {
#endif
+TEST_F(RenderViewHostTest, MessageWithBadHistoryItemFiles) {
+ int id = process()->GetID();
+ std::string file_name = "/tmp/foo";
darin (slow to review) 2013/05/06 23:39:47 I don't think this is going to work very well on W
+ EXPECT_EQ(0, process()->bad_msg_count());
+ test_rvh()->TestOnUpdateStateWithFile(id, file_name);
+ EXPECT_EQ(1, process()->bad_msg_count());
+
+ ChildProcessSecurityPolicyImpl* policy =
+ ChildProcessSecurityPolicyImpl::GetInstance();
+ policy->GrantPermissionsForFile(id, base::FilePath::FromUTF8Unsafe(file_name),
+ base::PLATFORM_FILE_OPEN |
+ base::PLATFORM_FILE_READ |
+ base::PLATFORM_FILE_EXCLUSIVE_READ |
+ base::PLATFORM_FILE_ASYNC);
+ test_rvh()->TestOnUpdateStateWithFile(id, file_name);
+ EXPECT_EQ(1, process()->bad_msg_count());
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698