Commit 0c527966 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Replace use of std containers with WTF's equivalents in screen_orientation_controller_impl_test.cc

Replace the use of std::map of std containers with WTF::HashMap
in screen_orientation_controller_impl_test.cc.

Bug: 952716
Change-Id: Idb53fa6890aed3120224f5027d8791301416f9e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1580685Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#653491}
parent 23416d1c
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
#include "third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller_impl.h" #include "third_party/blink/renderer/modules/screen_orientation/screen_orientation_controller_impl.h"
#include <map>
#include <memory> #include <memory>
#include "mojo/public/cpp/bindings/associated_interface_ptr.h" #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h" #include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/modules/screen_orientation/web_lock_orientation_callback.h" #include "third_party/blink/renderer/modules/screen_orientation/web_lock_orientation_callback.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
namespace blink { namespace blink {
...@@ -120,25 +120,25 @@ TEST_F(ScreenOrientationControllerImplTest, CancelPending_DoubleLock) { ...@@ -120,25 +120,25 @@ TEST_F(ScreenOrientationControllerImplTest, CancelPending_DoubleLock) {
// Test that when a LockError message is received, the request is set as failed // Test that when a LockError message is received, the request is set as failed
// with the correct values. // with the correct values.
TEST_F(ScreenOrientationControllerImplTest, LockRequest_Error) { TEST_F(ScreenOrientationControllerImplTest, LockRequest_Error) {
std::map<LockResult, blink::WebLockOrientationError> errors; HashMap<LockResult, blink::WebLockOrientationError, WTF::IntHash<LockResult>>
errors[LockResult::SCREEN_ORIENTATION_LOCK_RESULT_ERROR_NOT_AVAILABLE] = errors;
blink::kWebLockOrientationErrorNotAvailable; errors.insert(LockResult::SCREEN_ORIENTATION_LOCK_RESULT_ERROR_NOT_AVAILABLE,
errors[LockResult::SCREEN_ORIENTATION_LOCK_RESULT_ERROR_FULLSCREEN_REQUIRED] = blink::kWebLockOrientationErrorNotAvailable);
blink::kWebLockOrientationErrorFullscreenRequired; errors.insert(
errors[LockResult::SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED] = LockResult::SCREEN_ORIENTATION_LOCK_RESULT_ERROR_FULLSCREEN_REQUIRED,
blink::kWebLockOrientationErrorCanceled; blink::kWebLockOrientationErrorFullscreenRequired);
errors.insert(LockResult::SCREEN_ORIENTATION_LOCK_RESULT_ERROR_CANCELED,
for (std::map<LockResult, blink::WebLockOrientationError>::const_iterator it = blink::kWebLockOrientationErrorCanceled);
errors.begin();
it != errors.end(); ++it) { for (auto it = errors.begin(); it != errors.end(); ++it) {
MockLockOrientationCallback::LockOrientationResultHolder callback_results; MockLockOrientationCallback::LockOrientationResultHolder callback_results;
LockOrientation( LockOrientation(
blink::kWebScreenOrientationLockPortraitPrimary, blink::kWebScreenOrientationLockPortraitPrimary,
std::make_unique<MockLockOrientationCallback>(&callback_results)); std::make_unique<MockLockOrientationCallback>(&callback_results));
RunLockResultCallback(GetRequestId(), it->first); RunLockResultCallback(GetRequestId(), it->key);
EXPECT_FALSE(callback_results.succeeded_); EXPECT_FALSE(callback_results.succeeded_);
EXPECT_TRUE(callback_results.failed_); EXPECT_TRUE(callback_results.failed_);
EXPECT_EQ(it->second, callback_results.error_); EXPECT_EQ(it->value, callback_results.error_);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment