Chromium Code Reviews| Index: ppapi/tests/test_url_loader.cc |
| diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc |
| index 741d4155eb46a8bb15e3edc7f039c788a5bb720e..f27b3a5b3d39124350ff60231e68bc1b294898ed 100644 |
| --- a/ppapi/tests/test_url_loader.cc |
| +++ b/ppapi/tests/test_url_loader.cc |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| @@ -117,6 +117,9 @@ void TestURLLoader::RunTests(const std::string& filter) { |
| RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect, filter); |
| RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls, filter); |
| RUN_TEST_FORCEASYNC_AND_NOT(UntendedLoad, filter); |
| + RUN_TEST_FORCEASYNC_AND_NOT(NegativePrefetchBufferThreshold, filter); |
| + RUN_TEST_FORCEASYNC_AND_NOT(LegalPrefetchBufferThreshold, filter); |
| + RUN_TEST_FORCEASYNC_AND_NOT(InvertedPrefetchBufferThreshold, filter); |
| } |
| std::string TestURLLoader::ReadEntireFile(pp::FileIO* file_io, |
| @@ -871,6 +874,47 @@ std::string TestURLLoader::TestUntendedLoad() { |
| PASS(); |
| } |
| +int32_t TestURLLoader::OpenWithPrefetchBufferThreshold(int32_t lower, |
| + int32_t upper) { |
| + pp::URLRequestInfo request(instance_); |
| + request.SetURL("test_url_loader_data/hello.txt"); |
| + request.SetPrefetchBufferLowerThreshold(lower); |
| + request.SetPrefetchBufferUpperThreshold(upper); |
| + |
| + int32_t rv = OpenUntrusted(request); |
| + return rv; |
| +} |
| + |
| +std::string TestURLLoader::TestNegativePrefetchBufferThreshold() { |
| + int32_t rv = OpenWithPrefetchBufferThreshold(-1, 1); |
| + if (rv != PP_ERROR_FAILED) { |
| + return ReportError("The prefetch limits contained a negative value but " |
| + "the URLLoader did not fail.", rv); |
| + } |
| + |
| + PASS(); |
| +} |
| + |
| +std::string TestURLLoader::TestLegalPrefetchBufferThreshold() { |
| + int32_t rv = OpenWithPrefetchBufferThreshold(0, 1); |
| + if (rv != PP_OK) { |
| + return ReportError("The prefetch buffer limits were legal values but " |
| + "the URLLoader failed.", rv); |
| + } |
| + |
| + PASS(); |
| +} |
| + |
| +std::string TestURLLoader::TestInvertedPrefetchBufferThreshold() { |
| + int32_t rv = OpenWithPrefetchBufferThreshold(1000, 1); |
| + if (rv != PP_ERROR_FAILED) { |
| + return ReportError("The lower buffer value was higher than the upper but " |
| + "the URLLoader did not fail.", rv); |
| + } |
| + |
|
dmichael (off chromium)
2012/01/13 17:46:02
I think it would make sense to collapse these in t
|
| + PASS(); |
| +} |
| + |
| // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close |
| // (including abort tests if applicable). |