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

Side by Side Diff: content/public/test/render_view_test.h

Issue 10497013: Move render_view_test.h header from content\test to content\public\test. This way we can enforce th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/external_popup_menu_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_TEST_RENDER_VIEW_TEST_H_ 5 #ifndef CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_
6 #define CONTENT_TEST_RENDER_VIEW_TEST_H_ 6 #define CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "content/public/browser/native_web_keyboard_event.h" 15 #include "content/public/browser/native_web_keyboard_event.h"
16 #include "content/public/common/main_function_params.h" 16 #include "content/public/common/main_function_params.h"
17 #include "content/public/renderer/content_renderer_client.h"
17 #include "content/public/test/mock_render_thread.h" 18 #include "content/public/test/mock_render_thread.h"
18 #include "content/renderer/mock_content_renderer_client.h"
19 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
20 #include "content/test/mock_keyboard.h"
21 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
23 21
24 class MockRenderProcess; 22 class MockRenderProcess;
25 class RendererMainPlatformDelegate; 23 class RendererMainPlatformDelegate;
26 24
27 namespace WebKit { 25 namespace WebKit {
28 class WebHistoryItem; 26 class WebHistoryItem;
27 class WebKitPlatformSupport;
29 class WebWidget; 28 class WebWidget;
30 } 29 }
31 30
32 namespace content {
33 class RenderView;
34 }
35
36 namespace gfx { 31 namespace gfx {
37 class Rect; 32 class Rect;
38 } 33 }
39 34
40 namespace content { 35 namespace content {
41 36
37 class RendererWebKitPlatformSupportImplNoSandboxImpl;
38
42 class RenderViewTest : public testing::Test { 39 class RenderViewTest : public testing::Test {
43 public: 40 public:
44 // A special WebKitPlatformSupportImpl class for getting rid off the 41 // A special WebKitPlatformSupportImpl class for getting rid off the
45 // dependency to the sandbox, which is not available in RenderViewTest. 42 // dependency to the sandbox, which is not available in RenderViewTest.
46 class RendererWebKitPlatformSupportImplNoSandbox : 43 class RendererWebKitPlatformSupportImplNoSandbox {
47 public RendererWebKitPlatformSupportImpl {
48 public: 44 public:
49 virtual WebKit::WebSandboxSupport* sandboxSupport() { 45 RendererWebKitPlatformSupportImplNoSandbox();
50 return NULL; 46 ~RendererWebKitPlatformSupportImplNoSandbox();
51 } 47 WebKit::WebKitPlatformSupport* Get();
48
49 private:
50 scoped_ptr<RendererWebKitPlatformSupportImplNoSandboxImpl>
51 webkit_platform_support_;
52 }; 52 };
53 53
54 RenderViewTest(); 54 RenderViewTest();
55 virtual ~RenderViewTest(); 55 virtual ~RenderViewTest();
56 56
57 protected: 57 protected:
58 // Spins the message loop to process all messages that are currently pending. 58 // Spins the message loop to process all messages that are currently pending.
59 void ProcessPendingMessages(); 59 void ProcessPendingMessages();
60 60
61 // Returns a pointer to the main frame. 61 // Returns a pointer to the main frame.
(...skipping 12 matching lines...) Expand all
74 // Loads the given HTML into the main frame as a data: URL and blocks until 74 // Loads the given HTML into the main frame as a data: URL and blocks until
75 // the navigation is committed. 75 // the navigation is committed.
76 void LoadHTML(const char* html); 76 void LoadHTML(const char* html);
77 77
78 // Navigates the main frame back or forward in session history and commits. 78 // Navigates the main frame back or forward in session history and commits.
79 // The caller must capture a WebHistoryItem for the target page. This is 79 // The caller must capture a WebHistoryItem for the target page. This is
80 // available from the WebFrame. 80 // available from the WebFrame.
81 void GoBack(const WebKit::WebHistoryItem& item); 81 void GoBack(const WebKit::WebHistoryItem& item);
82 void GoForward(const WebKit::WebHistoryItem& item); 82 void GoForward(const WebKit::WebHistoryItem& item);
83 83
84 // Sends IPC messages that emulates a key-press event.
85 int SendKeyEvent(MockKeyboard::Layout layout,
86 int key_code,
87 MockKeyboard::Modifiers key_modifiers,
88 string16* output);
89
90 // Sends one native key event over IPC. 84 // Sends one native key event over IPC.
91 void SendNativeKeyEvent(const content::NativeWebKeyboardEvent& key_event); 85 void SendNativeKeyEvent(const content::NativeWebKeyboardEvent& key_event);
92 86
93 // Send a raw keyboard event to the renderer. 87 // Send a raw keyboard event to the renderer.
94 void SendWebKeyboardEvent(const WebKit::WebKeyboardEvent& key_event); 88 void SendWebKeyboardEvent(const WebKit::WebKeyboardEvent& key_event);
95 89
96 // Send a raw mouse event to the renderer. 90 // Send a raw mouse event to the renderer.
97 void SendWebMouseEvent(const WebKit::WebMouseEvent& key_event); 91 void SendWebMouseEvent(const WebKit::WebMouseEvent& key_event);
98 92
99 // Returns the bounds (coordinates and size) of the element with id 93 // Returns the bounds (coordinates and size) of the element with id
(...skipping 27 matching lines...) Expand all
127 virtual void SetUp() OVERRIDE; 121 virtual void SetUp() OVERRIDE;
128 122
129 virtual void TearDown() OVERRIDE; 123 virtual void TearDown() OVERRIDE;
130 124
131 MessageLoop msg_loop_; 125 MessageLoop msg_loop_;
132 scoped_ptr<MockRenderProcess> mock_process_; 126 scoped_ptr<MockRenderProcess> mock_process_;
133 // We use a naked pointer because we don't want to expose RenderViewImpl in 127 // We use a naked pointer because we don't want to expose RenderViewImpl in
134 // the embedder's namespace. 128 // the embedder's namespace.
135 content::RenderView* view_; 129 content::RenderView* view_;
136 RendererWebKitPlatformSupportImplNoSandbox webkit_platform_support_; 130 RendererWebKitPlatformSupportImplNoSandbox webkit_platform_support_;
137 MockContentRendererClient mock_content_renderer_client_; 131 ContentRendererClient content_renderer_client_;
138 scoped_ptr<MockKeyboard> mock_keyboard_;
139 scoped_ptr<MockRenderThread> render_thread_; 132 scoped_ptr<MockRenderThread> render_thread_;
140 133
141 // Used to setup the process so renderers can run. 134 // Used to setup the process so renderers can run.
142 scoped_ptr<RendererMainPlatformDelegate> platform_; 135 scoped_ptr<RendererMainPlatformDelegate> platform_;
143 scoped_ptr<content::MainFunctionParams> params_; 136 scoped_ptr<content::MainFunctionParams> params_;
144 scoped_ptr<CommandLine> command_line_; 137 scoped_ptr<CommandLine> command_line_;
145 138
146 private: 139 private:
147 void GoToOffset(int offset, const WebKit::WebHistoryItem& history_item); 140 void GoToOffset(int offset, const WebKit::WebHistoryItem& history_item);
148 }; 141 };
149 142
150 } // namespace content 143 } // namespace content
151 144
152 #endif // CONTENT_TEST_RENDER_VIEW_TEST_H_ 145 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/external_popup_menu_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698