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

Unified Diff: native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc

Issue 2485203005: [NaCl SDK] Refactor FakeURLRequestInfoResource, FakeURLResponseInfoResource, and GetHeaderValue (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc
diff --git a/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc
index e209e398af0c74a2333ff32562edd22254891288..00ff72557c76f2b4fdcbd065b2d68b56d098b745 100644
--- a/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc
+++ b/native_client_sdk/src/tests/nacl_io_test/fake_ppapi/fake_pepper_interface_url_loader.cc
@@ -5,7 +5,6 @@
#include "fake_ppapi/fake_pepper_interface_url_loader.h"
#include <string.h>
-#include <strings.h>
#include <algorithm>
#include <sstream>
@@ -17,38 +16,6 @@
namespace {
-bool GetHeaderValue(const std::string& headers,
- const std::string& key,
- std::string* out_value) {
- out_value->clear();
-
- size_t offset = 0;
- while (offset != std::string::npos) {
- // Find the next colon; this separates the key from the value.
- size_t colon = headers.find(':', offset);
- if (colon == std::string::npos)
- return false;
-
- // Find the newline; this separates the value from the next header.
- size_t newline = headers.find('\n', offset);
- if (strncasecmp(key.c_str(), &headers.data()[offset], key.size()) != 0) {
- // Key doesn't match, skip to next header.
- offset = newline;
- continue;
- }
-
- // Key matches, extract value. First, skip leading spaces.
- size_t nonspace = headers.find_first_not_of(' ', colon + 1);
- if (nonspace == std::string::npos)
- return false;
-
- out_value->assign(headers, nonspace, newline - nonspace);
- return true;
- }
-
- return false;
-}
-
class FakeInstanceResource : public FakeResource {
public:
FakeInstanceResource() : server_template(NULL) {}
@@ -83,26 +50,6 @@ class FakeURLLoaderResource : public FakeResource {
off_t read_end;
};
-class FakeURLRequestInfoResource : public FakeResource {
- public:
- FakeURLRequestInfoResource() {}
- static const char* classname() { return "FakeURLRequestInfoResource"; }
-
- std::string url;
- std::string method;
- std::string headers;
-};
-
-class FakeURLResponseInfoResource : public FakeResource {
- public:
- FakeURLResponseInfoResource() : status_code(0) {}
- static const char* classname() { return "FakeURLResponseInfoResource"; }
-
- int status_code;
- std::string url;
- std::string headers;
-};
-
void HandleContentLength(FakeURLLoaderResource* loader,
FakeURLResponseInfoResource* response,
FakeURLLoaderEntity* entity) {

Powered by Google App Engine
This is Rietveld 408576698