| Index: content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
|
| 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 c7a91027db7fdae30d8fbaeac38057327a28f50f..b652413d4cbc76c0fa78d2f12312a692cf3e305d 100644
|
| --- a/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
|
| +++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host_unittest.cc
|
| @@ -2,12 +2,15 @@
|
| // 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"
|
| @@ -50,7 +53,7 @@
|
| public ScreenOrientationDispatcherHost {
|
| public:
|
| explicit ScreenOrientationDispatcherHostWithSink(IPC::TestSink* sink)
|
| - : ScreenOrientationDispatcherHost(NULL), sink_(sink) {}
|
| + : ScreenOrientationDispatcherHost() , sink_(sink) {}
|
|
|
| virtual bool Send(IPC::Message* message) OVERRIDE {
|
| return sink_->Send(message);
|
| @@ -65,24 +68,19 @@
|
| class ScreenOrientationDispatcherHostTest : public testing::Test {
|
| protected:
|
| virtual ScreenOrientationDispatcherHost* CreateDispatcher() {
|
| - return new ScreenOrientationDispatcherHost(NULL);
|
| + return new ScreenOrientationDispatcherHost();
|
| }
|
|
|
| virtual void SetUp() OVERRIDE {
|
| provider_ = new MockScreenOrientationProvider();
|
|
|
| - dispatcher_.reset(CreateDispatcher());
|
| + dispatcher_ = 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_ptr<ScreenOrientationDispatcherHost> dispatcher_;
|
| + scoped_refptr<ScreenOrientationDispatcherHost> dispatcher_;
|
| };
|
|
|
| class ScreenOrientationDispatcherHostWithSinkTest :
|
| @@ -125,8 +123,7 @@
|
| blink::WebScreenOrientationLockType orientation = orientationsToTest[i];
|
|
|
| message_was_handled = dispatcher_->OnMessageReceived(
|
| - ScreenOrientationHostMsg_LockRequest(routing_id(), orientation, 0),
|
| - NULL);
|
| + ScreenOrientationHostMsg_LockRequest(orientation, 0));
|
|
|
| EXPECT_TRUE(message_was_handled);
|
| EXPECT_EQ(orientation, provider_->orientation());
|
| @@ -137,7 +134,7 @@
|
| // ScreenOrientationProvider.
|
| TEST_F(ScreenOrientationDispatcherHostTest, ProviderUnlock) {
|
| bool message_was_handled = dispatcher_->OnMessageReceived(
|
| - ScreenOrientationHostMsg_Unlock(routing_id()), NULL);
|
| + ScreenOrientationHostMsg_Unlock());
|
|
|
| EXPECT_TRUE(message_was_handled);
|
| EXPECT_TRUE(provider_->unlock_called());
|
| @@ -150,9 +147,7 @@
|
|
|
| const int request_id = 3;
|
| dispatcher_->OnMessageReceived(ScreenOrientationHostMsg_LockRequest(
|
| - routing_id(),
|
| - blink::WebScreenOrientationLockPortraitPrimary,
|
| - request_id), NULL);
|
| + blink::WebScreenOrientationLockPortraitPrimary, request_id));
|
|
|
| EXPECT_EQ(1u, sink().message_count());
|
|
|
| @@ -173,9 +168,7 @@
|
| TEST_F(ScreenOrientationDispatcherHostWithSinkTest, WithProvider_LockSuccess) {
|
| const int request_id = 42;
|
| dispatcher_->OnMessageReceived(ScreenOrientationHostMsg_LockRequest(
|
| - routing_id(),
|
| - blink::WebScreenOrientationLockPortraitPrimary,
|
| - request_id), NULL);
|
| + blink::WebScreenOrientationLockPortraitPrimary, request_id));
|
|
|
| EXPECT_EQ(1u, sink().message_count());
|
|
|
|
|