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

Unified Diff: content/public/test/browser_test_utils.h

Issue 2398463004: browser_test that creates filesystem resources in extension origin (Closed)
Patch Set: Cleanup. Created 4 years 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/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..ba195debfbc63bb1dcdce5dd3e7fe3adfaf6247b 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_RegisterBlobUUID and BlobStorageMsg_StartBuildingBlob.
alexmos 2016/12/02 00:01:56 Seems like this actually sends BlobStorageMsg_Regi
ncarter (slow) 2016/12/02 19:17:45 Good catch. This comment was accurate when the fun
+ 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_

Powered by Google App Engine
This is Rietveld 408576698