diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-05 16:43:55 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-05 16:43:55 +0000 |
commit | 6f8f8b63fcea1e73107d9cb10122c806c454aca4 (patch) | |
tree | ddf1cfbdb90fd9f02a0b233747b248d061c60c1b /content/test | |
parent | ed81b38b14cd63d20e23fcb126befd0527b4fb36 (diff) | |
download | chromium_src-6f8f8b63fcea1e73107d9cb10122c806c454aca4.zip chromium_src-6f8f8b63fcea1e73107d9cb10122c806c454aca4.tar.gz chromium_src-6f8f8b63fcea1e73107d9cb10122c806c454aca4.tar.bz2 |
Get rid of view_messages.h dependency in extension_messages_browsertest.cc by adding a method to MockRenderThread instead.
BUG=98716
Review URL: http://codereview.chromium.org/8801001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112987 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/test')
-rw-r--r-- | content/test/mock_render_thread.cc | 11 | ||||
-rw-r--r-- | content/test/mock_render_thread.h | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/content/test/mock_render_thread.cc b/content/test/mock_render_thread.cc index eca409e..70de43e 100644 --- a/content/test/mock_render_thread.cc +++ b/content/test/mock_render_thread.cc @@ -19,6 +19,17 @@ MockRenderThread::MockRenderThread() MockRenderThread::~MockRenderThread() { } +void MockRenderThread::VerifyRunJavaScriptMessageSend( + const string16& expected_alert_message) { + const IPC::Message* alert_msg = + sink_.GetUniqueMessageMatching(ViewHostMsg_RunJavaScriptMessage::ID); + ASSERT_TRUE(alert_msg); + void* iter = IPC::SyncMessage::GetDataIterator(alert_msg); + ViewHostMsg_RunJavaScriptMessage::SendParam alert_param; + ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param)); + EXPECT_EQ(expected_alert_message, alert_param.a); +} + // Called by the Widget. Used to send messages to the browser. // We short-circuit the mechanism and handle the messages right here on this // class. diff --git a/content/test/mock_render_thread.h b/content/test/mock_render_thread.h index 4223ab2..3d87ed0 100644 --- a/content/test/mock_render_thread.h +++ b/content/test/mock_render_thread.h @@ -7,6 +7,7 @@ #pragma once #include "base/shared_memory.h" +#include "base/string16.h" #include "content/public/renderer/render_thread.h" #include "ipc/ipc_test_sink.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" @@ -29,6 +30,10 @@ class MockRenderThread : public content::RenderThread { // Provides access to the messages that have been received by this thread. IPC::TestSink& sink() { return sink_; } + // Helpers for embedders to know when content IPC messages are received, since + // they don't have access to content IPC files. + void VerifyRunJavaScriptMessageSend(const string16& expected_alert_message); + // content::RenderThread implementation: virtual bool Send(IPC::Message* msg) OVERRIDE; virtual MessageLoop* GetMessageLoop() OVERRIDE; |