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

Side by Side Diff: third_party/WebKit/Source/platform/blob/BlobDataTest.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "platform/blob/BlobData.h" 5 #include "platform/blob/BlobData.h"
6 6
7 #include "testing/gmock/include/gmock/gmock.h" 7 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "wtf/OwnPtr.h" 9 #include "wtf/PtrUtil.h"
10 #include "wtf/PassOwnPtr.h" 10 #include <memory>
11 11
12 namespace blink { 12 namespace blink {
13 13
14 TEST(BlobDataTest, Consolidation) 14 TEST(BlobDataTest, Consolidation)
15 { 15 {
16 const size_t kMaxConsolidatedItemSizeInBytes = 15 * 1024; 16 const size_t kMaxConsolidatedItemSizeInBytes = 15 * 1024;
17 BlobData data; 17 BlobData data;
18 const char* text1 = "abc"; 18 const char* text1 = "abc";
19 const char* text2 = "def"; 19 const char* text2 = "def";
20 data.appendBytes(text1, 3u); 20 data.appendBytes(text1, 3u);
21 data.appendBytes(text2, 3u); 21 data.appendBytes(text2, 3u);
22 data.appendText("ps1", false); 22 data.appendText("ps1", false);
23 data.appendText("ps2", false); 23 data.appendText("ps2", false);
24 24
25 25
26 EXPECT_EQ(1u, data.m_items.size()); 26 EXPECT_EQ(1u, data.m_items.size());
27 EXPECT_EQ(12u, data.m_items[0].data->length()); 27 EXPECT_EQ(12u, data.m_items[0].data->length());
28 EXPECT_EQ(0, memcmp(data.m_items[0].data->data(), "abcdefps1ps2", 12)); 28 EXPECT_EQ(0, memcmp(data.m_items[0].data->data(), "abcdefps1ps2", 12));
29 29
30 30
31 OwnPtr<char[]> large_data = adoptArrayPtr(new char[kMaxConsolidatedItemSizeI nBytes]); 31 std::unique_ptr<char[]> large_data = wrapArrayUnique(new char[kMaxConsolidat edItemSizeInBytes]);
32 data.appendBytes(large_data.get(), kMaxConsolidatedItemSizeInBytes); 32 data.appendBytes(large_data.get(), kMaxConsolidatedItemSizeInBytes);
33 33
34 EXPECT_EQ(2u, data.m_items.size()); 34 EXPECT_EQ(2u, data.m_items.size());
35 EXPECT_EQ(12u, data.m_items[0].data->length()); 35 EXPECT_EQ(12u, data.m_items[0].data->length());
36 EXPECT_EQ(kMaxConsolidatedItemSizeInBytes, data.m_items[1].data->length()); 36 EXPECT_EQ(kMaxConsolidatedItemSizeInBytes, data.m_items[1].data->length());
37 } 37 }
38 38
39 } // namespace blink 39 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/blob/BlobData.cpp ('k') | third_party/WebKit/Source/platform/blob/BlobRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698