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

Side by Side Diff: content/child/fileapi/webfilewriter_base_unittest.cc

Issue 1544273002: Switch to standard integer types in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « content/child/fileapi/webfilewriter_base.cc ('k') | content/child/fileapi/webfilewriter_impl.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/child/fileapi/webfilewriter_base.h" 5 #include "content/child/fileapi/webfilewriter_base.h"
6 6
7 #include <stdint.h>
8
7 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
11 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/WebKit/public/platform/WebFileError.h" 15 #include "third_party/WebKit/public/platform/WebFileError.h"
13 #include "third_party/WebKit/public/platform/WebFileWriterClient.h" 16 #include "third_party/WebKit/public/platform/WebFileWriterClient.h"
14 #include "third_party/WebKit/public/platform/WebURL.h" 17 #include "third_party/WebKit/public/platform/WebURL.h"
15 #include "url/gurl.h" 18 #include "url/gurl.h"
16 19
17 namespace content { 20 namespace content {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 received_truncate_offset_ = kNoOffset; 53 received_truncate_offset_ = kNoOffset;
51 received_write_ = false; 54 received_write_ = false;
52 received_write_path_ = GURL(); 55 received_write_path_ = GURL();
53 received_write_offset_ = kNoOffset; 56 received_write_offset_ = kNoOffset;
54 received_write_blob_uuid_ = std::string(); 57 received_write_blob_uuid_ = std::string();
55 received_cancel_ = false; 58 received_cancel_ = false;
56 } 59 }
57 60
58 bool received_truncate_; 61 bool received_truncate_;
59 GURL received_truncate_path_; 62 GURL received_truncate_path_;
60 int64 received_truncate_offset_; 63 int64_t received_truncate_offset_;
61 bool received_write_; 64 bool received_write_;
62 GURL received_write_path_; 65 GURL received_write_path_;
63 std::string received_write_blob_uuid_; 66 std::string received_write_blob_uuid_;
64 int64 received_write_offset_; 67 int64_t received_write_offset_;
65 bool received_cancel_; 68 bool received_cancel_;
66 69
67 protected: 70 protected:
68 void DoTruncate(const GURL& path, int64 offset) override { 71 void DoTruncate(const GURL& path, int64_t offset) override {
69 received_truncate_ = true; 72 received_truncate_ = true;
70 received_truncate_path_ = path; 73 received_truncate_path_ = path;
71 received_truncate_offset_ = offset; 74 received_truncate_offset_ = offset;
72 75
73 if (offset == kBasicFileTruncate_Offset) { 76 if (offset == kBasicFileTruncate_Offset) {
74 DidSucceed(); 77 DidSucceed();
75 } else if (offset == kErrorFileTruncate_Offset) { 78 } else if (offset == kErrorFileTruncate_Offset) {
76 DidFail(base::File::FILE_ERROR_NOT_FOUND); 79 DidFail(base::File::FILE_ERROR_NOT_FOUND);
77 } else if (offset == kCancelFileTruncate_Offset) { 80 } else if (offset == kCancelFileTruncate_Offset) {
78 cancel(); 81 cancel();
79 DidSucceed(); // truncate completion 82 DidSucceed(); // truncate completion
80 DidSucceed(); // cancel completion 83 DidSucceed(); // cancel completion
81 } else if (offset == kCancelFailedTruncate_Offset) { 84 } else if (offset == kCancelFailedTruncate_Offset) {
82 cancel(); 85 cancel();
83 DidFail(base::File::FILE_ERROR_NOT_FOUND); // truncate completion 86 DidFail(base::File::FILE_ERROR_NOT_FOUND); // truncate completion
84 DidSucceed(); // cancel completion 87 DidSucceed(); // cancel completion
85 } else { 88 } else {
86 FAIL(); 89 FAIL();
87 } 90 }
88 } 91 }
89 92
90 void DoWrite(const GURL& path, 93 void DoWrite(const GURL& path,
91 const std::string& blob_uuid, 94 const std::string& blob_uuid,
92 int64 offset) override { 95 int64_t offset) override {
93 received_write_ = true; 96 received_write_ = true;
94 received_write_path_ = path; 97 received_write_path_ = path;
95 received_write_offset_ = offset; 98 received_write_offset_ = offset;
96 received_write_blob_uuid_ = blob_uuid; 99 received_write_blob_uuid_ = blob_uuid;
97 100
98 if (offset == kBasicFileWrite_Offset) { 101 if (offset == kBasicFileWrite_Offset) {
99 DidWrite(1, true); 102 DidWrite(1, true);
100 } else if (offset == kErrorFileWrite_Offset) { 103 } else if (offset == kErrorFileWrite_Offset) {
101 DidFail(base::File::FILE_ERROR_NOT_FOUND); 104 DidFail(base::File::FILE_ERROR_NOT_FOUND);
102 } else if (offset == kMultiFileWrite_Offset) { 105 } else if (offset == kMultiFileWrite_Offset) {
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 412
410 reset(); 413 reset();
411 delete_in_client_callback_ = true; 414 delete_in_client_callback_ = true;
412 writer()->truncate(kErrorFileTruncate_Offset); 415 writer()->truncate(kErrorFileTruncate_Offset);
413 EXPECT_FALSE(testable_writer_.get()); 416 EXPECT_FALSE(testable_writer_.get());
414 417
415 // Not crashing counts as passing. 418 // Not crashing counts as passing.
416 } 419 }
417 420
418 } // namespace content 421 } // namespace content
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilewriter_base.cc ('k') | content/child/fileapi/webfilewriter_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698