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

Side by Side Diff: media/base/video_frame_unittest.cc

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « ipc/ipc_message_utils_unittest.cc ('k') | mojo/common/common_custom_types_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback_helpers.h" 11 #include "base/callback_helpers.h"
12 #include "base/format_macros.h" 12 #include "base/format_macros.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/aligned_memory.h" 14 #include "base/memory/aligned_memory.h"
15 #include "base/memory/ptr_util.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "gpu/command_buffer/common/mailbox_holder.h" 17 #include "gpu/command_buffer/common/mailbox_holder.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/libyuv/include/libyuv.h" 19 #include "third_party/libyuv/include/libyuv.h"
19 20
20 namespace media { 21 namespace media {
21 22
22 using base::MD5DigestToBase16; 23 using base::MD5DigestToBase16;
23 24
24 // Helper function that initializes a YV12 frame with white and black scan 25 // Helper function that initializes a YV12 frame with white and black scan
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 533
533 EXPECT_FALSE(metadata.HasKey(key)); 534 EXPECT_FALSE(metadata.HasKey(key));
534 metadata.SetTimeTicks(key, base::TimeTicks::FromInternalValue(~(0LL) + i)); 535 metadata.SetTimeTicks(key, base::TimeTicks::FromInternalValue(~(0LL) + i));
535 EXPECT_TRUE(metadata.HasKey(key)); 536 EXPECT_TRUE(metadata.HasKey(key));
536 base::TimeTicks ticks_value; 537 base::TimeTicks ticks_value;
537 EXPECT_TRUE(metadata.GetTimeTicks(key, &ticks_value)); 538 EXPECT_TRUE(metadata.GetTimeTicks(key, &ticks_value));
538 EXPECT_EQ(base::TimeTicks::FromInternalValue(~(0LL) + i), ticks_value); 539 EXPECT_EQ(base::TimeTicks::FromInternalValue(~(0LL) + i), ticks_value);
539 metadata.Clear(); 540 metadata.Clear();
540 541
541 EXPECT_FALSE(metadata.HasKey(key)); 542 EXPECT_FALSE(metadata.HasKey(key));
542 metadata.SetValue(key, base::Value::CreateNullValue()); 543 metadata.SetValue(key, base::MakeUnique<base::Value>());
543 EXPECT_TRUE(metadata.HasKey(key)); 544 EXPECT_TRUE(metadata.HasKey(key));
544 const base::Value* const null_value = metadata.GetValue(key); 545 const base::Value* const null_value = metadata.GetValue(key);
545 EXPECT_TRUE(null_value); 546 EXPECT_TRUE(null_value);
546 EXPECT_EQ(base::Value::Type::NONE, null_value->GetType()); 547 EXPECT_EQ(base::Value::Type::NONE, null_value->GetType());
547 metadata.Clear(); 548 metadata.Clear();
548 } 549 }
549 } 550 }
550 551
551 TEST(VideoFrameMetadata, PassMetadataViaIntermediary) { 552 TEST(VideoFrameMetadata, PassMetadataViaIntermediary) {
552 VideoFrameMetadata expected; 553 VideoFrameMetadata expected;
553 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 554 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
554 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 555 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
555 expected.SetInteger(key, i); 556 expected.SetInteger(key, i);
556 } 557 }
557 558
558 VideoFrameMetadata result; 559 VideoFrameMetadata result;
559 result.MergeMetadataFrom(&expected); 560 result.MergeMetadataFrom(&expected);
560 561
561 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 562 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
562 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 563 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
563 int value = -1; 564 int value = -1;
564 EXPECT_TRUE(result.GetInteger(key, &value)); 565 EXPECT_TRUE(result.GetInteger(key, &value));
565 EXPECT_EQ(i, value); 566 EXPECT_EQ(i, value);
566 } 567 }
567 } 568 }
568 569
569 } // namespace media 570 } // namespace media
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils_unittest.cc ('k') | mojo/common/common_custom_types_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698