| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/tests/test_url_loader.h" | 5 #include "ppapi/tests/test_url_loader.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 if (bytes_received == total_bytes_to_be_received) | 793 if (bytes_received == total_bytes_to_be_received) |
| 794 break; | 794 break; |
| 795 // Yield if we're on the main thread, so that URLLoader can receive more | 795 // Yield if we're on the main thread, so that URLLoader can receive more |
| 796 // data. | 796 // data. |
| 797 if (pp::Module::Get()->core()->IsMainThread()) { | 797 if (pp::Module::Get()->core()->IsMainThread()) { |
| 798 NestedEvent event(instance_->pp_instance()); | 798 NestedEvent event(instance_->pp_instance()); |
| 799 event.PostSignal(10); | 799 event.PostSignal(10); |
| 800 event.Wait(); | 800 event.Wait(); |
| 801 } | 801 } |
| 802 } | 802 } |
| 803 | |
| 804 // The loader should now have the data and have finished successfully. | 803 // The loader should now have the data and have finished successfully. |
| 805 std::string body; | 804 std::string body; |
| 806 std::string error = ReadEntireResponseBody(&loader, &body); | 805 std::string error = ReadEntireResponseBody(&loader, &body); |
| 807 if (!error.empty()) | 806 if (!error.empty()) |
| 808 return error; | 807 return error; |
| 809 if (body != "hello\n") | 808 if (body != "hello\n") |
| 810 return ReportError("Couldn't read data", callback.result()); | 809 return ReportError("Couldn't read data", callback.result()); |
| 811 | 810 |
| 812 PASS(); | 811 PASS(); |
| 813 } | 812 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 839 if (rv != PP_ERROR_FAILED) { | 838 if (rv != PP_ERROR_FAILED) { |
| 840 return ReportError("The lower buffer value was higher than the upper but " | 839 return ReportError("The lower buffer value was higher than the upper but " |
| 841 "the URLLoader did not fail.", rv); | 840 "the URLLoader did not fail.", rv); |
| 842 } | 841 } |
| 843 | 842 |
| 844 PASS(); | 843 PASS(); |
| 845 } | 844 } |
| 846 | 845 |
| 847 // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close | 846 // TODO(viettrungluu): Add tests for Get{Upload,Download}Progress, Close |
| 848 // (including abort tests if applicable). | 847 // (including abort tests if applicable). |
| OLD | NEW |