OLD | NEW |
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 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/process/process.h" | 17 #include "base/process/process.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
20 #include "cc/output/compositor_frame.h" | 20 #include "cc/output/compositor_frame.h" |
21 #include "content/public/browser/browser_message_filter.h" | 21 #include "content/public/browser/browser_message_filter.h" |
22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/browser/render_process_host_observer.h" | 24 #include "content/public/browser/render_process_host_observer.h" |
25 #include "content/public/browser/web_contents_delegate.h" | 25 #include "content/public/browser/web_contents_delegate.h" |
26 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
27 #include "content/public/common/page_type.h" | 27 #include "content/public/common/page_type.h" |
28 #include "ipc/message_filter.h" | 28 #include "ipc/message_filter.h" |
| 29 #include "storage/common/fileapi/file_system_types.h" |
29 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 30 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
30 #include "ui/accessibility/ax_node_data.h" | 31 #include "ui/accessibility/ax_node_data.h" |
31 #include "ui/accessibility/ax_tree_update.h" | 32 #include "ui/accessibility/ax_tree_update.h" |
32 #include "ui/events/keycodes/dom/dom_code.h" | 33 #include "ui/events/keycodes/dom/dom_code.h" |
33 #include "ui/events/keycodes/dom/dom_key.h" | 34 #include "ui/events/keycodes/dom/dom_key.h" |
34 #include "ui/events/keycodes/keyboard_codes.h" | 35 #include "ui/events/keycodes/keyboard_codes.h" |
35 #include "url/gurl.h" | 36 #include "url/gurl.h" |
36 | 37 |
37 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
38 #include "base/win/scoped_handle.h" | 39 #include "base/win/scoped_handle.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 WebContents* web_contents_; | 711 WebContents* web_contents_; |
711 std::string filter_; | 712 std::string filter_; |
712 std::string message_; | 713 std::string message_; |
713 | 714 |
714 // The MessageLoopRunner used to spin the message loop. | 715 // The MessageLoopRunner used to spin the message loop. |
715 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 716 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
716 | 717 |
717 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); | 718 DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate); |
718 }; | 719 }; |
719 | 720 |
| 721 // Static methods that inject particular IPCs into the message pipe as if they |
| 722 // came from |process|. Used to simulate a compromised renderer. |
| 723 class PwnMessageHelper { |
| 724 public: |
| 725 // Sends BlobStorageMsg_RegisterBlob |
| 726 static void CreateBlobWithPayload(RenderProcessHost* process, |
| 727 std::string uuid, |
| 728 std::string content_type, |
| 729 std::string content_disposition, |
| 730 std::string payload); |
| 731 |
| 732 // Sends BlobHostMsg_RegisterPublicURL |
| 733 static void RegisterBlobURL(RenderProcessHost* process, |
| 734 GURL url, |
| 735 std::string uuid); |
| 736 |
| 737 // Sends FileSystemHostMsg_Create |
| 738 static void FileSystemCreate(RenderProcessHost* process, |
| 739 int request_id, |
| 740 GURL path, |
| 741 bool exclusive, |
| 742 bool is_directory, |
| 743 bool recursive); |
| 744 |
| 745 // Sends FileSystemHostMsg_Write |
| 746 static void FileSystemWrite(RenderProcessHost* process, |
| 747 int request_id, |
| 748 GURL file_path, |
| 749 std::string blob_uuid, |
| 750 int64_t position); |
| 751 |
| 752 private: |
| 753 PwnMessageHelper(); // Not instantiable. |
| 754 |
| 755 DISALLOW_COPY_AND_ASSIGN(PwnMessageHelper); |
| 756 }; |
| 757 |
720 } // namespace content | 758 } // namespace content |
721 | 759 |
722 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 760 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
OLD | NEW |