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

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

Issue 1508293006: Check url path as well as document title to detect formless autofill page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add non-ASCII tests Created 5 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 unified diff | Download patch
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"
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 37
38 namespace content { 38 namespace content {
39 class ContentBrowserClient; 39 class ContentBrowserClient;
40 class ContentClient; 40 class ContentClient;
41 class ContentRendererClient; 41 class ContentRendererClient;
42 class FakeCompositorDependencies; 42 class FakeCompositorDependencies;
43 class MockRenderProcess; 43 class MockRenderProcess;
44 class PageState; 44 class PageState;
45 class RendererMainPlatformDelegate; 45 class RendererMainPlatformDelegate;
46 class RendererBlinkPlatformImplNoSandboxImpl; 46 class RendererBlinkPlatformImplTestOverrideImpl;
47 class RenderView; 47 class RenderView;
48 48
49 class RenderViewTest : public testing::Test, blink::WebLeakDetectorClient { 49 class RenderViewTest : public testing::Test, blink::WebLeakDetectorClient {
50 public: 50 public:
51 // A special BlinkPlatformImpl class for getting rid off the dependency to the 51 // A special BlinkPlatformImpl class with overrides that are useful for
52 // sandbox, which is not available in RenderViewTest. 52 // RenderViewTest.
53 class RendererBlinkPlatformImplNoSandbox { 53 class RendererBlinkPlatformImplTestOverride {
54 public: 54 public:
55 RendererBlinkPlatformImplNoSandbox(); 55 RendererBlinkPlatformImplTestOverride();
56 ~RendererBlinkPlatformImplNoSandbox(); 56 ~RendererBlinkPlatformImplTestOverride();
57 blink::Platform* Get() const; 57 blink::Platform* Get() const;
58 void Shutdown(); 58 void Shutdown();
59 59
60 private: 60 private:
61 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_; 61 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_;
62 scoped_ptr<RendererBlinkPlatformImplNoSandboxImpl> blink_platform_impl_; 62 scoped_ptr<RendererBlinkPlatformImplTestOverrideImpl> blink_platform_impl_;
63 }; 63 };
64 64
65 RenderViewTest(); 65 RenderViewTest();
66 ~RenderViewTest() override; 66 ~RenderViewTest() override;
67 67
68 protected: 68 protected:
69 // Spins the message loop to process all messages that are currently pending. 69 // Spins the message loop to process all messages that are currently pending.
70 void ProcessPendingMessages(); 70 void ProcessPendingMessages();
71 71
72 // Returns a pointer to the main frame. 72 // Returns a pointer to the main frame.
73 blink::WebLocalFrame* GetMainFrame(); 73 blink::WebLocalFrame* GetMainFrame();
74 74
75 // Executes the given JavaScript in the context of the main frame. The input 75 // Executes the given JavaScript in the context of the main frame. The input
76 // is a NULL-terminated UTF-8 string. 76 // is a NULL-terminated UTF-8 string.
77 void ExecuteJavaScriptForTests(const char* js); 77 void ExecuteJavaScriptForTests(const char* js);
78 78
79 // Executes the given JavaScript and sets the int value it evaluates to in 79 // Executes the given JavaScript and sets the int value it evaluates to in
80 // |result|. 80 // |result|.
81 // Returns true if the JavaScript was evaluated correctly to an int value, 81 // Returns true if the JavaScript was evaluated correctly to an int value,
82 // false otherwise. 82 // false otherwise.
83 bool ExecuteJavaScriptAndReturnIntValue(const base::string16& script, 83 bool ExecuteJavaScriptAndReturnIntValue(const base::string16& script,
84 int* result); 84 int* result);
85 85
86 // Loads the given HTML into the main frame as a data: URL and blocks until 86 // Loads |html| into the main frame as a data: URL and blocks until the
87 // the navigation is committed. 87 // navigation is committed.
88 void LoadHTML(const char* html); 88 void LoadHTML(const char* html);
89 89
90 // Pretends to load |url| into the main frame, but substitutes |html| for the
91 // response body (and does not include any response headers). This can be used
92 // instead of LoadHTML for tests that cannot use a data: url (for example if
93 // document.location needs to be set to something specific.)
94 void LoadHTMLWithUrlOverride(const char* html, const char* url_override);
95
90 // Returns the current PageState. 96 // Returns the current PageState.
91 // In OOPIF enabled modes, this returns a PageState object for the main frame. 97 // In OOPIF enabled modes, this returns a PageState object for the main frame.
92 PageState GetCurrentPageState(); 98 PageState GetCurrentPageState();
93 99
94 // Navigates the main frame back or forward in session history and commits. 100 // Navigates the main frame back or forward in session history and commits.
95 // The caller must capture a PageState for the target page. 101 // The caller must capture a PageState for the target page.
96 void GoBack(const PageState& state); 102 void GoBack(const PageState& state);
97 void GoForward(const PageState& state); 103 void GoForward(const PageState& state);
98 104
99 // Sends one native key event over IPC. 105 // Sends one native key event over IPC.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 182
177 // blink::WebLeakDetectorClient implementation. 183 // blink::WebLeakDetectorClient implementation.
178 void onLeakDetectionComplete(const Result& result) override; 184 void onLeakDetectionComplete(const Result& result) override;
179 185
180 base::MessageLoop msg_loop_; 186 base::MessageLoop msg_loop_;
181 scoped_ptr<FakeCompositorDependencies> compositor_deps_; 187 scoped_ptr<FakeCompositorDependencies> compositor_deps_;
182 scoped_ptr<MockRenderProcess> mock_process_; 188 scoped_ptr<MockRenderProcess> mock_process_;
183 // We use a naked pointer because we don't want to expose RenderViewImpl in 189 // We use a naked pointer because we don't want to expose RenderViewImpl in
184 // the embedder's namespace. 190 // the embedder's namespace.
185 RenderView* view_; 191 RenderView* view_;
186 RendererBlinkPlatformImplNoSandbox blink_platform_impl_; 192 RendererBlinkPlatformImplTestOverride blink_platform_impl_;
187 scoped_ptr<ContentClient> content_client_; 193 scoped_ptr<ContentClient> content_client_;
188 scoped_ptr<ContentBrowserClient> content_browser_client_; 194 scoped_ptr<ContentBrowserClient> content_browser_client_;
189 scoped_ptr<ContentRendererClient> content_renderer_client_; 195 scoped_ptr<ContentRendererClient> content_renderer_client_;
190 scoped_ptr<MockRenderThread> render_thread_; 196 scoped_ptr<MockRenderThread> render_thread_;
191 197
192 // Used to setup the process so renderers can run. 198 // Used to setup the process so renderers can run.
193 scoped_ptr<RendererMainPlatformDelegate> platform_; 199 scoped_ptr<RendererMainPlatformDelegate> platform_;
194 scoped_ptr<MainFunctionParams> params_; 200 scoped_ptr<MainFunctionParams> params_;
195 scoped_ptr<base::CommandLine> command_line_; 201 scoped_ptr<base::CommandLine> command_line_;
196 202
197 #if defined(OS_MACOSX) 203 #if defined(OS_MACOSX)
198 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_; 204 scoped_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool_;
199 #endif 205 #endif
200 206
201 private: 207 private:
202 void GoToOffset(int offset, const PageState& state); 208 void GoToOffset(int offset, const PageState& state);
203 }; 209 };
204 210
205 } // namespace content 211 } // namespace content
206 212
207 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_ 213 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698