summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-15 16:01:45 +0000
committermlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-15 16:01:45 +0000
commit67a505915359ef85c416d4edfba3827808bdd9b9 (patch)
treec37a419f3d8d791297c45feba065b2b859dc9646
parent043181264edd6c7082ba5bcc6b30ac3d777da557 (diff)
downloadchromium_src-67a505915359ef85c416d4edfba3827808bdd9b9.zip
chromium_src-67a505915359ef85c416d4edfba3827808bdd9b9.tar.gz
chromium_src-67a505915359ef85c416d4edfba3827808bdd9b9.tar.bz2
Properly route screen orientation IPC messages.
The messages will now go trough RF/RFH. This is in order to make screen orientation lock Frame specific instead of global to Chromium. The next step is to change the provider accordingly. BUG=162827 Review URL: https://codereview.chromium.org/327573002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277321 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/android/content_view_core_impl.cc32
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc11
-rw-r--r--content/browser/renderer_host/render_process_host_impl.h7
-rw-r--r--content/browser/screen_orientation/screen_orientation_dispatcher_host.cc30
-rw-r--r--content/browser/screen_orientation/screen_orientation_dispatcher_host.h28
-rw-r--r--content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc33
-rw-r--r--content/browser/web_contents/web_contents_impl.cc4
-rw-r--r--content/browser/web_contents/web_contents_impl.h4
-rw-r--r--content/common/screen_orientation_messages.h23
-rw-r--r--content/renderer/screen_orientation/screen_orientation_dispatcher.cc5
-rw-r--r--content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc14
11 files changed, 90 insertions, 101 deletions
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 0fdc058..2335d0a 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -1542,38 +1542,6 @@ void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
if (rwhv)
rwhv->UpdateScreenInfo(GetViewAndroid());
-
- // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change
- // in the future. The OnResize IPC message sent from UpdateScreenInfo() will
- // propagate the information.
- blink::WebScreenOrientationType orientation =
- blink::WebScreenOrientationPortraitPrimary;
-
- switch (device_orientation_) {
- case 0:
- orientation = blink::WebScreenOrientationPortraitPrimary;
- break;
- case 90:
- orientation = blink::WebScreenOrientationLandscapePrimary;
- break;
- case -90:
- orientation = blink::WebScreenOrientationLandscapeSecondary;
- break;
- case 180:
- orientation = blink::WebScreenOrientationPortraitSecondary;
- break;
- default:
- NOTREACHED();
- }
-
- ScreenOrientationDispatcherHost* sodh =
- static_cast<RenderProcessHostImpl*>(web_contents_->
- GetRenderProcessHost())->screen_orientation_dispatcher_host();
-
- // sodh can be null if the RenderProcessHost is in the process of being
- // destroyed or not yet initialized.
- if (sodh)
- sodh->OnOrientationChange(orientation);
}
void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 403f885..de8f5b4 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -96,7 +96,6 @@
#include "content/browser/renderer_host/text_input_client_message_filter.h"
#include "content/browser/renderer_host/websocket_dispatcher_host.h"
#include "content/browser/resolve_proxy_msg_helper.h"
-#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/service_worker/service_worker_dispatcher_host.h"
#include "content/browser/shared_worker/shared_worker_message_filter.h"
@@ -460,7 +459,6 @@ RenderProcessHostImpl::RenderProcessHostImpl(
delayed_cleanup_needed_(false),
within_process_died_observer_(false),
power_monitor_broadcaster_(this),
- screen_orientation_dispatcher_host_(NULL),
worker_ref_count_(0),
weak_factory_(this) {
widget_helper_ = new RenderWidgetHelper();
@@ -884,8 +882,6 @@ void RenderProcessHostImpl::CreateMessageFilters() {
AddFilter(new MemoryBenchmarkMessageFilter());
#endif
AddFilter(new VibrationMessageFilter());
- screen_orientation_dispatcher_host_ = new ScreenOrientationDispatcherHost();
- AddFilter(screen_orientation_dispatcher_host_);
AddFilter(new PushMessagingMessageFilter(GetID()));
AddFilter(new BatteryStatusMessageFilter());
}
@@ -1504,7 +1500,6 @@ void RenderProcessHostImpl::Cleanup() {
channel_.reset();
gpu_message_filter_ = NULL;
message_port_message_filter_ = NULL;
- screen_orientation_dispatcher_host_ = NULL;
RemoveUserData(kSessionStorageHolderKey);
// Remove ourself from the list of renderer processes so that we can't be
@@ -1918,7 +1913,6 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead) {
channel_.reset();
gpu_message_filter_ = NULL;
message_port_message_filter_ = NULL;
- screen_orientation_dispatcher_host_ = NULL;
RemoveUserData(kSessionStorageHolderKey);
IDMap<IPC::Listener>::iterator iter(&listeners_);
@@ -1983,11 +1977,6 @@ void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) {
}
#endif
-scoped_refptr<ScreenOrientationDispatcherHost>
-RenderProcessHostImpl::screen_orientation_dispatcher_host() const {
- return make_scoped_refptr(screen_orientation_dispatcher_host_);
-}
-
void RenderProcessHostImpl::ReleaseOnCloseACK(
RenderProcessHost* host,
const SessionStorageNamespaceMap& sessions,
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index cd7ec89..32e342d 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -56,7 +56,6 @@ class RenderWidgetHelper;
class RenderWidgetHost;
class RenderWidgetHostImpl;
class RenderWidgetHostViewFrameSubscriber;
-class ScreenOrientationDispatcherHost;
class StoragePartition;
class StoragePartitionImpl;
@@ -181,9 +180,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
void WebRtcLogMessage(const std::string& message);
#endif
- scoped_refptr<ScreenOrientationDispatcherHost>
- screen_orientation_dispatcher_host() const;
-
// Used to extend the lifetime of the sessions until the render view
// in the renderer is fully closed. This is static because its also called
// with mock hosts as input in test cases.
@@ -451,9 +447,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
WebRtcStopRtpDumpCallback stop_rtp_dump_callback_;
#endif
- // Message filter and dispatcher for screen orientation.
- ScreenOrientationDispatcherHost* screen_orientation_dispatcher_host_;
-
int worker_ref_count_;
// Records the time when the process starts surviving for workers for UMA.
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc b/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
index 3bb494d..a27890e 100644
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
+++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
@@ -6,11 +6,14 @@
#include "content/browser/screen_orientation/screen_orientation_provider.h"
#include "content/common/screen_orientation_messages.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
namespace content {
-ScreenOrientationDispatcherHost::ScreenOrientationDispatcherHost()
- : BrowserMessageFilter(ScreenOrientationMsgStart) {
+ScreenOrientationDispatcherHost::ScreenOrientationDispatcherHost(
+ WebContents* web_contents)
+ : WebContentsObserver(web_contents) {
if (!provider_.get())
provider_.reset(CreateProvider());
}
@@ -19,10 +22,13 @@ ScreenOrientationDispatcherHost::~ScreenOrientationDispatcherHost() {
}
bool ScreenOrientationDispatcherHost::OnMessageReceived(
- const IPC::Message& message) {
+ const IPC::Message& message,
+ RenderFrameHost* render_frame_host) {
bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(ScreenOrientationDispatcherHost, message)
+ int routing_id = message.routing_id();
+ IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(ScreenOrientationDispatcherHost, message,
+ &routing_id)
IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_LockRequest, OnLockRequest)
IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_Unlock, OnUnlockRequest)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -42,24 +48,28 @@ void ScreenOrientationDispatcherHost::SetProviderForTests(
}
void ScreenOrientationDispatcherHost::OnLockRequest(
+ int* routing_id,
blink::WebScreenOrientationLockType orientation,
int request_id) {
if (!provider_) {
Send(new ScreenOrientationMsg_LockError(
- request_id,
- blink::WebLockOrientationCallback::ErrorTypeNotAvailable));
+ *routing_id,
+ request_id,
+ blink::WebLockOrientationCallback::ErrorTypeNotAvailable));
return;
}
// TODO(mlamouri): pass real values.
Send(new ScreenOrientationMsg_LockSuccess(
- request_id,
- 0,
- blink::WebScreenOrientationPortraitPrimary));
+ *routing_id,
+ request_id,
+ 0,
+ blink::WebScreenOrientationPortraitPrimary));
provider_->LockOrientation(orientation);
}
-void ScreenOrientationDispatcherHost::OnUnlockRequest() {
+void ScreenOrientationDispatcherHost::OnUnlockRequest(
+ int* routing_id) {
if (!provider_.get())
return;
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host.h b/content/browser/screen_orientation/screen_orientation_dispatcher_host.h
index 363c08c..9f328f6c 100644
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host.h
+++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host.h
@@ -5,36 +5,38 @@
#ifndef CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_SCREEN_ORIENTATION_SCREEN_ORIENTATION_DISPATCHER_HOST_H_
-#include "content/public/browser/browser_message_filter.h"
+#include "content/public/browser/web_contents_observer.h"
#include "third_party/WebKit/public/platform/WebScreenOrientationLockType.h"
#include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
namespace content {
+class RenderFrameHost;
class ScreenOrientationProvider;
+class WebContents;
-// ScreenOrientationDispatcherHost is a browser filter for Screen Orientation
-// messages and also helps dispatching messages about orientation changes to the
-// renderers.
+// ScreenOrientationDispatcherHost is receives lock and unlock requests from the
+// RenderFrames and dispatch them to the ScreenOrientationProvider. It also
+// make sure that the right RenderFrame get replied for each lock request.
class CONTENT_EXPORT ScreenOrientationDispatcherHost
- : public BrowserMessageFilter {
+ : public WebContentsObserver {
public:
- ScreenOrientationDispatcherHost();
+ explicit ScreenOrientationDispatcherHost(WebContents* web_contents);
+ virtual ~ScreenOrientationDispatcherHost();
- // BrowserMessageFilter
- virtual bool OnMessageReceived(const IPC::Message&) OVERRIDE;
+ // WebContentsObserver
+ virtual bool OnMessageReceived(const IPC::Message&,
+ RenderFrameHost* render_frame_host) OVERRIDE;
void OnOrientationChange(blink::WebScreenOrientationType orientation);
void SetProviderForTests(ScreenOrientationProvider* provider);
- protected:
- virtual ~ScreenOrientationDispatcherHost();
-
private:
- void OnLockRequest(blink::WebScreenOrientationLockType orientation,
+ void OnLockRequest(int* routing_id,
+ blink::WebScreenOrientationLockType orientation,
int request_id);
- void OnUnlockRequest();
+ void OnUnlockRequest(int* routing_id);
static ScreenOrientationProvider* CreateProvider();
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc b/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
index b652413..c7a9102 100644
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
+++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
@@ -2,15 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
+
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
#include "content/browser/screen_orientation/screen_orientation_provider.h"
#include "content/common/screen_orientation_messages.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/test/mock_render_process_host.h"
-#include "content/public/test/test_browser_context.h"
-#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.h"
#include "ipc/ipc_test_sink.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -53,7 +50,7 @@ class ScreenOrientationDispatcherHostWithSink FINAL :
public ScreenOrientationDispatcherHost {
public:
explicit ScreenOrientationDispatcherHostWithSink(IPC::TestSink* sink)
- : ScreenOrientationDispatcherHost() , sink_(sink) {}
+ : ScreenOrientationDispatcherHost(NULL), sink_(sink) {}
virtual bool Send(IPC::Message* message) OVERRIDE {
return sink_->Send(message);
@@ -68,19 +65,24 @@ class ScreenOrientationDispatcherHostWithSink FINAL :
class ScreenOrientationDispatcherHostTest : public testing::Test {
protected:
virtual ScreenOrientationDispatcherHost* CreateDispatcher() {
- return new ScreenOrientationDispatcherHost();
+ return new ScreenOrientationDispatcherHost(NULL);
}
virtual void SetUp() OVERRIDE {
provider_ = new MockScreenOrientationProvider();
- dispatcher_ = CreateDispatcher();
+ dispatcher_.reset(CreateDispatcher());
dispatcher_->SetProviderForTests(provider_);
}
+ int routing_id() const {
+ // We return a fake routing_id() in the context of this test.
+ return 0;
+ }
+
// The dispatcher_ owns the provider_ but we still want to access it.
MockScreenOrientationProvider* provider_;
- scoped_refptr<ScreenOrientationDispatcherHost> dispatcher_;
+ scoped_ptr<ScreenOrientationDispatcherHost> dispatcher_;
};
class ScreenOrientationDispatcherHostWithSinkTest :
@@ -123,7 +125,8 @@ TEST_F(ScreenOrientationDispatcherHostWithSinkTest, ProviderLock) {
blink::WebScreenOrientationLockType orientation = orientationsToTest[i];
message_was_handled = dispatcher_->OnMessageReceived(
- ScreenOrientationHostMsg_LockRequest(orientation, 0));
+ ScreenOrientationHostMsg_LockRequest(routing_id(), orientation, 0),
+ NULL);
EXPECT_TRUE(message_was_handled);
EXPECT_EQ(orientation, provider_->orientation());
@@ -134,7 +137,7 @@ TEST_F(ScreenOrientationDispatcherHostWithSinkTest, ProviderLock) {
// ScreenOrientationProvider.
TEST_F(ScreenOrientationDispatcherHostTest, ProviderUnlock) {
bool message_was_handled = dispatcher_->OnMessageReceived(
- ScreenOrientationHostMsg_Unlock());
+ ScreenOrientationHostMsg_Unlock(routing_id()), NULL);
EXPECT_TRUE(message_was_handled);
EXPECT_TRUE(provider_->unlock_called());
@@ -147,7 +150,9 @@ TEST_F(ScreenOrientationDispatcherHostWithSinkTest, NoProvider_LockError) {
const int request_id = 3;
dispatcher_->OnMessageReceived(ScreenOrientationHostMsg_LockRequest(
- blink::WebScreenOrientationLockPortraitPrimary, request_id));
+ routing_id(),
+ blink::WebScreenOrientationLockPortraitPrimary,
+ request_id), NULL);
EXPECT_EQ(1u, sink().message_count());
@@ -168,7 +173,9 @@ TEST_F(ScreenOrientationDispatcherHostWithSinkTest, NoProvider_LockError) {
TEST_F(ScreenOrientationDispatcherHostWithSinkTest, WithProvider_LockSuccess) {
const int request_id = 42;
dispatcher_->OnMessageReceived(ScreenOrientationHostMsg_LockRequest(
- blink::WebScreenOrientationLockPortraitPrimary, request_id));
+ routing_id(),
+ blink::WebScreenOrientationLockPortraitPrimary,
+ request_id), NULL);
EXPECT_EQ(1u, sink().message_count());
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 9f6ead2..b76a165 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -45,6 +45,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/web_contents/web_contents_view_guest.h"
#include "content/browser/webui/generic_handler.h"
@@ -1097,6 +1098,9 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
geolocation_dispatcher_host_.reset(new GeolocationDispatcherHost(this));
midi_dispatcher_host_.reset(new MidiDispatcherHost(this));
+ screen_orientation_dispatcher_host_.reset(
+ new ScreenOrientationDispatcherHost(this));
+
#if defined(OS_ANDROID)
date_time_chooser_.reset(new DateTimeChooserAndroid());
#endif
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 40228db..40e0fe4 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -57,6 +57,7 @@ class RenderViewHostDelegateView;
class RenderViewHostImpl;
class RenderWidgetHostImpl;
class SavePackage;
+class ScreenOrientationDispatcherHost;
class SiteInstance;
class TestWebContents;
class WebContentsDelegate;
@@ -1134,6 +1135,9 @@ class CONTENT_EXPORT WebContentsImpl
scoped_ptr<MidiDispatcherHost> midi_dispatcher_host_;
+ scoped_ptr<ScreenOrientationDispatcherHost>
+ screen_orientation_dispatcher_host_;
+
DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
};
diff --git a/content/common/screen_orientation_messages.h b/content/common/screen_orientation_messages.h
index 5a845e7..b7336d6 100644
--- a/content/common/screen_orientation_messages.h
+++ b/content/common/screen_orientation_messages.h
@@ -29,6 +29,7 @@ IPC_ENUM_TRAITS_MIN_MAX_VALUE(
// The browser process informs the renderer process that the screen orientation
// has changed. |orientation| contains the new screen orientation in degrees.
+// TODO(mlamouri): we could probably get rid of it.
IPC_MESSAGE_CONTROL1(ScreenOrientationMsg_OrientationChange,
blink::WebScreenOrientationType /* orientation */ )
@@ -36,28 +37,28 @@ IPC_MESSAGE_CONTROL1(ScreenOrientationMsg_OrientationChange,
// the lock actually succeeded. The message includes the new |angle| and |type|
// of orientation. The |request_id| passed when receiving the request is passed
// back so the renderer process can associate the response to the right request.
-IPC_MESSAGE_CONTROL3(ScreenOrientationMsg_LockSuccess,
- int, /* request_id */
- unsigned, /* angle */
- blink::WebScreenOrientationType /* type */)
+IPC_MESSAGE_ROUTED3(ScreenOrientationMsg_LockSuccess,
+ int, /* request_id */
+ unsigned, /* angle */
+ blink::WebScreenOrientationType /* type */)
// The browser process' response to a ScreenOrientationHostMsg_LockRequest when
// the lock actually failed. The message includes the |error| type. The
// |request_id| passed when receiving the request is passed back so the renderer
// process can associate the response to the right request.
-IPC_MESSAGE_CONTROL2(ScreenOrientationMsg_LockError,
- int, /* request_id */
- blink::WebLockOrientationCallback::ErrorType /* error */);
+IPC_MESSAGE_ROUTED2(ScreenOrientationMsg_LockError,
+ int, /* request_id */
+ blink::WebLockOrientationCallback::ErrorType /* error */);
// The renderer process requests the browser process to lock the screen
// orientation to the specified |orientations|. The request contains a
// |request_id| that will have to be passed back to the renderer process when
// notifying about a success or error (see ScreenOrientationMsg_LockError and
// ScreenOrientationMsg_LockSuccess).
-IPC_MESSAGE_CONTROL2(ScreenOrientationHostMsg_LockRequest,
- blink::WebScreenOrientationLockType, /* orientation */
- int /* request_id */)
+IPC_MESSAGE_ROUTED2(ScreenOrientationHostMsg_LockRequest,
+ blink::WebScreenOrientationLockType, /* orientation */
+ int /* request_id */)
// The renderer process requests the browser process to unlock the screen
// orientation.
-IPC_MESSAGE_CONTROL0(ScreenOrientationHostMsg_Unlock)
+IPC_MESSAGE_ROUTED0(ScreenOrientationHostMsg_Unlock)
diff --git a/content/renderer/screen_orientation/screen_orientation_dispatcher.cc b/content/renderer/screen_orientation/screen_orientation_dispatcher.cc
index 91a36e3..e67cc73 100644
--- a/content/renderer/screen_orientation/screen_orientation_dispatcher.cc
+++ b/content/renderer/screen_orientation/screen_orientation_dispatcher.cc
@@ -69,12 +69,13 @@ void ScreenOrientationDispatcher::lockOrientation(
CancelPendingLocks();
int request_id = pending_callbacks_.Add(callback);
- Send(new ScreenOrientationHostMsg_LockRequest(orientation, request_id));
+ Send(new ScreenOrientationHostMsg_LockRequest(
+ routing_id(), orientation, request_id));
}
void ScreenOrientationDispatcher::unlockOrientation() {
CancelPendingLocks();
- Send(new ScreenOrientationHostMsg_Unlock);
+ Send(new ScreenOrientationHostMsg_Unlock(routing_id()));
}
} // namespace content
diff --git a/content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc b/content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc
index 2bc542b..461533e 100644
--- a/content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc
+++ b/content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc
@@ -105,6 +105,11 @@ class ScreenOrientationDispatcherTest : public testing::Test {
dispatcher_->OnMessageReceived(message);
}
+ int routing_id() const {
+ // We return a fake routing_id() in the context of this test.
+ return 0;
+ }
+
IPC::TestSink sink_;
scoped_ptr<ScreenOrientationDispatcher> dispatcher_;
};
@@ -156,7 +161,8 @@ TEST_F(ScreenOrientationDispatcherTest, LockRequest_Error) {
new MockLockOrientationCallback(&callback_results));
int request_id = GetFirstLockRequestIdFromSink();
- OnMessageReceived(ScreenOrientationMsg_LockError(request_id, *it));
+ OnMessageReceived(
+ ScreenOrientationMsg_LockError(routing_id(), request_id, *it));
EXPECT_FALSE(callback_results.succeeded_);
EXPECT_TRUE(callback_results.failed_);
@@ -187,7 +193,8 @@ TEST_F(ScreenOrientationDispatcherTest, LockRequest_Success) {
new MockLockOrientationCallback(&callback_results));
int request_id = GetFirstLockRequestIdFromSink();
- OnMessageReceived(ScreenOrientationMsg_LockSuccess(request_id,
+ OnMessageReceived(ScreenOrientationMsg_LockSuccess(routing_id(),
+ request_id,
orientations[i].angle,
orientations[i].type));
@@ -209,6 +216,7 @@ TEST_F(ScreenOrientationDispatcherTest, SuccessForUnknownRequest) {
int request_id = GetFirstLockRequestIdFromSink();
OnMessageReceived(ScreenOrientationMsg_LockSuccess(
+ routing_id(),
request_id + 1,
90,
blink::WebScreenOrientationLandscapePrimary));
@@ -226,6 +234,7 @@ TEST_F(ScreenOrientationDispatcherTest, ErrorForUnknownRequest) {
int request_id = GetFirstLockRequestIdFromSink();
OnMessageReceived(ScreenOrientationMsg_LockError(
+ routing_id(),
request_id + 1,
blink::WebLockOrientationCallback::ErrorTypeCanceled));
@@ -253,6 +262,7 @@ TEST_F(ScreenOrientationDispatcherTest, RaceScenario) {
// callback_results1 must be rejected, tested in CancelPending_DoubleLock.
OnMessageReceived(ScreenOrientationMsg_LockSuccess(
+ routing_id(),
request_id1,
0,
blink::WebScreenOrientationPortraitPrimary));