Index: content/public/test/browser_test_utils.h |
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h |
index 9f04c0660c33aa58c14c9cf06eff1b445f84c1f6..1deed61f1a9da8609bcd14c7adafa8302b917112 100644 |
--- a/content/public/test/browser_test_utils.h |
+++ b/content/public/test/browser_test_utils.h |
@@ -26,6 +26,7 @@ |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/common/page_type.h" |
#include "ipc/message_filter.h" |
+#include "storage/common/fileapi/file_system_types.h" |
#include "third_party/WebKit/public/platform/WebInputEvent.h" |
#include "ui/accessibility/ax_node_data.h" |
#include "ui/accessibility/ax_tree_update.h" |
@@ -717,6 +718,43 @@ class ConsoleObserverDelegate : public WebContentsDelegate { |
DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); |
}; |
+// Static methods that inject particular IPCs into the message pipe as if they |
+// came from |process|. Used to simulate a compromised renderer. |
+class PwnMessageHelper { |
+ public: |
+ // Sends BlobStorageMsg_RegisterBlob |
+ static void CreateBlobWithPayload(RenderProcessHost* process, |
+ std::string uuid, |
+ std::string content_type, |
+ std::string content_disposition, |
+ std::string payload); |
+ |
+ // Sends BlobHostMsg_RegisterPublicURL |
+ static void RegisterBlobURL(RenderProcessHost* process, |
+ GURL url, |
+ std::string uuid); |
+ |
+ // Sends FileSystemHostMsg_Create |
+ static void FileSystemCreate(RenderProcessHost* process, |
+ int request_id, |
+ GURL path, |
+ bool exclusive, |
+ bool is_directory, |
+ bool recursive); |
+ |
+ // Sends FileSystemHostMsg_Write |
+ static void FileSystemWrite(RenderProcessHost* process, |
+ int request_id, |
+ GURL file_path, |
+ std::string blob_uuid, |
+ int64_t position); |
+ |
+ private: |
+ PwnMessageHelper(); // Not instantiable. |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PwnMessageHelper); |
+}; |
+ |
} // namespace content |
#endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |