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_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/common/page_state.h" |
16 #include "content/public/test/mock_render_thread.h" | 17 #include "content/public/test/mock_render_thread.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/WebKit/public/platform/Platform.h" | 19 #include "third_party/WebKit/public/platform/Platform.h" |
19 #include "third_party/WebKit/public/web/WebFrame.h" | 20 #include "third_party/WebKit/public/web/WebFrame.h" |
20 | 21 |
21 namespace blink { | 22 namespace blink { |
22 class WebWidget; | 23 class WebWidget; |
23 } | 24 } |
24 | 25 |
25 namespace gfx { | 26 namespace gfx { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // |result|. | 70 // |result|. |
70 // Returns true if the JavaScript was evaluated correctly to an int value, | 71 // Returns true if the JavaScript was evaluated correctly to an int value, |
71 // false otherwise. | 72 // false otherwise. |
72 bool ExecuteJavaScriptAndReturnIntValue(const base::string16& script, | 73 bool ExecuteJavaScriptAndReturnIntValue(const base::string16& script, |
73 int* result); | 74 int* result); |
74 | 75 |
75 // Loads the given HTML into the main frame as a data: URL and blocks until | 76 // Loads the given HTML into the main frame as a data: URL and blocks until |
76 // the navigation is committed. | 77 // the navigation is committed. |
77 void LoadHTML(const char* html); | 78 void LoadHTML(const char* html); |
78 | 79 |
| 80 // Returns the current PageState. |
| 81 PageState GetCurrentPageState(); |
| 82 |
79 // Navigates the main frame back or forward in session history and commits. | 83 // Navigates the main frame back or forward in session history and commits. |
80 // The caller must capture a PageState for the target page. | 84 // The caller must capture a PageState for the target page. |
81 void GoBack(const PageState& state); | 85 void GoBack(const PageState& state); |
82 void GoForward(const PageState& state); | 86 void GoForward(const PageState& state); |
83 | 87 |
84 // Navigates the main frame back to whatever is considered the previous | |
85 // history entry internally. | |
86 void GoBackToPrevious(); | |
87 | |
88 // Sends one native key event over IPC. | 88 // Sends one native key event over IPC. |
89 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); | 89 void SendNativeKeyEvent(const NativeWebKeyboardEvent& key_event); |
90 | 90 |
91 // Send a raw keyboard event to the renderer. | 91 // Send a raw keyboard event to the renderer. |
92 void SendWebKeyboardEvent(const blink::WebKeyboardEvent& key_event); | 92 void SendWebKeyboardEvent(const blink::WebKeyboardEvent& key_event); |
93 | 93 |
94 // Send a raw mouse event to the renderer. | 94 // Send a raw mouse event to the renderer. |
95 void SendWebMouseEvent(const blink::WebMouseEvent& key_event); | 95 void SendWebMouseEvent(const blink::WebMouseEvent& key_event); |
96 | 96 |
97 // Returns the bounds (coordinates and size) of the element with id | 97 // Returns the bounds (coordinates and size) of the element with id |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; | 157 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; |
158 #endif | 158 #endif |
159 | 159 |
160 private: | 160 private: |
161 void GoToOffset(int offset, const PageState& state); | 161 void GoToOffset(int offset, const PageState& state); |
162 }; | 162 }; |
163 | 163 |
164 } // namespace content | 164 } // namespace content |
165 | 165 |
166 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ | 166 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ |
OLD | NEW |