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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/MultipartImageResourceParserTest.cpp

Issue 2614833005: Migrate WTF::Vector::append() to ::push_back() [part 10 of N] (Closed)
Patch Set: Created 3 years, 11 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 | « third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/loader/resource/MultipartImageResourceParser.h" 5 #include "core/loader/resource/MultipartImageResourceParser.h"
6 6
7 #include "platform/network/ResourceResponse.h" 7 #include "platform/network/ResourceResponse.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 #include <string.h> 12 #include <string.h>
13 13
14 namespace blink { 14 namespace blink {
15 15
16 namespace { 16 namespace {
17 17
18 String toString(const Vector<char>& data) { 18 String toString(const Vector<char>& data) {
19 if (data.isEmpty()) 19 if (data.isEmpty())
20 return String(""); 20 return String("");
21 return String(data.data(), data.size()); 21 return String(data.data(), data.size());
22 } 22 }
23 23
24 class MockClient final : public GarbageCollectedFinalized<MockClient>, 24 class MockClient final : public GarbageCollectedFinalized<MockClient>,
25 public MultipartImageResourceParser::Client { 25 public MultipartImageResourceParser::Client {
26 USING_GARBAGE_COLLECTED_MIXIN(MockClient); 26 USING_GARBAGE_COLLECTED_MIXIN(MockClient);
27 27
28 public: 28 public:
29 void onePartInMultipartReceived(const ResourceResponse& response) override { 29 void onePartInMultipartReceived(const ResourceResponse& response) override {
30 m_responses.append(response); 30 m_responses.push_back(response);
31 m_data.append(Vector<char>()); 31 m_data.push_back(Vector<char>());
32 } 32 }
33 void multipartDataReceived(const char* bytes, size_t size) override { 33 void multipartDataReceived(const char* bytes, size_t size) override {
34 m_data.back().append(bytes, size); 34 m_data.back().append(bytes, size);
35 } 35 }
36 36
37 Vector<ResourceResponse> m_responses; 37 Vector<ResourceResponse> m_responses;
38 Vector<Vector<char>> m_data; 38 Vector<Vector<char>> m_data;
39 }; 39 };
40 40
41 TEST(MultipartResponseTest, SkippableLength) { 41 TEST(MultipartResponseTest, SkippableLength) {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 EXPECT_EQ("\r\ncontent-type: 1\r\n\r\n\r\n\r\n", toString(client->m_data[1])); 420 EXPECT_EQ("\r\ncontent-type: 1\r\n\r\n\r\n\r\n", toString(client->m_data[1]));
421 EXPECT_EQ(String(), client->m_responses[2].httpHeaderField("content-type")); 421 EXPECT_EQ(String(), client->m_responses[2].httpHeaderField("content-type"));
422 EXPECT_EQ("content-type: 2\r\n\r\n\r\n\r\n", toString(client->m_data[2])); 422 EXPECT_EQ("content-type: 2\r\n\r\n\r\n\r\n", toString(client->m_data[2]));
423 EXPECT_EQ("3", client->m_responses[3].httpHeaderField("content-type")); 423 EXPECT_EQ("3", client->m_responses[3].httpHeaderField("content-type"));
424 EXPECT_EQ("", toString(client->m_data[3])); 424 EXPECT_EQ("", toString(client->m_data[3]));
425 } 425 }
426 426
427 } // namespace 427 } // namespace
428 428
429 } // namespace blink 429 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/appcache/ApplicationCacheHost.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698