chrome/browser/google_apis/test_util.cc
// Returns a HttpResponse created from the given file path.
Returns a HttpResponse created from the given file path.
Returns a HttpResponse created from the given file path .
scoped_ptr<test_server::HttpResponse> CreateHttpResponseFromFile(
    const FilePath& file_path) {
  std::string content;
  if (!file_util::ReadFileToString(file_path, &content))
    return scoped_ptr<test_server::HttpResponse>();
  std::string content_type = "text/plain";
  if (EndsWith(file_path.AsUTF8Unsafe(), ".json", true )) {
    content_type = "application/json";
  } else if (EndsWith(file_path.AsUTF8Unsafe(), ".xml", true)) {
    content_type = "application/atom+xml";
  }
  scoped_ptr<test_server::HttpResponse> http_response(
      new test_server::HttpResponse);
  http_response->set_code(test_server::SUCCESS);
  http_response->set_content(content);
  http_response->set_content_type(content_type);
  return http_response.Pass();
}
scoped_ptr < test_server :: HttpResponse > CreateHttpResponseFromFile ( const FilePath & file_path ) { std :: string content ; if ( ! file_util :: ReadFileToString ( file_path , & content ) ) return scoped_ptr < test_server :: HttpResponse > ( ) ; std :: string content_type = " " ; if ( EndsWith ( file_path . AsUTF8Unsafe ( ) , " " , true ) ) { content_type = " " ; } else if ( EndsWith ( file_path . AsUTF8Unsafe ( ) , " " , true ) ) { content_type = " " ; } scoped_ptr < test_server :: HttpResponse > http_response ( new test_server :: HttpResponse ) ; http_response -> set_code ( test_server :: SUCCESS ) ; http_response -> set_content ( content ) ; http_response -> set_content_type ( content_type ) ; return http_response . Pass ( ) ; }
Returns a HttpResponse created from the given file path.
Returns a HttpResponse created from the given file path .
/* case sensitive */