| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/npapi/test/plugin_geturl_test.h" | 5 #include "webkit/plugins/npapi/test/plugin_geturl_test.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 cast_validity_check); | 259 cast_validity_check); |
| 260 unsigned long stream_id = reinterpret_cast<unsigned long>( | 260 unsigned long stream_id = reinterpret_cast<unsigned long>( |
| 261 stream->notifyData); | 261 stream->notifyData); |
| 262 switch (stream_id) { | 262 switch (stream_id) { |
| 263 case SELF_URL_STREAM_ID: | 263 case SELF_URL_STREAM_ID: |
| 264 self_url_.append(static_cast<char*>(buffer), len); | 264 self_url_.append(static_cast<char*>(buffer), len); |
| 265 break; | 265 break; |
| 266 case FETCHED_URL_STREAM_ID: | 266 case FETCHED_URL_STREAM_ID: |
| 267 { | 267 { |
| 268 char read_buffer[STREAM_CHUNK]; | 268 char read_buffer[STREAM_CHUNK]; |
| 269 int32 bytes = fread(read_buffer, 1, len, test_file_); | 269 int32 bytes = |
| 270 static_cast<int32>(fread(read_buffer, 1, len, test_file_)); |
| 270 // Technically, fread could return fewer than len | 271 // Technically, fread could return fewer than len |
| 271 // bytes. But this is not likely. | 272 // bytes. But this is not likely. |
| 272 if (bytes != len) | 273 if (bytes != len) |
| 273 SetError("Did not read correct bytelength from source file"); | 274 SetError("Did not read correct bytelength from source file"); |
| 274 if (memcmp(read_buffer, buffer, len)) | 275 if (memcmp(read_buffer, buffer, len)) |
| 275 SetError("Content mismatch between data and source!"); | 276 SetError("Content mismatch between data and source!"); |
| 276 } | 277 } |
| 277 break; | 278 break; |
| 278 case BOGUS_URL_STREAM_ID: | 279 case BOGUS_URL_STREAM_ID: |
| 279 SetError("Unexpected write callback for BOGUS_URL"); | 280 SetError("Unexpected write callback for BOGUS_URL"); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 int32_t status, | 411 int32_t status, |
| 411 void* notify_data) { | 412 void* notify_data) { |
| 412 if (!base::strcasecmp(url, "http://mock.http/npapi/plugin_read_page.html")) { | 413 if (!base::strcasecmp(url, "http://mock.http/npapi/plugin_read_page.html")) { |
| 413 received_url_redirect_notification_ = true; | 414 received_url_redirect_notification_ = true; |
| 414 // Disallow redirect notification. | 415 // Disallow redirect notification. |
| 415 HostFunctions()->urlredirectresponse(id(), notify_data, false); | 416 HostFunctions()->urlredirectresponse(id(), notify_data, false); |
| 416 } | 417 } |
| 417 } | 418 } |
| 418 | 419 |
| 419 } // namespace NPAPIClient | 420 } // namespace NPAPIClient |
| OLD | NEW |