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

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

Issue 2700123003: DO NOT COMMIT: Results of running old (current) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 <memory>
7 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
8 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 #include "wtf/PtrUtil.h" 10 #include "wtf/PtrUtil.h"
10 #include <memory>
11 11
12 namespace blink { 12 namespace blink {
13 13
14 TEST(BlobDataTest, Consolidation) { 14 TEST(BlobDataTest, Consolidation) {
15 const size_t kMaxConsolidatedItemSizeInBytes = 15 * 1024; 15 const size_t kMaxConsolidatedItemSizeInBytes = 15 * 1024;
16 BlobData data(BlobData::FileCompositionStatus::NO_UNKNOWN_SIZE_FILES); 16 BlobData data(BlobData::FileCompositionStatus::NO_UNKNOWN_SIZE_FILES);
17 const char* text1 = "abc"; 17 const char* text1 = "abc";
18 const char* text2 = "def"; 18 const char* text2 = "def";
19 data.appendBytes(text1, 3u); 19 data.appendBytes(text1, 3u);
20 data.appendBytes(text2, 3u); 20 data.appendBytes(text2, 3u);
21 data.appendText("ps1", false); 21 data.appendText("ps1", false);
22 data.appendText("ps2", false); 22 data.appendText("ps2", false);
23 23
24 EXPECT_EQ(1u, data.m_items.size()); 24 EXPECT_EQ(1u, data.m_items.size());
25 EXPECT_EQ(12u, data.m_items[0].data->length()); 25 EXPECT_EQ(12u, data.m_items[0].data->length());
26 EXPECT_EQ(0, memcmp(data.m_items[0].data->data(), "abcdefps1ps2", 12)); 26 EXPECT_EQ(0, memcmp(data.m_items[0].data->data(), "abcdefps1ps2", 12));
27 27
28 std::unique_ptr<char[]> large_data = 28 std::unique_ptr<char[]> large_data =
29 wrapArrayUnique(new char[kMaxConsolidatedItemSizeInBytes]); 29 wrapArrayUnique(new char[kMaxConsolidatedItemSizeInBytes]);
30 data.appendBytes(large_data.get(), kMaxConsolidatedItemSizeInBytes); 30 data.appendBytes(large_data.get(), kMaxConsolidatedItemSizeInBytes);
31 31
32 EXPECT_EQ(2u, data.m_items.size()); 32 EXPECT_EQ(2u, data.m_items.size());
33 EXPECT_EQ(12u, data.m_items[0].data->length()); 33 EXPECT_EQ(12u, data.m_items[0].data->length());
34 EXPECT_EQ(kMaxConsolidatedItemSizeInBytes, data.m_items[1].data->length()); 34 EXPECT_EQ(kMaxConsolidatedItemSizeInBytes, data.m_items[1].data->length());
35 } 35 }
36 36
37 } // namespace blink 37 } // 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