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

Side by Side Diff: content/test/plugin/plugin_request_read_test.cc

Issue 661833004: Type conversion fixes, content/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/shell/tools/plugin/PluginObject.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 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/test/plugin/plugin_request_read_test.h" 5 #include "content/test/plugin/plugin_request_read_test.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 8
9 namespace NPAPIClient { 9 namespace NPAPIClient {
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 // Shrink range to mark area we have just received. 85 // Shrink range to mark area we have just received.
86 it->offset += len; 86 it->offset += len;
87 if (static_cast<int32>(it->length) < len) 87 if (static_cast<int32>(it->length) < len)
88 it->length = 0; 88 it->length = 0;
89 else 89 else
90 it->length -= len; 90 it->length -= len;
91 if (it->length == 0) 91 if (it->length == 0)
92 requested_ranges_.erase(it); 92 requested_ranges_.erase(it);
93 93
94 // Verify that data, which we got, is right. 94 // Verify the data we got is right. We expect a string like "01234...".
95 const char* data = static_cast<const char*>(buffer); 95 const char* data = static_cast<const char*>(buffer);
96 for (int32 i = 0; i < len; ++i) { 96 for (int32 i = 0; i < len; ++i) {
97 int cur_offset = offset + i; 97 char expected = '0' + static_cast<char>(offset + i);
98 char expected = '0' + cur_offset;
99 if (data[i] != expected) { 98 if (data[i] != expected) {
100 SetError("Content mismatch between data and source!"); 99 SetError("Content mismatch between data and source!");
101 break; 100 break;
102 } 101 }
103 } 102 }
104 if (requested_ranges_.empty()) 103 if (requested_ranges_.empty())
105 SignalTestCompleted(); 104 SignalTestCompleted();
106 105
107 return len; 106 return len;
108 } 107 }
109 108
110 } // namespace NPAPIClient 109 } // namespace NPAPIClient
111 110
OLDNEW
« no previous file with comments | « content/shell/tools/plugin/PluginObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698