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

Side by Side Diff: chrome/browser/chromeos/policy/upload_job_unittest.cc

Issue 1547593002: Introducing a net::GenerateMimeMultipartBoundary helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 4 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/chromeos/policy/upload_job.h" 5 #include "chrome/browser/chromeos/policy/upload_job.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const char kTokenValid[] = "VALID_TOKEN"; 44 const char kTokenValid[] = "VALID_TOKEN";
45 45
46 class RepeatingMimeBoundaryGenerator 46 class RepeatingMimeBoundaryGenerator
47 : public UploadJobImpl::MimeBoundaryGenerator { 47 : public UploadJobImpl::MimeBoundaryGenerator {
48 public: 48 public:
49 explicit RepeatingMimeBoundaryGenerator(char character) 49 explicit RepeatingMimeBoundaryGenerator(char character)
50 : character_(character) {} 50 : character_(character) {}
51 ~RepeatingMimeBoundaryGenerator() override {} 51 ~RepeatingMimeBoundaryGenerator() override {}
52 52
53 // MimeBoundaryGenerator: 53 // MimeBoundaryGenerator:
54 std::string GenerateBoundary(size_t length) const override { 54 std::string GenerateBoundary() const override {
55 return std::string(length, character_); 55 const int kMimeBoundarySize = 32;
56 return std::string(kMimeBoundarySize, character_);
56 } 57 }
57 58
58 private: 59 private:
59 const char character_; 60 const char character_;
60 61
61 DISALLOW_COPY_AND_ASSIGN(RepeatingMimeBoundaryGenerator); 62 DISALLOW_COPY_AND_ASSIGN(RepeatingMimeBoundaryGenerator);
62 }; 63 };
63 64
64 class MockOAuth2TokenService : public FakeOAuth2TokenService { 65 class MockOAuth2TokenService : public FakeOAuth2TokenService {
65 public: 66 public:
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 "customfield2: CUSTOM2\r\n" 338 "customfield2: CUSTOM2\r\n"
338 "\r\n" 339 "\r\n"
339 "**||--||PAYLOAD2||--||**\r\n--" 340 "**||--||PAYLOAD2||--||**\r\n--"
340 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA--\r\n"); 341 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA--\r\n");
341 342
342 upload_job->Start(); 343 upload_job->Start();
343 run_loop_.Run(); 344 run_loop_.Run();
344 } 345 }
345 346
346 } // namespace policy 347 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698