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

Unified Diff: content/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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_view_browsertest_mac.mm ('k') | content/test/render_view_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/render_view_test.h
===================================================================
--- content/test/render_view_test.h (revision 140247)
+++ content/test/render_view_test.h (working copy)
@@ -1,152 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_TEST_RENDER_VIEW_TEST_H_
-#define CONTENT_TEST_RENDER_VIEW_TEST_H_
-#pragma once
-
-#include <string>
-
-#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop.h"
-#include "base/string16.h"
-#include "content/public/browser/native_web_keyboard_event.h"
-#include "content/public/common/main_function_params.h"
-#include "content/public/test/mock_render_thread.h"
-#include "content/renderer/mock_content_renderer_client.h"
-#include "content/renderer/renderer_webkitplatformsupport_impl.h"
-#include "content/test/mock_keyboard.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
-
-class MockRenderProcess;
-class RendererMainPlatformDelegate;
-
-namespace WebKit {
-class WebHistoryItem;
-class WebWidget;
-}
-
-namespace content {
-class RenderView;
-}
-
-namespace gfx {
-class Rect;
-}
-
-namespace content {
-
-class RenderViewTest : public testing::Test {
- public:
- // A special WebKitPlatformSupportImpl class for getting rid off the
- // dependency to the sandbox, which is not available in RenderViewTest.
- class RendererWebKitPlatformSupportImplNoSandbox :
- public RendererWebKitPlatformSupportImpl {
- public:
- virtual WebKit::WebSandboxSupport* sandboxSupport() {
- return NULL;
- }
- };
-
- RenderViewTest();
- virtual ~RenderViewTest();
-
- protected:
- // Spins the message loop to process all messages that are currently pending.
- void ProcessPendingMessages();
-
- // Returns a pointer to the main frame.
- WebKit::WebFrame* GetMainFrame();
-
- // Executes the given JavaScript in the context of the main frame. The input
- // is a NULL-terminated UTF-8 string.
- void ExecuteJavaScript(const char* js);
-
- // Executes the given JavaScript and sets the int value it evaluates to in
- // |result|.
- // Returns true if the JavaScript was evaluated correctly to an int value,
- // false otherwise.
- bool ExecuteJavaScriptAndReturnIntValue(const string16& script, int* result);
-
- // Loads the given HTML into the main frame as a data: URL and blocks until
- // the navigation is committed.
- void LoadHTML(const char* html);
-
- // Navigates the main frame back or forward in session history and commits.
- // The caller must capture a WebHistoryItem for the target page. This is
- // available from the WebFrame.
- void GoBack(const WebKit::WebHistoryItem& item);
- void GoForward(const WebKit::WebHistoryItem& item);
-
- // Sends IPC messages that emulates a key-press event.
- int SendKeyEvent(MockKeyboard::Layout layout,
- int key_code,
- MockKeyboard::Modifiers key_modifiers,
- string16* output);
-
- // Sends one native key event over IPC.
- void SendNativeKeyEvent(const content::NativeWebKeyboardEvent& key_event);
-
- // Send a raw keyboard event to the renderer.
- void SendWebKeyboardEvent(const WebKit::WebKeyboardEvent& key_event);
-
- // Send a raw mouse event to the renderer.
- void SendWebMouseEvent(const WebKit::WebMouseEvent& key_event);
-
- // Returns the bounds (coordinates and size) of the element with id
- // |element_id|. Returns an empty rect if such an element was not found.
- gfx::Rect GetElementBounds(const std::string& element_id);
-
- // Sends a left mouse click in the middle of the element with id |element_id|.
- // Returns true if the event was sent, false otherwise (typically because
- // the element was not found).
- bool SimulateElementClick(const std::string& element_id);
-
- // Simulates |node| being focused.
- void SetFocused(const WebKit::WebNode& node);
-
- // Clears anything associated with the browsing history.
- void ClearHistory();
-
- // Simulates a navigation with a type of reload to the given url.
- void Reload(const GURL& url);
-
- // Returns the IPC message ID of the navigation message.
- uint32 GetNavigationIPCType();
-
- // These are all methods from RenderViewImpl that we expose to testing code.
- bool OnMessageReceived(const IPC::Message& msg);
- void DidNavigateWithinPage(WebKit::WebFrame* frame, bool is_new_navigation);
- void SendContentStateImmediately();
- WebKit::WebWidget* GetWebWidget();
-
- // testing::Test
- virtual void SetUp() OVERRIDE;
-
- virtual void TearDown() OVERRIDE;
-
- MessageLoop msg_loop_;
- scoped_ptr<MockRenderProcess> mock_process_;
- // We use a naked pointer because we don't want to expose RenderViewImpl in
- // the embedder's namespace.
- content::RenderView* view_;
- RendererWebKitPlatformSupportImplNoSandbox webkit_platform_support_;
- MockContentRendererClient mock_content_renderer_client_;
- scoped_ptr<MockKeyboard> mock_keyboard_;
- scoped_ptr<MockRenderThread> render_thread_;
-
- // Used to setup the process so renderers can run.
- scoped_ptr<RendererMainPlatformDelegate> platform_;
- scoped_ptr<content::MainFunctionParams> params_;
- scoped_ptr<CommandLine> command_line_;
-
- private:
- void GoToOffset(int offset, const WebKit::WebHistoryItem& history_item);
-};
-
-} // namespace content
-
-#endif // CONTENT_TEST_RENDER_VIEW_TEST_H_
« no previous file with comments | « content/renderer/render_view_browsertest_mac.mm ('k') | content/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698