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

Unified Diff: media/base/overlay_info_unittest.cc

Issue 2892083002: Send enter / exit fullscreen signal to AVDA (Closed)
Patch Set: more cl feedback Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: media/base/overlay_info_unittest.cc
diff --git a/media/base/overlay_info_unittest.cc b/media/base/overlay_info_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1b43a60f5fdd31f4a6c8217976a9b6981277682c
--- /dev/null
+++ b/media/base/overlay_info_unittest.cc
@@ -0,0 +1,51 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/overlay_info.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+using UnguessableToken = base::UnguessableToken;
+using RoutingToken = OverlayInfo::RoutingToken;
+
+// Test that MergeWith handles |member_ptr|. |some_value| and |other_value|
+// should be two unequal values for |MemberType|.
+template <typename MemberType>
+void MergeWithHelper(base::Optional<MemberType> OverlayInfo::*member_ptr,
+ MemberType some_value,
+ MemberType other_value) {
+ // Sanity.
+ EXPECT_NE(some_value, other_value);
+
+ OverlayInfo source;
+ source.*member_ptr = some_value;
+
+ OverlayInfo dest;
+
+ // Make sure that it works with no value.
+ dest.MergeWith(source);
+ EXPECT_EQ(source.*member_ptr, dest.*member_ptr);
+
+ // Try replacing an existing value.
+ dest.*member_ptr = other_value;
+ dest.MergeWith(source);
+ EXPECT_EQ(source.*member_ptr, dest.*member_ptr);
+}
+
+TEST(OverlayInfo, MergeWithHandlesSurfaceId) {
+ MergeWithHelper(&OverlayInfo::surface_id, 123, 234);
+}
+
+TEST(OverlayInfo, MergeWithHandlesRoutingToken) {
+ MergeWithHelper(&OverlayInfo::routing_token,
+ RoutingToken(UnguessableToken::Create()),
+ RoutingToken(UnguessableToken::Create()));
+}
+
+TEST(OverlayInfo, MergeWithHandlesIsFullscreen) {
+ MergeWithHelper(&OverlayInfo::is_fullscreen, true, false);
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698