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

Side by Side Diff: content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" 5 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
6 6
7 #include <list> 7 #include <list>
8 #include <memory>
8 9
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/common/screen_orientation_messages.h" 11 #include "content/common/screen_orientation_messages.h"
12 #include "content/public/test/test_utils.h" 12 #include "content/public/test/test_utils.h"
13 #include "ipc/ipc_test_sink.h" 13 #include "ipc/ipc_test_sink.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebLockO rientationCallback.h" 15 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebLockO rientationCallback.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 // MockLockOrientationCallback is an implementation of 19 // MockLockOrientationCallback is an implementation of
20 // WebLockOrientationCallback and takes a LockOrientationResultHolder* as a 20 // WebLockOrientationCallback and takes a LockOrientationResultHolder* as a
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void OnMessageReceived(const IPC::Message& message) { 93 void OnMessageReceived(const IPC::Message& message) {
94 dispatcher_->OnMessageReceived(message); 94 dispatcher_->OnMessageReceived(message);
95 } 95 }
96 96
97 int routing_id() const { 97 int routing_id() const {
98 // We return a fake routing_id() in the context of this test. 98 // We return a fake routing_id() in the context of this test.
99 return 0; 99 return 0;
100 } 100 }
101 101
102 IPC::TestSink sink_; 102 IPC::TestSink sink_;
103 scoped_ptr<ScreenOrientationDispatcher> dispatcher_; 103 std::unique_ptr<ScreenOrientationDispatcher> dispatcher_;
104 }; 104 };
105 105
106 // Test that calling lockOrientation() followed by unlockOrientation() cancel 106 // Test that calling lockOrientation() followed by unlockOrientation() cancel
107 // the lockOrientation(). 107 // the lockOrientation().
108 TEST_F(ScreenOrientationDispatcherTest, CancelPending_Unlocking) { 108 TEST_F(ScreenOrientationDispatcherTest, CancelPending_Unlocking) {
109 MockLockOrientationCallback::LockOrientationResultHolder callback_results; 109 MockLockOrientationCallback::LockOrientationResultHolder callback_results;
110 LockOrientation(blink::WebScreenOrientationLockPortraitPrimary, 110 LockOrientation(blink::WebScreenOrientationLockPortraitPrimary,
111 new MockLockOrientationCallback(&callback_results)); 111 new MockLockOrientationCallback(&callback_results));
112 UnlockOrientation(); 112 UnlockOrientation();
113 113
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 EXPECT_FALSE(callback_results1.succeeded_); 232 EXPECT_FALSE(callback_results1.succeeded_);
233 EXPECT_TRUE(callback_results1.failed_); 233 EXPECT_TRUE(callback_results1.failed_);
234 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_); 234 EXPECT_EQ(blink::WebLockOrientationErrorCanceled, callback_results1.error_);
235 235
236 // Second request is still pending. 236 // Second request is still pending.
237 EXPECT_FALSE(callback_results2.succeeded_); 237 EXPECT_FALSE(callback_results2.succeeded_);
238 EXPECT_FALSE(callback_results2.failed_); 238 EXPECT_FALSE(callback_results2.failed_);
239 } 239 }
240 240
241 } // namespace content 241 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698