// Copyright (c) 2006-2008 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. #include "net/http/http_transaction_unittest.h" #include "base/hash_tables.h" #include "base/message_loop.h" #include "base/string_util.h" #include "net/base/net_errors.h" #include "net/base/load_flags.h" #include "net/disk_cache/disk_cache.h" #include "net/http/http_cache.h" #include "net/http/http_request_info.h" #include "net/http/http_response_info.h" #include "net/http/http_transaction.h" #include "testing/gtest/include/gtest/gtest.h" //----------------------------------------------------------------------------- // mock transaction data const MockTransaction kSimpleGET_Transaction = { "http://www.google.com/", "GET", base::Time(), "", net::LOAD_NORMAL, "HTTP/1.1 200 OK", "Cache-Control: max-age=10000\n", base::Time(), "
Google Blah Blah", TEST_MODE_NORMAL, NULL, 0 }; const MockTransaction kSimplePOST_Transaction = { "http://bugdatabase.com/edit", "POST", base::Time(), "", net::LOAD_NORMAL, "HTTP/1.1 200 OK", "", base::Time(), "Google Blah Blah", TEST_MODE_NORMAL, NULL, 0 }; const MockTransaction kTypicalGET_Transaction = { "http://www.example.com/~foo/bar.html", "GET", base::Time(), "", net::LOAD_NORMAL, "HTTP/1.1 200 OK", "Date: Wed, 28 Nov 2007 09:40:09 GMT\n" "Last-Modified: Wed, 28 Nov 2007 00:40:09 GMT\n", base::Time(), "Google Blah Blah", TEST_MODE_NORMAL, NULL, 0 }; const MockTransaction kETagGET_Transaction = { "http://www.google.com/foopy", "GET", base::Time(), "", net::LOAD_NORMAL, "HTTP/1.1 200 OK", "Cache-Control: max-age=10000\n" "Etag: foopy\n", base::Time(), "Google Blah Blah", TEST_MODE_NORMAL, NULL, 0 }; const MockTransaction kRangeGET_Transaction = { "http://www.google.com/", "GET", base::Time(), "Range: 0-100\r\n", net::LOAD_NORMAL, "HTTP/1.1 200 OK", "Cache-Control: max-age=10000\n", base::Time(), "Google Blah Blah", TEST_MODE_NORMAL, NULL, 0 }; static const MockTransaction* const kBuiltinMockTransactions[] = { &kSimpleGET_Transaction, &kSimplePOST_Transaction, &kTypicalGET_Transaction, &kETagGET_Transaction, &kRangeGET_Transaction }; typedef base::hash_map