diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-05 19:17:24 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-05 19:17:24 +0000 |
commit | 81a34415cb55543b8f8db86ee6872cd70cd24445 (patch) | |
tree | 6eaf45857f6a4a03d4f2ef55fe352b5bfe7bd233 /chrome/renderer/render_view.h | |
parent | 52381d5530f56b905fb752e90e6ba24029eac199 (diff) | |
download | chromium_src-81a34415cb55543b8f8db86ee6872cd70cd24445.zip chromium_src-81a34415cb55543b8f8db86ee6872cd70cd24445.tar.gz chromium_src-81a34415cb55543b8f8db86ee6872cd70cd24445.tar.bz2 |
Refactor the render widget unittest so it can be reused to create a render view
unit test. Change the mock render thread to save all IPC messages it is asked to
send so that tests can verify that the correct ones were sent. There are some
new functions that support this checking.
Plumb the form state change notification through the render view so that we
will correctly update the form state to the browser.
Write two RenderView unit tests. One arbitrarily tests OnLoadAlternateHTMLText
which I used as a testcase for my testing framework. The other tests the above
form state change notification. I had to expose the timeout of this message
through the RenderView API so that the test can change it.
Review URL: http://codereview.chromium.org/16482
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_view.h')
-rw-r--r-- | chrome/renderer/render_view.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index cea0ce1..24f8f9b 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -25,6 +25,7 @@ #include "chrome/renderer/external_js_object.h" #include "chrome/renderer/render_process.h" #include "chrome/renderer/render_widget.h" +#include "testing/gtest/include/gtest/gtest_prod.h" #include "webkit/glue/console_message_level.h" #include "webkit/glue/dom_serializer_delegate.h" #include "webkit/glue/glue_accessibility.h" @@ -38,6 +39,7 @@ class DebugMessageHandler; class GURL; +class RenderThread; class SkBitmap; struct ThumbnailScore; class WebError; @@ -68,7 +70,8 @@ typedef base::RefCountedData<int> SharedRenderViewCounter; // RenderView is an object that manages a WebView object, and provides a // communication interface with an embedding application process // -class RenderView : public RenderWidget, public WebViewDelegate, +class RenderView : public RenderWidget, + public WebViewDelegate, public webkit_glue::DomSerializerDelegate { public: // Creates a new RenderView. The parent_hwnd specifies a HWND to use as the @@ -80,6 +83,7 @@ class RenderView : public RenderWidget, public WebViewDelegate, // parent_hwnd). |counter| is either a currently initialized counter, or NULL // (in which case we treat this RenderView as a top level window). static RenderView* Create( + RenderThreadBase* render_thread, HWND parent_hwnd, HANDLE modal_dialog_event, int32 opener_id, @@ -305,12 +309,18 @@ class RenderView : public RenderWidget, public WebViewDelegate, // This is called from within the renderer, not via an IPC message. void OnDebugDetach(); + int delay_seconds_for_form_state_sync() const { + return delay_seconds_for_form_state_sync_; + } + void set_delay_seconds_for_form_state_sync(int delay_in_seconds) { + delay_seconds_for_form_state_sync_ = delay_in_seconds; + } + private: - RenderView(); + FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText); + FRIEND_TEST(RenderViewTest, OnNavStateChanged); - // When we are created from window.open from an already existing view, this - // constructor stores that view ID. - explicit RenderView(int32 opener_id); + explicit RenderView(RenderThreadBase* render_thread); // Initializes this view with the given parent and ID. The |routing_id| can be // set to 'MSG_ROUTING_NONE' if the true ID is not yet known. In this case, @@ -711,6 +721,12 @@ class RenderView : public RenderWidget, public WebViewDelegate, // from the Browser process telling us otherwise. bool popup_notification_visible_; + // Time in seconds of the delay between syncing page state such as form + // elements and scroll position. This timeout allows us to avoid spamming the + // browser process with every little thing that changes. This normally doesn't + // change but is overridden by tests. + int delay_seconds_for_form_state_sync_; + DISALLOW_COPY_AND_ASSIGN(RenderView); }; |