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

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

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
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_PUBLIC_TEST_RENDER_VIEW_TEST_H_ 5 #ifndef CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_
6 #define CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ 6 #define CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "content/public/browser/native_web_keyboard_event.h" 14 #include "content/public/browser/native_web_keyboard_event.h"
15 #include "content/public/common/main_function_params.h" 15 #include "content/public/common/main_function_params.h"
16 #include "content/public/renderer/content_renderer_client.h" 16 #include "content/public/renderer/content_renderer_client.h"
17 #include "content/public/test/mock_render_thread.h" 17 #include "content/public/test/mock_render_thread.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "third_party/WebKit/public/platform/Platform.h" 19 #include "third_party/WebKit/public/platform/Platform.h"
20 #include "third_party/WebKit/public/web/WebFrame.h" 20 #include "third_party/WebKit/public/web/WebFrame.h"
21 21
22 namespace WebKit { 22 namespace blink {
23 class WebHistoryItem; 23 class WebHistoryItem;
24 class WebWidget; 24 class WebWidget;
25 } 25 }
26 26
27 namespace gfx { 27 namespace gfx {
28 class Rect; 28 class Rect;
29 } 29 }
30 30
31 namespace content { 31 namespace content {
32 class MockRenderProcess; 32 class MockRenderProcess;
33 class RendererMainPlatformDelegate; 33 class RendererMainPlatformDelegate;
34 class RendererWebKitPlatformSupportImplNoSandboxImpl; 34 class RendererWebKitPlatformSupportImplNoSandboxImpl;
35 35
36 class RenderViewTest : public testing::Test { 36 class RenderViewTest : public testing::Test {
37 public: 37 public:
38 // A special WebKitPlatformSupportImpl class for getting rid off the 38 // A special WebKitPlatformSupportImpl class for getting rid off the
39 // dependency to the sandbox, which is not available in RenderViewTest. 39 // dependency to the sandbox, which is not available in RenderViewTest.
40 class RendererWebKitPlatformSupportImplNoSandbox { 40 class RendererWebKitPlatformSupportImplNoSandbox {
41 public: 41 public:
42 RendererWebKitPlatformSupportImplNoSandbox(); 42 RendererWebKitPlatformSupportImplNoSandbox();
43 ~RendererWebKitPlatformSupportImplNoSandbox(); 43 ~RendererWebKitPlatformSupportImplNoSandbox();
44 WebKit::Platform* Get(); 44 blink::Platform* Get();
45 45
46 private: 46 private:
47 scoped_ptr<RendererWebKitPlatformSupportImplNoSandboxImpl> 47 scoped_ptr<RendererWebKitPlatformSupportImplNoSandboxImpl>
48 webkit_platform_support_; 48 webkit_platform_support_;
49 }; 49 };
50 50
51 RenderViewTest(); 51 RenderViewTest();
52 virtual ~RenderViewTest(); 52 virtual ~RenderViewTest();
53 53
54 protected: 54 protected:
55 // Spins the message loop to process all messages that are currently pending. 55 // Spins the message loop to process all messages that are currently pending.
56 void ProcessPendingMessages(); 56 void ProcessPendingMessages();
57 57
58 // Returns a pointer to the main frame. 58 // Returns a pointer to the main frame.
59 WebKit::WebFrame* GetMainFrame(); 59 blink::WebFrame* GetMainFrame();
60 60
61 // Executes the given JavaScript in the context of the main frame. The input 61 // Executes the given JavaScript in the context of the main frame. The input
62 // is a NULL-terminated UTF-8 string. 62 // is a NULL-terminated UTF-8 string.
63 void ExecuteJavaScript(const char* js); 63 void ExecuteJavaScript(const char* js);
64 64
65 // Executes the given JavaScript and sets the int value it evaluates to in 65 // Executes the given JavaScript and sets the int value it evaluates to in
66 // |result|. 66 // |result|.
67 // Returns true if the JavaScript was evaluated correctly to an int value, 67 // Returns true if the JavaScript was evaluated correctly to an int value,
68 // false otherwise. 68 // false otherwise.
69 bool ExecuteJavaScriptAndReturnIntValue(const string16& script, int* result); 69 bool ExecuteJavaScriptAndReturnIntValue(const string16& script, int* result);
70 70
71 // Loads the given HTML into the main frame as a data: URL and blocks until 71 // Loads the given HTML into the main frame as a data: URL and blocks until
72 // the navigation is committed. 72 // the navigation is committed.
73 void LoadHTML(const char* html); 73 void LoadHTML(const char* html);
74 74
75 // Navigates the main frame back or forward in session history and commits. 75 // Navigates the main frame back or forward in session history and commits.
76 // The caller must capture a WebHistoryItem for the target page. This is 76 // The caller must capture a WebHistoryItem for the target page. This is
77 // available from the WebFrame. 77 // available from the WebFrame.
78 void GoBack(const WebKit::WebHistoryItem& item); 78 void GoBack(const blink::WebHistoryItem& item);
79 void GoForward(const WebKit::WebHistoryItem& item); 79 void GoForward(const blink::WebHistoryItem& item);
80 80
81 // Sends one native key event over IPC. 81 // Sends one native key event over IPC.
82 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); 82 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event);
83 83
84 // Send a raw keyboard event to the renderer. 84 // Send a raw keyboard event to the renderer.
85 void SendWebKeyboardEvent(const WebKit::WebKeyboardEvent& key_event); 85 void SendWebKeyboardEvent(const blink::WebKeyboardEvent& key_event);
86 86
87 // Send a raw mouse event to the renderer. 87 // Send a raw mouse event to the renderer.
88 void SendWebMouseEvent(const WebKit::WebMouseEvent& key_event); 88 void SendWebMouseEvent(const blink::WebMouseEvent& key_event);
89 89
90 // Returns the bounds (coordinates and size) of the element with id 90 // Returns the bounds (coordinates and size) of the element with id
91 // |element_id|. Returns an empty rect if such an element was not found. 91 // |element_id|. Returns an empty rect if such an element was not found.
92 gfx::Rect GetElementBounds(const std::string& element_id); 92 gfx::Rect GetElementBounds(const std::string& element_id);
93 93
94 // Sends a left mouse click in the middle of the element with id |element_id|. 94 // Sends a left mouse click in the middle of the element with id |element_id|.
95 // Returns true if the event was sent, false otherwise (typically because 95 // Returns true if the event was sent, false otherwise (typically because
96 // the element was not found). 96 // the element was not found).
97 bool SimulateElementClick(const std::string& element_id); 97 bool SimulateElementClick(const std::string& element_id);
98 98
99 // Simulates |node| being focused. 99 // Simulates |node| being focused.
100 void SetFocused(const WebKit::WebNode& node); 100 void SetFocused(const blink::WebNode& node);
101 101
102 // Clears anything associated with the browsing history. 102 // Clears anything associated with the browsing history.
103 void ClearHistory(); 103 void ClearHistory();
104 104
105 // Simulates a navigation with a type of reload to the given url. 105 // Simulates a navigation with a type of reload to the given url.
106 void Reload(const GURL& url); 106 void Reload(const GURL& url);
107 107
108 // Returns the IPC message ID of the navigation message. 108 // Returns the IPC message ID of the navigation message.
109 uint32 GetNavigationIPCType(); 109 uint32 GetNavigationIPCType();
110 110
111 // Resize the view. 111 // Resize the view.
112 void Resize(gfx::Size new_size, 112 void Resize(gfx::Size new_size,
113 gfx::Rect resizer_rect, 113 gfx::Rect resizer_rect,
114 bool is_fullscreen); 114 bool is_fullscreen);
115 115
116 // These are all methods from RenderViewImpl that we expose to testing code. 116 // These are all methods from RenderViewImpl that we expose to testing code.
117 bool OnMessageReceived(const IPC::Message& msg); 117 bool OnMessageReceived(const IPC::Message& msg);
118 void DidNavigateWithinPage(WebKit::WebFrame* frame, bool is_new_navigation); 118 void DidNavigateWithinPage(blink::WebFrame* frame, bool is_new_navigation);
119 void SendContentStateImmediately(); 119 void SendContentStateImmediately();
120 WebKit::WebWidget* GetWebWidget(); 120 blink::WebWidget* GetWebWidget();
121 121
122 // testing::Test 122 // testing::Test
123 virtual void SetUp() OVERRIDE; 123 virtual void SetUp() OVERRIDE;
124 124
125 virtual void TearDown() OVERRIDE; 125 virtual void TearDown() OVERRIDE;
126 126
127 base::MessageLoop msg_loop_; 127 base::MessageLoop msg_loop_;
128 scoped_ptr<MockRenderProcess> mock_process_; 128 scoped_ptr<MockRenderProcess> mock_process_;
129 // We use a naked pointer because we don't want to expose RenderViewImpl in 129 // We use a naked pointer because we don't want to expose RenderViewImpl in
130 // the embedder's namespace. 130 // the embedder's namespace.
131 RenderView* view_; 131 RenderView* view_;
132 RendererWebKitPlatformSupportImplNoSandbox webkit_platform_support_; 132 RendererWebKitPlatformSupportImplNoSandbox webkit_platform_support_;
133 ContentRendererClient content_renderer_client_; 133 ContentRendererClient content_renderer_client_;
134 scoped_ptr<MockRenderThread> render_thread_; 134 scoped_ptr<MockRenderThread> render_thread_;
135 135
136 // Used to setup the process so renderers can run. 136 // Used to setup the process so renderers can run.
137 scoped_ptr<RendererMainPlatformDelegate> platform_; 137 scoped_ptr<RendererMainPlatformDelegate> platform_;
138 scoped_ptr<MainFunctionParams> params_; 138 scoped_ptr<MainFunctionParams> params_;
139 scoped_ptr<CommandLine> command_line_; 139 scoped_ptr<CommandLine> command_line_;
140 140
141 private: 141 private:
142 void GoToOffset(int offset, const WebKit::WebHistoryItem& history_item); 142 void GoToOffset(int offset, const blink::WebHistoryItem& history_item);
143 }; 143 };
144 144
145 } // namespace content 145 } // namespace content
146 146
147 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ 147 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_
OLDNEW
« no previous file with comments | « content/public/test/render_view_fake_resources_test.cc ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698