net cleanup: Remove unnecessary namespace prefixes.
BUG=475208
Review URL: https://codereview.chromium.org/1095823003
Cr-Commit-Position: refs/heads/master@{#326610}
diff --git a/net/android/net_jni_registrar.cc b/net/android/net_jni_registrar.cc
index bdebf0e..586f018 100644
--- a/net/android/net_jni_registrar.cc
+++ b/net/android/net_jni_registrar.cc
@@ -23,17 +23,16 @@
namespace android {
static base::android::RegistrationMethod kNetRegisteredMethods[] = {
- { "AndroidCertVerifyResult", net::android::RegisterCertVerifyResult },
- { "AndroidPrivateKey", net::android::RegisterAndroidPrivateKey},
- { "AndroidKeyStore", net::android::RegisterKeyStore },
- { "AndroidNetworkLibrary", net::android::RegisterNetworkLibrary },
- { "GURLUtils", net::RegisterGURLUtils },
- { "NetworkChangeNotifierAndroid",
- net::NetworkChangeNotifierAndroid::Register },
- { "ProxyConfigService", net::ProxyConfigServiceAndroid::Register },
- { "X509Util", net::RegisterX509Util },
+ {"AndroidCertVerifyResult", RegisterCertVerifyResult},
+ {"AndroidPrivateKey", RegisterAndroidPrivateKey},
+ {"AndroidKeyStore", RegisterKeyStore},
+ {"AndroidNetworkLibrary", RegisterNetworkLibrary},
+ {"GURLUtils", RegisterGURLUtils},
+ {"NetworkChangeNotifierAndroid", NetworkChangeNotifierAndroid::Register},
+ {"ProxyConfigService", ProxyConfigServiceAndroid::Register},
+ {"X509Util", RegisterX509Util},
#if defined(USE_ICU_ALTERNATIVES_ON_ANDROID)
- { "NetStringUtils", net::RegisterNetStringUtils }
+ {"NetStringUtils", RegisterNetStringUtils}
#endif
};
diff --git a/net/android/network_library.h b/net/android/network_library.h
index 4a4ddca..f18ee19 100644
--- a/net/android/network_library.h
+++ b/net/android/network_library.h
@@ -51,7 +51,7 @@
// Helper used to pass the DER-encoded bytes of an X.509 certificate or
// a PKCS#12 archive holding a private key to the CertInstaller activity.
-NET_EXPORT void StoreCertificate(net::CertificateMimeType cert_type,
+NET_EXPORT void StoreCertificate(CertificateMimeType cert_type,
const void* data,
size_t data_len);
diff --git a/net/base/backoff_entry_unittest.cc b/net/base/backoff_entry_unittest.cc
index cca7c458..29a4281 100644
--- a/net/base/backoff_entry_unittest.cc
+++ b/net/base/backoff_entry_unittest.cc
@@ -8,11 +8,12 @@
#include "base/time/tick_clock.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
using base::TimeDelta;
using base::TimeTicks;
-using net::BackoffEntry;
BackoffEntry::Policy base_policy = { 0, 1000, 2.0, 0.0, 20000, 2000, false };
@@ -311,3 +312,5 @@
}
} // namespace
+
+} // namespace net
diff --git a/net/base/data_url.cc b/net/base/data_url.cc
index 58036c6..b03d9976 100644
--- a/net/base/data_url.cc
+++ b/net/base/data_url.cc
@@ -60,7 +60,7 @@
charset->assign(iter->substr(kCharsetTagLength));
// The grammar for charset is not specially defined in RFC2045 and
// RFC2397. It just needs to be a token.
- if (!net::HttpUtil::IsToken(*charset))
+ if (!HttpUtil::IsToken(*charset))
return false;
}
}
diff --git a/net/base/data_url_unittest.cc b/net/base/data_url_unittest.cc
index bcb2b49a..fb7dc76 100644
--- a/net/base/data_url_unittest.cc
+++ b/net/base/data_url_unittest.cc
@@ -7,6 +7,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
+namespace net {
+
namespace {
struct ParseTestData {
@@ -17,7 +19,7 @@
const char* data;
};
-}
+} // namespace
TEST(DataURLTest, Parse) {
const ParseTestData tests[] = {
@@ -229,8 +231,7 @@
std::string mime_type;
std::string charset;
std::string data;
- bool ok =
- net::DataURL::Parse(GURL(tests[i].url), &mime_type, &charset, &data);
+ bool ok = DataURL::Parse(GURL(tests[i].url), &mime_type, &charset, &data);
EXPECT_EQ(ok, tests[i].is_valid);
if (tests[i].is_valid) {
EXPECT_EQ(tests[i].mime_type, mime_type);
@@ -239,3 +240,5 @@
}
}
}
+
+} // namespace net
diff --git a/net/base/dns_reloader.cc b/net/base/dns_reloader.cc
index e0e0b76..18041d9fc 100644
--- a/net/base/dns_reloader.cc
+++ b/net/base/dns_reloader.cc
@@ -17,6 +17,8 @@
#include "base/threading/thread_local_storage.h"
#include "net/base/network_change_notifier.h"
+namespace net {
+
namespace {
// On Linux/BSD, changes to /etc/resolv.conf can go unnoticed thus resulting
@@ -39,7 +41,7 @@
// Android does not have /etc/resolv.conf. The system takes care of nameserver
// changes, so none of this is needed.
-class DnsReloader : public net::NetworkChangeNotifier::DNSObserver {
+class DnsReloader : public NetworkChangeNotifier::DNSObserver {
public:
struct ReloadState {
int resolver_generation;
@@ -81,7 +83,7 @@
private:
DnsReloader() : resolver_generation_(0) {
tls_index_.Initialize(SlotReturnFunction);
- net::NetworkChangeNotifier::AddDNSObserver(this);
+ NetworkChangeNotifier::AddDNSObserver(this);
}
~DnsReloader() override {
@@ -107,8 +109,6 @@
} // namespace
-namespace net {
-
void EnsureDnsReloaderInit() {
g_dns_reloader.Pointer();
}
diff --git a/net/base/escape_unittest.cc b/net/base/escape_unittest.cc
index 4d3bcbdd..98afb8cf 100644
--- a/net/base/escape_unittest.cc
+++ b/net/base/escape_unittest.cc
@@ -125,8 +125,8 @@
"%A9%20t'a-t-il%20%C3%B4t%C3%A9%20ta%20toux%20";
base::OffsetAdjuster::Adjustments adjustments;
- net::UnescapeAndDecodeUTF8URLComponentWithAdjustments(
- url, UnescapeRule::SPACES, &adjustments);
+ UnescapeAndDecodeUTF8URLComponentWithAdjustments(url, UnescapeRule::SPACES,
+ &adjustments);
}
TEST(EscapeTest, EscapeUrlEncodedData) {
diff --git a/net/base/file_stream_context.h b/net/base/file_stream_context.h
index e8a66f0..74677fe8 100644
--- a/net/base/file_stream_context.h
+++ b/net/base/file_stream_context.h
@@ -185,7 +185,7 @@
static void ReadAsync(
FileStream::Context* context,
HANDLE file,
- scoped_refptr<net::IOBuffer> buf,
+ scoped_refptr<IOBuffer> buf,
int buf_len,
OVERLAPPED* overlapped,
scoped_refptr<base::MessageLoopProxy> origin_thread_loop);
diff --git a/net/base/file_stream_context_win.cc b/net/base/file_stream_context_win.cc
index a41a74c..1a39384 100644
--- a/net/base/file_stream_context_win.cc
+++ b/net/base/file_stream_context_win.cc
@@ -210,7 +210,7 @@
void FileStream::Context::ReadAsync(
FileStream::Context* context,
HANDLE file,
- scoped_refptr<net::IOBuffer> buf,
+ scoped_refptr<IOBuffer> buf,
int buf_len,
OVERLAPPED* overlapped,
scoped_refptr<base::MessageLoopProxy> origin_thread_loop) {
diff --git a/net/base/filename_util_internal.cc b/net/base/filename_util_internal.cc
index c77375b4..8d7509f 100644
--- a/net/base/filename_util_internal.cc
+++ b/net/base/filename_util_internal.cc
@@ -70,8 +70,8 @@
// encoding detection.
base::string16 utf16_output;
if (!referrer_charset.empty() &&
- net::ConvertToUTF16(
- unescaped_url_filename, referrer_charset.c_str(), &utf16_output)) {
+ ConvertToUTF16(unescaped_url_filename, referrer_charset.c_str(),
+ &utf16_output)) {
decoded_filename = base::UTF16ToUTF8(utf16_output);
} else {
decoded_filename =
@@ -172,8 +172,8 @@
if ((ignore_extension || extension.empty()) && !mime_type.empty()) {
base::FilePath::StringType preferred_mime_extension;
std::vector<base::FilePath::StringType> all_mime_extensions;
- net::GetPreferredExtensionForMimeType(mime_type, &preferred_mime_extension);
- net::GetExtensionsForMimeType(mime_type, &all_mime_extensions);
+ GetPreferredExtensionForMimeType(mime_type, &preferred_mime_extension);
+ GetExtensionsForMimeType(mime_type, &all_mime_extensions);
// If the existing extension is in the list of valid extensions for the
// given type, use it. This avoids doing things like pointlessly renaming
// "foo.jpg" to "foo.jpeg".
diff --git a/net/base/mac/url_conversions_unittest.mm b/net/base/mac/url_conversions_unittest.mm
index a52062c..32e6210 100644
--- a/net/base/mac/url_conversions_unittest.mm
+++ b/net/base/mac/url_conversions_unittest.mm
@@ -11,6 +11,8 @@
#include "testing/gtest_mac.h"
#include "url/gurl.h"
+namespace net {
+
namespace {
class URLConversionTest : public ::testing::Test {
@@ -211,7 +213,7 @@
for (NSUInteger i = 0; i < [testData_ count]; i += 2) {
NSString* inputStr = [testData_ objectAtIndex:i];
NSString* expected = [testData_ objectAtIndex:(i + 1)];
- NSURL* url = net::NSURLWithGURL(GURL(base::SysNSStringToUTF8(inputStr)));
+ NSURL* url = NSURLWithGURL(GURL(base::SysNSStringToUTF8(inputStr)));
EXPECT_NSEQ(expected, [url absoluteString]);
}
}
@@ -219,11 +221,13 @@
TEST_F(URLConversionTest, TestURLWithStringDoesNotModifyAlreadyEscapedURLs) {
for (NSUInteger i = 0; i < [testData_ count]; i += 2) {
NSString* inputStr = [testData_ objectAtIndex:i + 1];
- NSURL* url = net::NSURLWithGURL(GURL(base::SysNSStringToUTF8(inputStr)));
+ NSURL* url = NSURLWithGURL(GURL(base::SysNSStringToUTF8(inputStr)));
NSString* expected = [testData_ objectAtIndex:i + 1];
// Test the expected URL is created.
EXPECT_NSEQ(expected, [url absoluteString]);
}
}
-} // anonymous namespace
+} // namespace
+
+} // namespace net
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index f1d4487..ab13005 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -1378,8 +1378,8 @@
// except on Android.
for (size_t i = 0; i < arraysize(supported_certificate_types); ++i) {
if (base::strcasecmp(mime_type.c_str(),
- net::supported_certificate_types[i].mime_type) == 0) {
- return net::supported_certificate_types[i].cert_type;
+ supported_certificate_types[i].mime_type) == 0) {
+ return supported_certificate_types[i].cert_type;
}
}
return CERTIFICATE_MIME_TYPE_UNKNOWN;
diff --git a/net/base/mock_file_stream.cc b/net/base/mock_file_stream.cc
index a34edb218..792b23b 100644
--- a/net/base/mock_file_stream.cc
+++ b/net/base/mock_file_stream.cc
@@ -13,8 +13,8 @@
MockFileStream::MockFileStream(
const scoped_refptr<base::TaskRunner>& task_runner)
- : net::FileStream(task_runner),
- forced_error_(net::OK),
+ : FileStream(task_runner),
+ forced_error_(OK),
async_error_(false),
throttled_(false),
weak_factory_(this) {
@@ -23,8 +23,8 @@
MockFileStream::MockFileStream(
base::File file,
const scoped_refptr<base::TaskRunner>& task_runner)
- : net::FileStream(file.Pass(), task_runner),
- forced_error_(net::OK),
+ : FileStream(file.Pass(), task_runner),
+ forced_error_(OK),
async_error_(false),
throttled_(false),
weak_factory_(this) {
@@ -38,7 +38,7 @@
Int64CompletionCallback wrapped_callback =
base::Bind(&MockFileStream::DoCallback64,
weak_factory_.GetWeakPtr(), callback);
- if (forced_error_ == net::OK)
+ if (forced_error_ == OK)
return FileStream::Seek(whence, offset, wrapped_callback);
return ErrorCallback64(wrapped_callback);
}
@@ -49,7 +49,7 @@
CompletionCallback wrapped_callback = base::Bind(&MockFileStream::DoCallback,
weak_factory_.GetWeakPtr(),
callback);
- if (forced_error_ == net::OK)
+ if (forced_error_ == OK)
return FileStream::Read(buf, buf_len, wrapped_callback);
return ErrorCallback(wrapped_callback);
}
@@ -60,7 +60,7 @@
CompletionCallback wrapped_callback = base::Bind(&MockFileStream::DoCallback,
weak_factory_.GetWeakPtr(),
callback);
- if (forced_error_ == net::OK)
+ if (forced_error_ == OK)
return FileStream::Write(buf, buf_len, wrapped_callback);
return ErrorCallback(wrapped_callback);
}
@@ -69,7 +69,7 @@
CompletionCallback wrapped_callback = base::Bind(&MockFileStream::DoCallback,
weak_factory_.GetWeakPtr(),
callback);
- if (forced_error_ == net::OK)
+ if (forced_error_ == OK)
return FileStream::Flush(wrapped_callback);
return ErrorCallback(wrapped_callback);
}
@@ -111,12 +111,12 @@
}
int MockFileStream::ErrorCallback(const CompletionCallback& callback) {
- CHECK_NE(net::OK, forced_error_);
+ CHECK_NE(OK, forced_error_);
if (async_error_) {
base::MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(callback, forced_error_));
clear_forced_error();
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
int ret = forced_error_;
clear_forced_error();
@@ -124,12 +124,12 @@
}
int64 MockFileStream::ErrorCallback64(const Int64CompletionCallback& callback) {
- CHECK_NE(net::OK, forced_error_);
+ CHECK_NE(OK, forced_error_);
if (async_error_) {
base::MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(callback, forced_error_));
clear_forced_error();
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
int64 ret = forced_error_;
clear_forced_error();
diff --git a/net/base/mock_file_stream.h b/net/base/mock_file_stream.h
index 7b7dea8..39ea1f3 100644
--- a/net/base/mock_file_stream.h
+++ b/net/base/mock_file_stream.h
@@ -20,7 +20,7 @@
namespace testing {
-class MockFileStream : public net::FileStream {
+class MockFileStream : public FileStream {
public:
explicit MockFileStream(const scoped_refptr<base::TaskRunner>& task_runner);
MockFileStream(base::File file,
@@ -48,7 +48,7 @@
async_error_ = false;
}
void clear_forced_error() {
- forced_error_ = net::OK;
+ forced_error_ = OK;
async_error_ = false;
}
int forced_error() const { return forced_error_; }
@@ -63,7 +63,7 @@
private:
int ReturnError(int function_error) {
- if (forced_error_ != net::OK) {
+ if (forced_error_ != OK) {
int ret = forced_error_;
clear_forced_error();
return ret;
@@ -73,7 +73,7 @@
}
int64 ReturnError64(int64 function_error) {
- if (forced_error_ != net::OK) {
+ if (forced_error_ != OK) {
int64 ret = forced_error_;
clear_forced_error();
return ret;
diff --git a/net/base/net_errors.cc b/net/base/net_errors.cc
index 55cdebb1..425cb91 100644
--- a/net/base/net_errors.cc
+++ b/net/base/net_errors.cc
@@ -76,15 +76,15 @@
Error FileErrorToNetError(base::File::Error file_error) {
switch (file_error) {
case base::File::FILE_OK:
- return net::OK;
+ return OK;
case base::File::FILE_ERROR_ACCESS_DENIED:
- return net::ERR_ACCESS_DENIED;
+ return ERR_ACCESS_DENIED;
case base::File::FILE_ERROR_INVALID_URL:
- return net::ERR_INVALID_URL;
+ return ERR_INVALID_URL;
case base::File::FILE_ERROR_NOT_FOUND:
- return net::ERR_FILE_NOT_FOUND;
+ return ERR_FILE_NOT_FOUND;
default:
- return net::ERR_FAILED;
+ return ERR_FAILED;
}
}
diff --git a/net/base/net_util_linux.cc b/net/base/net_util_linux.cc
index 83425970..c8b2293 100644
--- a/net/base/net_util_linux.cc
+++ b/net/base/net_util_linux.cc
@@ -220,7 +220,7 @@
std::string GetWifiSSID() {
NetworkInterfaceList networks;
- if (GetNetworkList(&networks, net::INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) {
+ if (GetNetworkList(&networks, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES)) {
return internal::GetWifiSSIDFromInterfaceListInternal(
networks, internal::GetInterfaceSSID);
}
diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
index 8e13bb8e..5f999af 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -791,42 +791,42 @@
}
TEST(NetUtilTest, IsLocalhost) {
- EXPECT_TRUE(net::IsLocalhost("localhost"));
- EXPECT_TRUE(net::IsLocalhost("localhost.localdomain"));
- EXPECT_TRUE(net::IsLocalhost("localhost6"));
- EXPECT_TRUE(net::IsLocalhost("localhost6.localdomain6"));
- EXPECT_TRUE(net::IsLocalhost("127.0.0.1"));
- EXPECT_TRUE(net::IsLocalhost("127.0.1.0"));
- EXPECT_TRUE(net::IsLocalhost("127.1.0.0"));
- EXPECT_TRUE(net::IsLocalhost("127.0.0.255"));
- EXPECT_TRUE(net::IsLocalhost("127.0.255.0"));
- EXPECT_TRUE(net::IsLocalhost("127.255.0.0"));
- EXPECT_TRUE(net::IsLocalhost("::1"));
- EXPECT_TRUE(net::IsLocalhost("0:0:0:0:0:0:0:1"));
- EXPECT_TRUE(net::IsLocalhost("foo.localhost"));
+ EXPECT_TRUE(IsLocalhost("localhost"));
+ EXPECT_TRUE(IsLocalhost("localhost.localdomain"));
+ EXPECT_TRUE(IsLocalhost("localhost6"));
+ EXPECT_TRUE(IsLocalhost("localhost6.localdomain6"));
+ EXPECT_TRUE(IsLocalhost("127.0.0.1"));
+ EXPECT_TRUE(IsLocalhost("127.0.1.0"));
+ EXPECT_TRUE(IsLocalhost("127.1.0.0"));
+ EXPECT_TRUE(IsLocalhost("127.0.0.255"));
+ EXPECT_TRUE(IsLocalhost("127.0.255.0"));
+ EXPECT_TRUE(IsLocalhost("127.255.0.0"));
+ EXPECT_TRUE(IsLocalhost("::1"));
+ EXPECT_TRUE(IsLocalhost("0:0:0:0:0:0:0:1"));
+ EXPECT_TRUE(IsLocalhost("foo.localhost"));
- EXPECT_FALSE(net::IsLocalhost("localhostx"));
- EXPECT_FALSE(net::IsLocalhost("foo.localdomain"));
- EXPECT_FALSE(net::IsLocalhost("localhost6x"));
- EXPECT_FALSE(net::IsLocalhost("localhost.localdomain6"));
- EXPECT_FALSE(net::IsLocalhost("localhost6.localdomain"));
- EXPECT_FALSE(net::IsLocalhost("127.0.0.1.1"));
- EXPECT_FALSE(net::IsLocalhost(".127.0.0.255"));
- EXPECT_FALSE(net::IsLocalhost("::2"));
- EXPECT_FALSE(net::IsLocalhost("::1:1"));
- EXPECT_FALSE(net::IsLocalhost("0:0:0:0:1:0:0:1"));
- EXPECT_FALSE(net::IsLocalhost("::1:1"));
- EXPECT_FALSE(net::IsLocalhost("0:0:0:0:0:0:0:0:1"));
- EXPECT_FALSE(net::IsLocalhost("foo.localhost.com"));
- EXPECT_FALSE(net::IsLocalhost("foo.localhoste"));
+ EXPECT_FALSE(IsLocalhost("localhostx"));
+ EXPECT_FALSE(IsLocalhost("foo.localdomain"));
+ EXPECT_FALSE(IsLocalhost("localhost6x"));
+ EXPECT_FALSE(IsLocalhost("localhost.localdomain6"));
+ EXPECT_FALSE(IsLocalhost("localhost6.localdomain"));
+ EXPECT_FALSE(IsLocalhost("127.0.0.1.1"));
+ EXPECT_FALSE(IsLocalhost(".127.0.0.255"));
+ EXPECT_FALSE(IsLocalhost("::2"));
+ EXPECT_FALSE(IsLocalhost("::1:1"));
+ EXPECT_FALSE(IsLocalhost("0:0:0:0:1:0:0:1"));
+ EXPECT_FALSE(IsLocalhost("::1:1"));
+ EXPECT_FALSE(IsLocalhost("0:0:0:0:0:0:0:0:1"));
+ EXPECT_FALSE(IsLocalhost("foo.localhost.com"));
+ EXPECT_FALSE(IsLocalhost("foo.localhoste"));
}
TEST(NetUtilTest, IsLocalhostTLD) {
- EXPECT_TRUE(net::IsLocalhostTLD("foo.localhost"));
- EXPECT_TRUE(net::IsLocalhostTLD("foo.localhost."));
- EXPECT_FALSE(net::IsLocalhostTLD("foo.localhos"));
- EXPECT_FALSE(net::IsLocalhostTLD("foo.localhost.com"));
- EXPECT_FALSE(net::IsLocalhost("foo.localhoste"));
+ EXPECT_TRUE(IsLocalhostTLD("foo.localhost"));
+ EXPECT_TRUE(IsLocalhostTLD("foo.localhost."));
+ EXPECT_FALSE(IsLocalhostTLD("foo.localhos"));
+ EXPECT_FALSE(IsLocalhostTLD("foo.localhost.com"));
+ EXPECT_FALSE(IsLocalhost("foo.localhoste"));
}
// Verify GetNetworkList().
@@ -948,7 +948,7 @@
NetworkInterfaceList results;
::base::hash_set<int> online_links;
- net::internal::AddressTrackerLinux::AddressMap address_map;
+ internal::AddressTrackerLinux::AddressMap address_map;
// Interface 1 is offline.
struct ifaddrmsg msg = {
@@ -961,12 +961,9 @@
// Address of offline links should be ignored.
ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second);
- EXPECT_TRUE(
- net::internal::GetNetworkListImpl(&results,
- INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES,
- online_links,
- address_map,
- GetInterfaceName));
+ EXPECT_TRUE(internal::GetNetworkListImpl(
+ &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links,
+ address_map, GetInterfaceName));
EXPECT_EQ(results.size(), 0ul);
// Mark interface 1 online.
@@ -976,23 +973,17 @@
address_map.clear();
ASSERT_TRUE(
address_map.insert(std::make_pair(ipv6_local_address, msg)).second);
- EXPECT_TRUE(
- net::internal::GetNetworkListImpl(&results,
- INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES,
- online_links,
- address_map,
- GetInterfaceName));
+ EXPECT_TRUE(internal::GetNetworkListImpl(
+ &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links,
+ address_map, GetInterfaceName));
EXPECT_EQ(results.size(), 0ul);
// vmware address should return by default.
address_map.clear();
ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second);
- EXPECT_TRUE(
- net::internal::GetNetworkListImpl(&results,
- INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES,
- online_links,
- address_map,
- GetInterfaceNameVM));
+ EXPECT_TRUE(internal::GetNetworkListImpl(
+ &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links,
+ address_map, GetInterfaceNameVM));
EXPECT_EQ(results.size(), 1ul);
EXPECT_EQ(results[0].name, ifname_vm);
EXPECT_EQ(results[0].prefix_length, 1ul);
@@ -1002,12 +993,9 @@
// vmware address should be trimmed out if policy specified so.
address_map.clear();
ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second);
- EXPECT_TRUE(
- net::internal::GetNetworkListImpl(&results,
- EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES,
- online_links,
- address_map,
- GetInterfaceNameVM));
+ EXPECT_TRUE(internal::GetNetworkListImpl(
+ &results, EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links,
+ address_map, GetInterfaceNameVM));
EXPECT_EQ(results.size(), 0ul);
results.clear();
@@ -1015,12 +1003,9 @@
address_map.clear();
msg.ifa_flags = IFA_F_TENTATIVE;
ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second);
- EXPECT_TRUE(
- net::internal::GetNetworkListImpl(&results,
- INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES,
- online_links,
- address_map,
- GetInterfaceName));
+ EXPECT_TRUE(internal::GetNetworkListImpl(
+ &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links,
+ address_map, GetInterfaceName));
EXPECT_EQ(results.size(), 0ul);
results.clear();
@@ -1029,12 +1014,9 @@
address_map.clear();
msg.ifa_flags = IFA_F_TEMPORARY;
ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second);
- EXPECT_TRUE(
- net::internal::GetNetworkListImpl(&results,
- INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES,
- online_links,
- address_map,
- GetInterfaceName));
+ EXPECT_TRUE(internal::GetNetworkListImpl(
+ &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links,
+ address_map, GetInterfaceName));
EXPECT_EQ(results.size(), 1ul);
EXPECT_EQ(results[0].name, ifname_em1);
EXPECT_EQ(results[0].prefix_length, 1ul);
@@ -1047,12 +1029,9 @@
address_map.clear();
msg.ifa_flags = IFA_F_DEPRECATED;
ASSERT_TRUE(address_map.insert(std::make_pair(ipv6_address, msg)).second);
- EXPECT_TRUE(
- net::internal::GetNetworkListImpl(&results,
- INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES,
- online_links,
- address_map,
- GetInterfaceName));
+ EXPECT_TRUE(internal::GetNetworkListImpl(
+ &results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, online_links,
+ address_map, GetInterfaceName));
EXPECT_EQ(results.size(), 1ul);
EXPECT_EQ(results[0].name, ifname_em1);
EXPECT_EQ(results[0].prefix_length, 1ul);
@@ -1078,7 +1057,7 @@
// Address of offline links should be ignored.
ASSERT_TRUE(FillIfaddrs(&interface, ifname_em1, IFF_UP, ipv6_address,
ipv6_netmask, addresses));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &interface,
&ip_attributes_getter));
EXPECT_EQ(results.size(), 0ul);
@@ -1086,7 +1065,7 @@
// Local address should be trimmed out.
ASSERT_TRUE(FillIfaddrs(&interface, ifname_em1, IFF_RUNNING,
ipv6_local_address, ipv6_netmask, addresses));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &interface,
&ip_attributes_getter));
EXPECT_EQ(results.size(), 0ul);
@@ -1094,7 +1073,7 @@
// vmware address should return by default.
ASSERT_TRUE(FillIfaddrs(&interface, ifname_vm, IFF_RUNNING, ipv6_address,
ipv6_netmask, addresses));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &interface,
&ip_attributes_getter));
EXPECT_EQ(results.size(), 1ul);
@@ -1106,7 +1085,7 @@
// vmware address should be trimmed out if policy specified so.
ASSERT_TRUE(FillIfaddrs(&interface, ifname_vm, IFF_RUNNING, ipv6_address,
ipv6_netmask, addresses));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &interface,
&ip_attributes_getter));
EXPECT_EQ(results.size(), 0ul);
@@ -1117,7 +1096,7 @@
ip_attributes_getter.set_native_attributes(IN6_IFF_ANYCAST);
ASSERT_TRUE(FillIfaddrs(&interface, ifname_em1, IFF_RUNNING, ipv6_address,
ipv6_netmask, addresses));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &interface,
&ip_attributes_getter));
EXPECT_EQ(results.size(), 0ul);
@@ -1128,7 +1107,7 @@
ip_attributes_getter.set_native_attributes(IN6_IFF_TEMPORARY);
ASSERT_TRUE(FillIfaddrs(&interface, ifname_em1, IFF_RUNNING, ipv6_address,
ipv6_netmask, addresses));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &interface,
&ip_attributes_getter));
EXPECT_EQ(results.size(), 1ul);
@@ -1143,7 +1122,7 @@
ip_attributes_getter.set_native_attributes(IN6_IFF_DEPRECATED);
ASSERT_TRUE(FillIfaddrs(&interface, ifname_em1, IFF_RUNNING, ipv6_address,
ipv6_netmask, addresses));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, &interface,
&ip_attributes_getter));
EXPECT_EQ(results.size(), 1ul);
@@ -1232,7 +1211,7 @@
addresses /* sock_addrs */));
adapter_address.OperStatus = IfOperStatusDown;
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, true, &adapter_address));
EXPECT_EQ(results.size(), 0ul);
@@ -1244,7 +1223,7 @@
addresses /* sock_addrs */));
adapter_address.IfType = IF_TYPE_SOFTWARE_LOOPBACK;
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, true, &adapter_address));
EXPECT_EQ(results.size(), 0ul);
@@ -1253,7 +1232,7 @@
&adapter_address /* adapter_address */, ifname_vm /* ifname */,
ipv6_address /* ip_address */, ipv6_prefix /* ip_netmask */,
addresses /* sock_addrs */));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, true, &adapter_address));
EXPECT_EQ(results.size(), 1ul);
EXPECT_EQ(results[0].name, ifname_vm);
@@ -1267,7 +1246,7 @@
&adapter_address /* adapter_address */, ifname_vm /* ifname */,
ipv6_address /* ip_address */, ipv6_prefix /* ip_netmask */,
addresses /* sock_addrs */));
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, EXCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, true, &adapter_address));
EXPECT_EQ(results.size(), 0ul);
results.clear();
@@ -1279,7 +1258,7 @@
addresses /* sock_addrs */));
adapter_address.FirstUnicastAddress->DadState = IpDadStateTentative;
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, true, &adapter_address));
EXPECT_EQ(results.size(), 0ul);
results.clear();
@@ -1295,7 +1274,7 @@
IpPrefixOriginRouterAdvertisement;
adapter_address.FirstUnicastAddress->SuffixOrigin = IpSuffixOriginRandom;
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, true, &adapter_address));
EXPECT_EQ(results.size(), 1ul);
EXPECT_EQ(results[0].name, ifname_em1);
@@ -1313,7 +1292,7 @@
addresses /* sock_addrs */));
adapter_address.FirstUnicastAddress->PreferredLifetime = 0;
adapter_address.FriendlyName = const_cast<PWCHAR>(L"FriendlyInterfaceName");
- EXPECT_TRUE(net::internal::GetNetworkListImpl(
+ EXPECT_TRUE(internal::GetNetworkListImpl(
&results, INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES, true, &adapter_address));
EXPECT_EQ(results.size(), 1ul);
EXPECT_EQ(results[0].friendly_name, "FriendlyInterfaceName");
@@ -1336,7 +1315,7 @@
#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_CHROMEOS)
TEST(NetUtilTest, GetWifiSSIDFromInterfaceList) {
NetworkInterfaceList list;
- EXPECT_EQ(std::string(), net::internal::GetWifiSSIDFromInterfaceListInternal(
+ EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal(
list, TestGetInterfaceSSID));
NetworkInterface interface1;
@@ -1345,7 +1324,7 @@
list.push_back(interface1);
ASSERT_EQ(1u, list.size());
EXPECT_EQ(std::string(kWiFiSSID),
- net::internal::GetWifiSSIDFromInterfaceListInternal(
+ internal::GetWifiSSIDFromInterfaceListInternal(
list, TestGetInterfaceSSID));
NetworkInterface interface2;
@@ -1354,7 +1333,7 @@
list.push_back(interface2);
ASSERT_EQ(2u, list.size());
EXPECT_EQ(std::string(kWiFiSSID),
- net::internal::GetWifiSSIDFromInterfaceListInternal(
+ internal::GetWifiSSIDFromInterfaceListInternal(
list, TestGetInterfaceSSID));
NetworkInterface interface3;
@@ -1362,7 +1341,7 @@
interface3.type = NetworkChangeNotifier::CONNECTION_WIFI;
list.push_back(interface3);
ASSERT_EQ(3u, list.size());
- EXPECT_EQ(std::string(), net::internal::GetWifiSSIDFromInterfaceListInternal(
+ EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal(
list, TestGetInterfaceSSID));
list.pop_back();
@@ -1371,7 +1350,7 @@
interface4.type = NetworkChangeNotifier::CONNECTION_ETHERNET;
list.push_back(interface4);
ASSERT_EQ(3u, list.size());
- EXPECT_EQ(std::string(), net::internal::GetWifiSSIDFromInterfaceListInternal(
+ EXPECT_EQ(std::string(), internal::GetWifiSSIDFromInterfaceListInternal(
list, TestGetInterfaceSSID));
}
#endif // OS_LINUX
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index 86bc253..52f348ef 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -611,8 +611,7 @@
type == NetworkChangeNotifier::CONNECTION_3G ||
type == NetworkChangeNotifier::CONNECTION_4G) {
// Log zero if not perfectly converted.
- if (!base::StringToUint(
- net::android::GetTelephonyNetworkOperator(), &mcc_mnc)) {
+ if (!base::StringToUint(android::GetTelephonyNetworkOperator(), &mcc_mnc)) {
mcc_mnc = 0;
}
}
diff --git a/net/base/network_change_notifier_win_unittest.cc b/net/base/network_change_notifier_win_unittest.cc
index ca59750..04b19e6 100644
--- a/net/base/network_change_notifier_win_unittest.cc
+++ b/net/base/network_change_notifier_win_unittest.cc
@@ -43,8 +43,7 @@
DISALLOW_COPY_AND_ASSIGN(TestNetworkChangeNotifierWin);
};
-class TestIPAddressObserver
- : public net::NetworkChangeNotifier::IPAddressObserver {
+class TestIPAddressObserver : public NetworkChangeNotifier::IPAddressObserver {
public:
TestIPAddressObserver() {
NetworkChangeNotifier::AddIPAddressObserver(this);
diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc
index c12d60b..0aaf2bd3 100644
--- a/net/base/network_delegate.cc
+++ b/net/base/network_delegate.cc
@@ -135,7 +135,7 @@
bool NetworkDelegate::CanGetCookies(const URLRequest& request,
const CookieList& cookie_list) {
DCHECK(CalledOnValidThread());
- DCHECK(!(request.load_flags() & net::LOAD_DO_NOT_SEND_COOKIES));
+ DCHECK(!(request.load_flags() & LOAD_DO_NOT_SEND_COOKIES));
return OnCanGetCookies(request, cookie_list);
}
@@ -143,7 +143,7 @@
const std::string& cookie_line,
CookieOptions* options) {
DCHECK(CalledOnValidThread());
- DCHECK(!(request.load_flags() & net::LOAD_DO_NOT_SAVE_COOKIES));
+ DCHECK(!(request.load_flags() & LOAD_DO_NOT_SAVE_COOKIES));
return OnCanSetCookie(request, cookie_line, options);
}
diff --git a/net/base/openssl_private_key_store_android.cc b/net/base/openssl_private_key_store_android.cc
index a917d589..ba0d75b 100644
--- a/net/base/openssl_private_key_store_android.cc
+++ b/net/base/openssl_private_key_store_android.cc
@@ -36,7 +36,7 @@
}
bool ret = false;
if (public_len > 0 && private_len > 0) {
- ret = net::android::StoreKeyPair(
+ ret = android::StoreKeyPair(
static_cast<const uint8*>(public_key), public_len,
static_cast<const uint8*>(private_key), private_len);
}
diff --git a/net/base/test_completion_callback.cc b/net/base/test_completion_callback.cc
index 7094592..ba44211 100644
--- a/net/base/test_completion_callback.cc
+++ b/net/base/test_completion_callback.cc
@@ -72,7 +72,7 @@
void ReleaseBufferCompletionCallback::SetResult(int result) {
if (!buffer_->HasOneRef())
- result = net::ERR_FAILED;
+ result = ERR_FAILED;
TestCompletionCallback::SetResult(result);
}
diff --git a/net/base/test_completion_callback.h b/net/base/test_completion_callback.h
index b7f8985..3762783 100644
--- a/net/base/test_completion_callback.h
+++ b/net/base/test_completion_callback.h
@@ -58,7 +58,7 @@
}
R GetResult(R result) {
- if (net::ERR_IO_PENDING != result)
+ if (ERR_IO_PENDING != result)
return result;
return WaitForResult();
}
diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc
index b0c8565..35e52d7 100644
--- a/net/base/test_completion_callback_unittest.cc
+++ b/net/base/test_completion_callback_unittest.cc
@@ -13,6 +13,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
+namespace net {
+
namespace {
const int kMagicResult = 8888;
@@ -36,7 +38,7 @@
// Do some imaginary work on a worker thread;
// when done, worker posts callback on the original thread.
// Returns true on success
- bool DoSomething(const net::CompletionCallback& callback);
+ bool DoSomething(const CompletionCallback& callback);
private:
class ExampleWorker;
@@ -49,8 +51,7 @@
class ExampleEmployer::ExampleWorker
: public base::RefCountedThreadSafe<ExampleWorker> {
public:
- ExampleWorker(ExampleEmployer* employer,
- const net::CompletionCallback& callback)
+ ExampleWorker(ExampleEmployer* employer, const CompletionCallback& callback)
: employer_(employer),
callback_(callback),
origin_loop_(base::MessageLoop::current()) {}
@@ -63,7 +64,7 @@
// Only used on the origin thread (where DoSomething was called).
ExampleEmployer* employer_;
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
// Used to post ourselves onto the origin thread.
base::Lock origin_loop_lock_;
base::MessageLoop* origin_loop_;
@@ -101,7 +102,7 @@
ExampleEmployer::~ExampleEmployer() {
}
-bool ExampleEmployer::DoSomething(const net::CompletionCallback& callback) {
+bool ExampleEmployer::DoSomething(const CompletionCallback& callback) {
DCHECK(!request_.get()) << "already in use";
request_ = new ExampleWorker(this, callback);
@@ -125,7 +126,7 @@
TEST_F(TestCompletionCallbackTest, Simple) {
ExampleEmployer boss;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
bool queued = boss.DoSomething(callback.callback());
EXPECT_TRUE(queued);
int result = callback.WaitForResult();
@@ -134,11 +135,11 @@
TEST_F(TestCompletionCallbackTest, Closure) {
ExampleEmployer boss;
- net::TestClosure closure;
+ TestClosure closure;
bool did_check_result = false;
- net::CompletionCallback completion_callback =
- base::Bind(&CallClosureAfterCheckingResult,
- closure.closure(), base::Unretained(&did_check_result));
+ CompletionCallback completion_callback =
+ base::Bind(&CallClosureAfterCheckingResult, closure.closure(),
+ base::Unretained(&did_check_result));
bool queued = boss.DoSomething(completion_callback);
EXPECT_TRUE(queued);
@@ -148,3 +149,5 @@
}
// TODO: test deleting ExampleEmployer while work outstanding
+
+} // namespace net
diff --git a/net/cert/crl_set_unittest.cc b/net/cert/crl_set_unittest.cc
index 16b3dfc..4f74c29e 100644
--- a/net/cert/crl_set_unittest.cc
+++ b/net/cert/crl_set_unittest.cc
@@ -6,6 +6,8 @@
#include "net/cert/crl_set_storage.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
// These data blocks were generated using a lot of code that is still in
// development. For now, if you need to update them, you have to contact agl.
static const uint8 kGIACRLSet[] = {
@@ -186,11 +188,11 @@
TEST(CRLSetTest, Parse) {
base::StringPiece s(reinterpret_cast<const char*>(kGIACRLSet),
sizeof(kGIACRLSet));
- scoped_refptr<net::CRLSet> set;
- EXPECT_TRUE(net::CRLSetStorage::Parse(s, &set));
+ scoped_refptr<CRLSet> set;
+ EXPECT_TRUE(CRLSetStorage::Parse(s, &set));
ASSERT_TRUE(set.get() != NULL);
- const net::CRLSet::CRLList& crls = set->crls();
+ const CRLSet::CRLList& crls = set->crls();
ASSERT_EQ(1u, crls.size());
const std::vector<std::string>& serials = crls[0].second;
static const unsigned kExpectedNumSerials = 13;
@@ -203,12 +205,14 @@
const std::string gia_spki_hash(
reinterpret_cast<const char*>(kGIASPKISHA256),
sizeof(kGIASPKISHA256));
- EXPECT_EQ(net::CRLSet::REVOKED, set->CheckSerial(
- std::string("\x16\x7D\x75\x9D\x00\x03\x00\x00\x14\x55", 10),
- gia_spki_hash));
- EXPECT_EQ(net::CRLSet::GOOD, set->CheckSerial(
- std::string("\x47\x54\x3E\x79\x00\x03\x00\x00\x14\xF5", 10),
- gia_spki_hash));
+ EXPECT_EQ(CRLSet::REVOKED,
+ set->CheckSerial(
+ std::string("\x16\x7D\x75\x9D\x00\x03\x00\x00\x14\x55", 10),
+ gia_spki_hash));
+ EXPECT_EQ(CRLSet::GOOD,
+ set->CheckSerial(
+ std::string("\x47\x54\x3E\x79\x00\x03\x00\x00\x14\xF5", 10),
+ gia_spki_hash));
EXPECT_FALSE(set->IsExpired());
}
@@ -216,34 +220,34 @@
TEST(CRLSetTest, NoOpDeltaUpdate) {
base::StringPiece s(reinterpret_cast<const char*>(kGIACRLSet),
sizeof(kGIACRLSet));
- scoped_refptr<net::CRLSet> set;
- EXPECT_TRUE(net::CRLSetStorage::Parse(s, &set));
+ scoped_refptr<CRLSet> set;
+ EXPECT_TRUE(CRLSetStorage::Parse(s, &set));
ASSERT_TRUE(set.get() != NULL);
- scoped_refptr<net::CRLSet> delta_set;
+ scoped_refptr<CRLSet> delta_set;
base::StringPiece delta(reinterpret_cast<const char*>(kNoopDeltaCRL),
sizeof(kNoopDeltaCRL));
- EXPECT_TRUE(net::CRLSetStorage::ApplyDelta(set.get(), delta, &delta_set));
+ EXPECT_TRUE(CRLSetStorage::ApplyDelta(set.get(), delta, &delta_set));
ASSERT_TRUE(delta_set.get() != NULL);
- std::string out = net::CRLSetStorage::Serialize(delta_set.get());
+ std::string out = CRLSetStorage::Serialize(delta_set.get());
EXPECT_EQ(s.as_string(), out);
}
TEST(CRLSetTest, AddCRLDelta) {
base::StringPiece s(reinterpret_cast<const char*>(kGIACRLSet),
sizeof(kGIACRLSet));
- scoped_refptr<net::CRLSet> set;
- EXPECT_TRUE(net::CRLSetStorage::Parse(s, &set));
+ scoped_refptr<CRLSet> set;
+ EXPECT_TRUE(CRLSetStorage::Parse(s, &set));
ASSERT_TRUE(set.get() != NULL);
- scoped_refptr<net::CRLSet> delta_set;
+ scoped_refptr<CRLSet> delta_set;
base::StringPiece delta(reinterpret_cast<const char*>(kAddCRLDelta),
sizeof(kAddCRLDelta));
- EXPECT_TRUE(net::CRLSetStorage::ApplyDelta(set.get(), delta, &delta_set));
+ EXPECT_TRUE(CRLSetStorage::ApplyDelta(set.get(), delta, &delta_set));
ASSERT_TRUE(delta_set.get() != NULL);
- const net::CRLSet::CRLList& crls = delta_set->crls();
+ const CRLSet::CRLList& crls = delta_set->crls();
ASSERT_EQ(2u, crls.size());
const std::vector<std::string>& serials = crls[1].second;
ASSERT_EQ(12u, serials.size());
@@ -255,24 +259,23 @@
TEST(CRLSetTest, AddRemoveCRLDelta) {
base::StringPiece s(reinterpret_cast<const char*>(kGIACRLSet),
sizeof(kGIACRLSet));
- scoped_refptr<net::CRLSet> set;
- EXPECT_TRUE(net::CRLSetStorage::Parse(s, &set));
+ scoped_refptr<CRLSet> set;
+ EXPECT_TRUE(CRLSetStorage::Parse(s, &set));
ASSERT_TRUE(set.get() != NULL);
- scoped_refptr<net::CRLSet> delta_set;
+ scoped_refptr<CRLSet> delta_set;
base::StringPiece delta(reinterpret_cast<const char*>(kAddCRLDelta),
sizeof(kAddCRLDelta));
- EXPECT_TRUE(net::CRLSetStorage::ApplyDelta(set.get(), delta, &delta_set));
+ EXPECT_TRUE(CRLSetStorage::ApplyDelta(set.get(), delta, &delta_set));
ASSERT_TRUE(delta_set.get() != NULL);
- scoped_refptr<net::CRLSet> delta2_set;
+ scoped_refptr<CRLSet> delta2_set;
base::StringPiece delta2(reinterpret_cast<const char*>(kRemoveCRLDelta),
sizeof(kRemoveCRLDelta));
- EXPECT_TRUE(
- net::CRLSetStorage::ApplyDelta(delta_set.get(), delta2, &delta2_set));
+ EXPECT_TRUE(CRLSetStorage::ApplyDelta(delta_set.get(), delta2, &delta2_set));
ASSERT_TRUE(delta2_set.get() != NULL);
- const net::CRLSet::CRLList& crls = delta2_set->crls();
+ const CRLSet::CRLList& crls = delta2_set->crls();
ASSERT_EQ(1u, crls.size());
const std::vector<std::string>& serials = crls[0].second;
ASSERT_EQ(13u, serials.size());
@@ -281,17 +284,17 @@
TEST(CRLSetTest, UpdateSerialsDelta) {
base::StringPiece s(reinterpret_cast<const char*>(kGIACRLSet),
sizeof(kGIACRLSet));
- scoped_refptr<net::CRLSet> set;
- EXPECT_TRUE(net::CRLSetStorage::Parse(s, &set));
+ scoped_refptr<CRLSet> set;
+ EXPECT_TRUE(CRLSetStorage::Parse(s, &set));
ASSERT_TRUE(set.get() != NULL);
- scoped_refptr<net::CRLSet> delta_set;
+ scoped_refptr<CRLSet> delta_set;
base::StringPiece delta(reinterpret_cast<const char*>(kUpdateSerialsDelta),
sizeof(kUpdateSerialsDelta));
- EXPECT_TRUE(net::CRLSetStorage::ApplyDelta(set.get(), delta, &delta_set));
+ EXPECT_TRUE(CRLSetStorage::ApplyDelta(set.get(), delta, &delta_set));
ASSERT_TRUE(delta_set.get() != NULL);
- const net::CRLSet::CRLList& crls = delta_set->crls();
+ const CRLSet::CRLList& crls = delta_set->crls();
ASSERT_EQ(1u, crls.size());
const std::vector<std::string>& serials = crls[0].second;
EXPECT_EQ(45u, serials.size());
@@ -300,8 +303,8 @@
TEST(CRLSetTest, BlockedSPKIs) {
base::StringPiece s(reinterpret_cast<const char*>(kBlockedSPKICRLSet),
sizeof(kBlockedSPKICRLSet));
- scoped_refptr<net::CRLSet> set;
- EXPECT_TRUE(net::CRLSetStorage::Parse(s, &set));
+ scoped_refptr<CRLSet> set;
+ EXPECT_TRUE(CRLSetStorage::Parse(s, &set));
ASSERT_TRUE(set.get() != NULL);
const uint8 spki_hash[] = {
@@ -310,9 +313,9 @@
0,
};
- EXPECT_EQ(net::CRLSet::GOOD, set->CheckSPKI(""));
- EXPECT_EQ(net::CRLSet::REVOKED, set->CheckSPKI(
- reinterpret_cast<const char*>(spki_hash)));
+ EXPECT_EQ(CRLSet::GOOD, set->CheckSPKI(""));
+ EXPECT_EQ(CRLSet::REVOKED,
+ set->CheckSPKI(reinterpret_cast<const char*>(spki_hash)));
}
TEST(CRLSetTest, Expired) {
@@ -320,9 +323,11 @@
// 1970.
base::StringPiece s(reinterpret_cast<const char*>(kExpiredCRLSet),
sizeof(kExpiredCRLSet));
- scoped_refptr<net::CRLSet> set;
- EXPECT_TRUE(net::CRLSetStorage::Parse(s, &set));
+ scoped_refptr<CRLSet> set;
+ EXPECT_TRUE(CRLSetStorage::Parse(s, &set));
ASSERT_TRUE(set.get() != NULL);
EXPECT_TRUE(set->IsExpired());
}
+
+} // namespace net
diff --git a/net/cert/multi_threaded_cert_verifier.cc b/net/cert/multi_threaded_cert_verifier.cc
index 128987f..6012a35 100644
--- a/net/cert/multi_threaded_cert_verifier.cc
+++ b/net/cert/multi_threaded_cert_verifier.cc
@@ -568,9 +568,8 @@
if (hostname != other.hostname)
return hostname < other.hostname;
return std::lexicographical_compare(
- hash_values.begin(), hash_values.end(),
- other.hash_values.begin(), other.hash_values.end(),
- net::SHA1HashValueLessThan());
+ hash_values.begin(), hash_values.end(), other.hash_values.begin(),
+ other.hash_values.end(), SHA1HashValueLessThan());
}
// HandleResult is called by CertVerifierWorker on the origin message loop.
diff --git a/net/cert/nss_cert_database.cc b/net/cert/nss_cert_database.cc
index e1b3198d..8aaf759 100644
--- a/net/cert/nss_cert_database.cc
+++ b/net/cert/nss_cert_database.cc
@@ -178,12 +178,11 @@
}
}
-int NSSCertDatabase::ImportFromPKCS12(
- CryptoModule* module,
- const std::string& data,
- const base::string16& password,
- bool is_extractable,
- net::CertificateList* imported_certs) {
+int NSSCertDatabase::ImportFromPKCS12(CryptoModule* module,
+ const std::string& data,
+ const base::string16& password,
+ bool is_extractable,
+ CertificateList* imported_certs) {
DVLOG(1) << __func__ << " "
<< PK11_GetModuleID(module->os_module_handle()) << ":"
<< PK11_GetSlotID(module->os_module_handle());
@@ -192,7 +191,7 @@
password,
is_extractable,
imported_certs);
- if (result == net::OK)
+ if (result == OK)
NotifyObserversOfCertAdded(NULL);
return result;
diff --git a/net/cert/nss_cert_database_unittest.cc b/net/cert/nss_cert_database_unittest.cc
index 3c83d05..9b026cc 100644
--- a/net/cert/nss_cert_database_unittest.cc
+++ b/net/cert/nss_cert_database_unittest.cc
@@ -75,9 +75,7 @@
}
protected:
- net::CryptoModule* GetPublicModule() {
- return public_module_.get();
- }
+ CryptoModule* GetPublicModule() { return public_module_.get(); }
static std::string ReadTestFile(const std::string& name) {
std::string result;
@@ -116,7 +114,7 @@
scoped_ptr<NSSCertDatabase> cert_db_;
const CertificateList empty_cert_list_;
crypto::ScopedTestNSSDB test_nssdb_;
- scoped_refptr<net::CryptoModule> public_module_;
+ scoped_refptr<CryptoModule> public_module_;
};
TEST_F(CertDatabaseNSSTest, ListCertsSync) {
diff --git a/net/cert_net/cert_net_fetcher_impl_unittest.cc b/net/cert_net/cert_net_fetcher_impl_unittest.cc
index c803b4c..e602418 100644
--- a/net/cert_net/cert_net_fetcher_impl_unittest.cc
+++ b/net/cert_net/cert_net_fetcher_impl_unittest.cc
@@ -136,7 +136,7 @@
public:
CertNetFetcherImplTest()
: test_server_(SpawnedTestServer::TYPE_HTTP,
- net::SpawnedTestServer::kLocalhost,
+ SpawnedTestServer::kLocalhost,
base::FilePath(kDocRoot)) {
context_.set_network_delegate(&network_delegate_);
}
diff --git a/net/cert_net/nss_ocsp_unittest.cc b/net/cert_net/nss_ocsp_unittest.cc
index 155bcb2..33bb919 100644
--- a/net/cert_net/nss_ocsp_unittest.cc
+++ b/net/cert_net/nss_ocsp_unittest.cc
@@ -40,20 +40,20 @@
"Content-type: application/pkix-cert\0"
"\0";
-class AiaResponseHandler : public net::URLRequestInterceptor {
+class AiaResponseHandler : public URLRequestInterceptor {
public:
AiaResponseHandler(const std::string& headers, const std::string& cert_data)
: headers_(headers), cert_data_(cert_data), request_count_(0) {}
~AiaResponseHandler() override {}
- // net::URLRequestInterceptor implementation:
- net::URLRequestJob* MaybeInterceptRequest(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const override {
+ // URLRequestInterceptor implementation:
+ URLRequestJob* MaybeInterceptRequest(
+ URLRequest* request,
+ NetworkDelegate* network_delegate) const override {
++const_cast<AiaResponseHandler*>(this)->request_count_;
- return new net::URLRequestTestJob(
- request, network_delegate, headers_, cert_data_, true);
+ return new URLRequestTestJob(request, network_delegate, headers_,
+ cert_data_, true);
}
int request_count() const { return request_count_; }
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc
index 5932c23..d957976 100644
--- a/net/cookies/canonical_cookie.cc
+++ b/net/cookies/canonical_cookie.cc
@@ -104,8 +104,7 @@
// Compares cookies using name, domain and path, so that "equivalent" cookies
// (per RFC 2965) are equal to each other.
-int PartialCookieOrdering(const net::CanonicalCookie& a,
- const net::CanonicalCookie& b) {
+int PartialCookieOrdering(const CanonicalCookie& a, const CanonicalCookie& b) {
int diff = a.Name().compare(b.Name());
if (diff != 0)
return diff;
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index d335ae4..4f9b8d7 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -165,15 +165,14 @@
// Compare cookies using name, domain and path, so that "equivalent" cookies
// (per RFC 2965) are equal to each other.
-bool PartialDiffCookieSorter(const net::CanonicalCookie& a,
- const net::CanonicalCookie& b) {
+bool PartialDiffCookieSorter(const CanonicalCookie& a,
+ const CanonicalCookie& b) {
return a.PartialCompare(b);
}
// This is a stricter ordering than PartialDiffCookieOrdering, where all fields
// are used.
-bool FullDiffCookieSorter(const net::CanonicalCookie& a,
- const net::CanonicalCookie& b) {
+bool FullDiffCookieSorter(const CanonicalCookie& a, const CanonicalCookie& b) {
return a.FullCompare(b);
}
@@ -1164,10 +1163,10 @@
bool CookieMonster::ImportCookies(const CookieList& list) {
base::AutoLock autolock(lock_);
InitIfNecessary();
- for (net::CookieList::const_iterator iter = list.begin(); iter != list.end();
+ for (CookieList::const_iterator iter = list.begin(); iter != list.end();
++iter) {
scoped_ptr<CanonicalCookie> cookie(new CanonicalCookie(*iter));
- net::CookieOptions options;
+ CookieOptions options;
options.set_include_httponly();
options.set_include_first_party_only();
if (!SetCanonicalCookie(&cookie, cookie->CreationDate(), options))
@@ -1930,7 +1929,7 @@
bool CookieMonster::SetCanonicalCookies(const CookieList& list) {
base::AutoLock autolock(lock_);
- net::CookieOptions options;
+ CookieOptions options;
options.set_include_httponly();
for (CookieList::const_iterator it = list.begin(); it != list.end(); ++it) {
diff --git a/net/cookies/cookie_monster_perftest.cc b/net/cookies/cookie_monster_perftest.cc
index 95ccbad..0214f68f 100644
--- a/net/cookies/cookie_monster_perftest.cc
+++ b/net/cookies/cookie_monster_perftest.cc
@@ -73,7 +73,7 @@
EXPECT_TRUE(success);
BaseCallback::Run();
}
- net::CookieOptions options_;
+ CookieOptions options_;
};
class GetCookiesCallback : public BaseCallback {
@@ -92,7 +92,7 @@
BaseCallback::Run();
}
std::string cookies_;
- net::CookieOptions options_;
+ CookieOptions options_;
};
} // namespace
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index c76c03f..61dbd09 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -2064,8 +2064,8 @@
std::vector<CanonicalCookie*> out_cookies;
base::MessageLoop::current()->PostTask(
FROM_HERE,
- base::Bind(&net::LoadedCallbackTask::Run,
- new net::LoadedCallbackTask(loaded_callback, out_cookies)));
+ base::Bind(&LoadedCallbackTask::Run,
+ new LoadedCallbackTask(loaded_callback, out_cookies)));
}
void LoadCookiesForKey(const std::string& key,
@@ -2466,7 +2466,7 @@
ASSERT_TRUE(++it == cookies.end());
GetCookieListCallback callback(&other_thread_);
base::Closure task =
- base::Bind(&net::MultiThreadedCookieMonsterTest::GetAllCookiesTask,
+ base::Bind(&MultiThreadedCookieMonsterTest::GetAllCookiesTask,
base::Unretained(this), cm, &callback);
RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
@@ -2488,7 +2488,7 @@
ASSERT_TRUE(++it == cookies.end());
GetCookieListCallback callback(&other_thread_);
base::Closure task =
- base::Bind(&net::MultiThreadedCookieMonsterTest::GetAllCookiesForURLTask,
+ base::Bind(&MultiThreadedCookieMonsterTest::GetAllCookiesForURLTask,
base::Unretained(this), cm, url_google_, &callback);
RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
@@ -2512,7 +2512,7 @@
ASSERT_TRUE(++it == cookies.end());
GetCookieListCallback callback(&other_thread_);
base::Closure task = base::Bind(
- &net::MultiThreadedCookieMonsterTest::GetAllCookiesForURLWithOptionsTask,
+ &MultiThreadedCookieMonsterTest::GetAllCookiesForURLWithOptionsTask,
base::Unretained(this), cm, url_google_, options, &callback);
RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
@@ -2530,7 +2530,7 @@
false, false, COOKIE_PRIORITY_DEFAULT));
ResultSavingCookieCallback<bool> callback(&other_thread_);
base::Closure task =
- base::Bind(&net::MultiThreadedCookieMonsterTest::SetCookieWithDetailsTask,
+ base::Bind(&MultiThreadedCookieMonsterTest::SetCookieWithDetailsTask,
base::Unretained(this), cm, url_google_foo_, &callback);
RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
@@ -2546,10 +2546,10 @@
Time()));
EXPECT_TRUE(SetCookieWithOptions(cm.get(), url_google_, "A=B", options));
ResultSavingCookieCallback<int> callback(&other_thread_);
- base::Closure task = base::Bind(
- &net::MultiThreadedCookieMonsterTest::DeleteAllCreatedBetweenTask,
- base::Unretained(this), cm, now - TimeDelta::FromDays(99), Time(),
- &callback);
+ base::Closure task =
+ base::Bind(&MultiThreadedCookieMonsterTest::DeleteAllCreatedBetweenTask,
+ base::Unretained(this), cm, now - TimeDelta::FromDays(99),
+ Time(), &callback);
RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
EXPECT_EQ(1, callback.result());
@@ -2563,7 +2563,7 @@
EXPECT_TRUE(SetCookieWithOptions(cm.get(), url_google_, "A=B", options));
ResultSavingCookieCallback<int> callback(&other_thread_);
base::Closure task =
- base::Bind(&net::MultiThreadedCookieMonsterTest::DeleteAllForHostTask,
+ base::Bind(&MultiThreadedCookieMonsterTest::DeleteAllForHostTask,
base::Unretained(this), cm, url_google_, &callback);
RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
@@ -2604,7 +2604,7 @@
// 2. Second set of deletions.
base::Closure task = base::Bind(
- &net::MultiThreadedCookieMonsterTest::DeleteAllCreatedBetweenForHostTask,
+ &MultiThreadedCookieMonsterTest::DeleteAllCreatedBetweenForHostTask,
base::Unretained(this), cm, ago1, Time(), url_google_, &callback);
RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
@@ -2623,9 +2623,9 @@
ResultSavingCookieCallback<bool> callback(&other_thread_);
cookies = GetAllCookies(cm.get());
it = cookies.begin();
- base::Closure task = base::Bind(
- &net::MultiThreadedCookieMonsterTest::DeleteCanonicalCookieTask,
- base::Unretained(this), cm, *it, &callback);
+ base::Closure task =
+ base::Bind(&MultiThreadedCookieMonsterTest::DeleteCanonicalCookieTask,
+ base::Unretained(this), cm, *it, &callback);
RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
EXPECT_TRUE(callback.result());
@@ -2831,9 +2831,9 @@
scoped_refptr<CookieMonster> monster_;
};
-void RecordCookieChanges(std::vector<net::CanonicalCookie>* out_cookies,
+void RecordCookieChanges(std::vector<CanonicalCookie>* out_cookies,
std::vector<bool>* out_removes,
- const net::CanonicalCookie& cookie,
+ const CanonicalCookie& cookie,
bool removed) {
DCHECK(out_cookies);
out_cookies->push_back(cookie);
@@ -2842,7 +2842,7 @@
}
TEST_F(CookieMonsterNotificationTest, NoNotifyWithNoCookie) {
- std::vector<net::CanonicalCookie> cookies;
+ std::vector<CanonicalCookie> cookies;
scoped_ptr<CookieStore::CookieChangedSubscription> sub(
monster()->AddCallbackForCookie(
test_url_, "abc",
@@ -2852,7 +2852,7 @@
}
TEST_F(CookieMonsterNotificationTest, NoNotifyWithInitialCookie) {
- std::vector<net::CanonicalCookie> cookies;
+ std::vector<CanonicalCookie> cookies;
SetCookie(monster(), test_url_, "abc=def");
base::MessageLoop::current()->RunUntilIdle();
scoped_ptr<CookieStore::CookieChangedSubscription> sub(
@@ -2864,7 +2864,7 @@
}
TEST_F(CookieMonsterNotificationTest, NotifyOnSet) {
- std::vector<net::CanonicalCookie> cookies;
+ std::vector<CanonicalCookie> cookies;
std::vector<bool> removes;
scoped_ptr<CookieStore::CookieChangedSubscription> sub(
monster()->AddCallbackForCookie(
@@ -2881,7 +2881,7 @@
}
TEST_F(CookieMonsterNotificationTest, NotifyOnDelete) {
- std::vector<net::CanonicalCookie> cookies;
+ std::vector<CanonicalCookie> cookies;
std::vector<bool> removes;
scoped_ptr<CookieStore::CookieChangedSubscription> sub(
monster()->AddCallbackForCookie(
@@ -2903,7 +2903,7 @@
}
TEST_F(CookieMonsterNotificationTest, NotifyOnUpdate) {
- std::vector<net::CanonicalCookie> cookies;
+ std::vector<CanonicalCookie> cookies;
std::vector<bool> removes;
scoped_ptr<CookieStore::CookieChangedSubscription> sub(
monster()->AddCallbackForCookie(
@@ -2931,8 +2931,8 @@
}
TEST_F(CookieMonsterNotificationTest, MultipleNotifies) {
- std::vector<net::CanonicalCookie> cookies0;
- std::vector<net::CanonicalCookie> cookies1;
+ std::vector<CanonicalCookie> cookies0;
+ std::vector<CanonicalCookie> cookies1;
scoped_ptr<CookieStore::CookieChangedSubscription> sub0(
monster()->AddCallbackForCookie(
test_url_, "abc",
@@ -2952,8 +2952,8 @@
}
TEST_F(CookieMonsterNotificationTest, MultipleSameNotifies) {
- std::vector<net::CanonicalCookie> cookies0;
- std::vector<net::CanonicalCookie> cookies1;
+ std::vector<CanonicalCookie> cookies0;
+ std::vector<CanonicalCookie> cookies1;
scoped_ptr<CookieStore::CookieChangedSubscription> sub0(
monster()->AddCallbackForCookie(
test_url_, "abc",
diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h
index 8a666c93..fa429fd 100644
--- a/net/cookies/cookie_store_unittest.h
+++ b/net/cookies/cookie_store_unittest.h
@@ -1107,10 +1107,9 @@
EXPECT_TRUE(this->SetCookie(cs.get(), this->url_google_, "A=B"));
this->MatchCookieLines("A=B", this->GetCookies(cs.get(), this->url_google_));
StringResultCookieCallback callback(&this->other_thread_);
- base::Closure task = base::Bind(
- &net::MultiThreadedCookieStoreTest<TypeParam>::GetCookiesTask,
- base::Unretained(this),
- cs, this->url_google_, &callback);
+ base::Closure task =
+ base::Bind(&MultiThreadedCookieStoreTest<TypeParam>::GetCookiesTask,
+ base::Unretained(this), cs, this->url_google_, &callback);
this->RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
EXPECT_EQ("A=B", callback.result());
@@ -1126,9 +1125,8 @@
"A=B", this->GetCookiesWithOptions(cs.get(), this->url_google_, options));
StringResultCookieCallback callback(&this->other_thread_);
base::Closure task = base::Bind(
- &net::MultiThreadedCookieStoreTest<TypeParam>::GetCookiesWithOptionsTask,
- base::Unretained(this),
- cs, this->url_google_, options, &callback);
+ &MultiThreadedCookieStoreTest<TypeParam>::GetCookiesWithOptionsTask,
+ base::Unretained(this), cs, this->url_google_, options, &callback);
this->RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
EXPECT_EQ("A=B", callback.result());
@@ -1143,9 +1141,8 @@
this->SetCookieWithOptions(cs.get(), this->url_google_, "A=B", options));
ResultSavingCookieCallback<bool> callback(&this->other_thread_);
base::Closure task = base::Bind(
- &net::MultiThreadedCookieStoreTest<TypeParam>::SetCookieWithOptionsTask,
- base::Unretained(this),
- cs, this->url_google_, "A=B", options, &callback);
+ &MultiThreadedCookieStoreTest<TypeParam>::SetCookieWithOptionsTask,
+ base::Unretained(this), cs, this->url_google_, "A=B", options, &callback);
this->RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
EXPECT_TRUE(callback.result());
@@ -1162,10 +1159,9 @@
EXPECT_TRUE(
this->SetCookieWithOptions(cs.get(), this->url_google_, "A=B", options));
NoResultCookieCallback callback(&this->other_thread_);
- base::Closure task = base::Bind(
- &net::MultiThreadedCookieStoreTest<TypeParam>::DeleteCookieTask,
- base::Unretained(this),
- cs, this->url_google_, "A", &callback);
+ base::Closure task =
+ base::Bind(&MultiThreadedCookieStoreTest<TypeParam>::DeleteCookieTask,
+ base::Unretained(this), cs, this->url_google_, "A", &callback);
this->RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
}
@@ -1188,9 +1184,8 @@
this->SetCookieWithOptions(cs.get(), this->url_google_, "A=B", options));
ResultSavingCookieCallback<int> callback(&this->other_thread_);
base::Closure task = base::Bind(
- &net::MultiThreadedCookieStoreTest<TypeParam>::DeleteSessionCookiesTask,
- base::Unretained(this),
- cs, &callback);
+ &MultiThreadedCookieStoreTest<TypeParam>::DeleteSessionCookiesTask,
+ base::Unretained(this), cs, &callback);
this->RunOnOtherThread(task);
EXPECT_TRUE(callback.did_run());
EXPECT_EQ(1, callback.result());
diff --git a/net/cookies/cookie_util_unittest.cc b/net/cookies/cookie_util_unittest.cc
index 392faf1..1cbe80ea 100644
--- a/net/cookies/cookie_util_unittest.cc
+++ b/net/cookies/cookie_util_unittest.cc
@@ -10,6 +10,8 @@
#include "net/cookies/cookie_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
struct RequestCookieParsingTest {
@@ -17,9 +19,9 @@
std::vector<std::pair<std::string, std::string> > parsed;
};
-net::cookie_util::ParsedRequestCookies MakeParsedRequestCookies(
- const std::vector<std::pair<std::string, std::string> >& data) {
- net::cookie_util::ParsedRequestCookies parsed;
+cookie_util::ParsedRequestCookies MakeParsedRequestCookies(
+ const std::vector<std::pair<std::string, std::string>>& data) {
+ cookie_util::ParsedRequestCookies parsed;
for (size_t i = 0; i < data.size(); i++) {
parsed.push_back(std::make_pair(base::StringPiece(data[i].first),
base::StringPiece(data[i].second)));
@@ -30,17 +32,16 @@
void CheckParse(
const std::string& str,
const std::vector<std::pair<std::string, std::string> >& parsed_expected) {
- net::cookie_util::ParsedRequestCookies parsed;
- net::cookie_util::ParseRequestCookieLine(str, &parsed);
+ cookie_util::ParsedRequestCookies parsed;
+ cookie_util::ParseRequestCookieLine(str, &parsed);
EXPECT_EQ(MakeParsedRequestCookies(parsed_expected), parsed);
}
void CheckSerialize(
const std::vector<std::pair<std::string, std::string> >& parsed,
const std::string& str_expected) {
- net::cookie_util::ParsedRequestCookies prc =
- MakeParsedRequestCookies(parsed);
- EXPECT_EQ(str_expected, net::cookie_util::SerializeRequestCookieLine(prc));
+ cookie_util::ParsedRequestCookies prc = MakeParsedRequestCookies(parsed);
+ EXPECT_EQ(str_expected, cookie_util::SerializeRequestCookieLine(prc));
}
TEST(CookieUtilTest, TestDomainIsHostOnly) {
@@ -55,7 +56,7 @@
for (size_t i = 0; i < arraysize(tests); ++i) {
EXPECT_EQ(tests[i].is_host_only,
- net::cookie_util::DomainIsHostOnly(tests[i].str));
+ cookie_util::DomainIsHostOnly(tests[i].str));
}
}
@@ -137,7 +138,7 @@
base::Time parsed_time;
for (size_t i = 0; i < arraysize(tests); ++i) {
- parsed_time = net::cookie_util::ParseCookieTime(tests[i].str);
+ parsed_time = cookie_util::ParseCookieTime(tests[i].str);
if (!tests[i].valid) {
EXPECT_FALSE(!parsed_time.is_null()) << tests[i].str;
continue;
@@ -197,15 +198,17 @@
// Note: registry_controlled_domains::GetDomainAndRegistry is tested in its
// own unittests.
EXPECT_EQ("example.com",
- net::cookie_util::GetEffectiveDomain("http", "www.example.com"));
+ cookie_util::GetEffectiveDomain("http", "www.example.com"));
EXPECT_EQ("example.com",
- net::cookie_util::GetEffectiveDomain("https", "www.example.com"));
+ cookie_util::GetEffectiveDomain("https", "www.example.com"));
EXPECT_EQ("example.com",
- net::cookie_util::GetEffectiveDomain("ws", "www.example.com"));
+ cookie_util::GetEffectiveDomain("ws", "www.example.com"));
EXPECT_EQ("example.com",
- net::cookie_util::GetEffectiveDomain("wss", "www.example.com"));
+ cookie_util::GetEffectiveDomain("wss", "www.example.com"));
EXPECT_EQ("www.example.com",
- net::cookie_util::GetEffectiveDomain("ftp", "www.example.com"));
+ cookie_util::GetEffectiveDomain("ftp", "www.example.com"));
}
} // namespace
+
+} // namespace net
diff --git a/net/dns/dns_config_service.h b/net/dns/dns_config_service.h
index bfb5785..d7f3b07 100644
--- a/net/dns/dns_config_service.h
+++ b/net/dns/dns_config_service.h
@@ -50,7 +50,7 @@
~NameServerClassifier();
NameServersType GetNameServersType(
- const std::vector<net::IPEndPoint>& nameservers) const;
+ const std::vector<IPEndPoint>& nameservers) const;
private:
struct NameServerTypeRule;
diff --git a/net/dns/dns_session_unittest.cc b/net/dns/dns_session_unittest.cc
index ea04016..46815e00 100644
--- a/net/dns/dns_session_unittest.cc
+++ b/net/dns/dns_session_unittest.cc
@@ -29,8 +29,8 @@
scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket(
DatagramSocket::BindType bind_type,
const RandIntCallback& rand_int_cb,
- net::NetLog* net_log,
- const net::NetLog::Source& source) override;
+ NetLog* net_log,
+ const NetLog::Source& source) override;
scoped_ptr<StreamSocket> CreateTransportClientSocket(
const AddressList& addresses,
@@ -182,8 +182,8 @@
TestClientSocketFactory::CreateDatagramClientSocket(
DatagramSocket::BindType bind_type,
const RandIntCallback& rand_int_cb,
- net::NetLog* net_log,
- const net::NetLog::Source& source) {
+ NetLog* net_log,
+ const NetLog::Source& source) {
// We're not actually expecting to send or receive any data, so use the
// simplest SocketDataProvider with no data supplied.
SocketDataProvider* data_provider = new StaticSocketDataProvider();
diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc
index 30e3d2e7..2ba3763 100644
--- a/net/dns/dns_test_util.cc
+++ b/net/dns/dns_test_util.cc
@@ -106,8 +106,8 @@
const uint32 kTTL = 86400; // One day.
// Size of RDATA which is a IPv4 or IPv6 address.
- size_t rdata_size = qtype_ == net::dns_protocol::kTypeA ?
- net::kIPv4AddressSize : net::kIPv6AddressSize;
+ size_t rdata_size = qtype_ == dns_protocol::kTypeA ? kIPv4AddressSize
+ : kIPv6AddressSize;
// 12 is the sum of sizes of the compressed name reference, TYPE,
// CLASS, TTL and RDLENGTH.
@@ -118,10 +118,10 @@
base::BigEndianWriter writer(buffer + nbytes, answer_size);
writer.WriteU16(kPointerToQueryName);
writer.WriteU16(qtype_);
- writer.WriteU16(net::dns_protocol::kClassIN);
+ writer.WriteU16(dns_protocol::kClassIN);
writer.WriteU32(kTTL);
writer.WriteU16(rdata_size);
- if (qtype_ == net::dns_protocol::kTypeA) {
+ if (qtype_ == dns_protocol::kTypeA) {
char kIPv4Loopback[] = { 0x7f, 0, 0, 1 };
writer.WriteBytes(kIPv4Loopback, sizeof(kIPv4Loopback));
} else {
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc
index 933c7558..2693a5ca 100644
--- a/net/dns/dns_transaction_unittest.cc
+++ b/net/dns/dns_transaction_unittest.cc
@@ -187,8 +187,8 @@
scoped_ptr<DatagramClientSocket> CreateDatagramClientSocket(
DatagramSocket::BindType bind_type,
const RandIntCallback& rand_int_cb,
- net::NetLog* net_log,
- const net::NetLog::Source& source) override {
+ NetLog* net_log,
+ const NetLog::Source& source) override {
if (fail_next_socket_) {
fail_next_socket_ = false;
return scoped_ptr<DatagramClientSocket>(
diff --git a/net/dns/mdns_client_impl.cc b/net/dns/mdns_client_impl.cc
index 1c313d8..ac13bf5 100644
--- a/net/dns/mdns_client_impl.cc
+++ b/net/dns/mdns_client_impl.cc
@@ -45,8 +45,8 @@
ScopedVector<DatagramServerSocket>* sockets) {
InterfaceIndexFamilyList interfaces(GetMDnsInterfacesToBind());
for (size_t i = 0; i < interfaces.size(); ++i) {
- DCHECK(interfaces[i].second == net::ADDRESS_FAMILY_IPV4 ||
- interfaces[i].second == net::ADDRESS_FAMILY_IPV6);
+ DCHECK(interfaces[i].second == ADDRESS_FAMILY_IPV4 ||
+ interfaces[i].second == ADDRESS_FAMILY_IPV6);
scoped_ptr<DatagramServerSocket> socket(
CreateAndBindMDnsSocket(interfaces[i].second, interfaces[i].first));
if (socket)
@@ -454,7 +454,7 @@
uint16 rrtype,
const std::string& name,
MDnsListener::Delegate* delegate) {
- return scoped_ptr<net::MDnsListener>(
+ return scoped_ptr<MDnsListener>(
new MDnsListenerImpl(rrtype, name, clock_.get(), delegate, this));
}
diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc
index 6d8cba38..810765c 100644
--- a/net/dns/mock_host_resolver.cc
+++ b/net/dns/mock_host_resolver.cc
@@ -379,7 +379,7 @@
return ERR_NAME_NOT_RESOLVED;
case Rule::kResolverTypeSystem:
#if defined(OS_WIN)
- net::EnsureWinsockInit();
+ EnsureWinsockInit();
#endif
return SystemHostResolverCall(effective_host,
address_family,
diff --git a/net/ftp/ftp_auth_cache_unittest.cc b/net/ftp/ftp_auth_cache_unittest.cc
index bd47b64..892153c3 100644
--- a/net/ftp/ftp_auth_cache_unittest.cc
+++ b/net/ftp/ftp_auth_cache_unittest.cc
@@ -12,7 +12,8 @@
#include "url/gurl.h"
using base::ASCIIToUTF16;
-using net::FtpAuthCache;
+
+namespace net {
namespace {
@@ -40,7 +41,7 @@
EXPECT_TRUE(cache.Lookup(origin1) == NULL);
// Add entry for origin1.
- cache.Add(origin1, net::AuthCredentials(kUsername1, kPassword1));
+ cache.Add(origin1, AuthCredentials(kUsername1, kPassword1));
FtpAuthCache::Entry* entry1 = cache.Lookup(origin1);
ASSERT_TRUE(entry1);
EXPECT_EQ(origin1, entry1->origin);
@@ -48,7 +49,7 @@
EXPECT_EQ(kPassword1, entry1->credentials.password());
// Add an entry for origin2.
- cache.Add(origin2, net::AuthCredentials(kUsername2, kPassword2));
+ cache.Add(origin2, AuthCredentials(kUsername2, kPassword2));
FtpAuthCache::Entry* entry2 = cache.Lookup(origin2);
ASSERT_TRUE(entry2);
EXPECT_EQ(origin2, entry2->origin);
@@ -59,7 +60,7 @@
EXPECT_EQ(entry1, cache.Lookup(origin1));
// Overwrite the entry for origin1.
- cache.Add(origin1, net::AuthCredentials(kUsername3, kPassword3));
+ cache.Add(origin1, AuthCredentials(kUsername3, kPassword3));
FtpAuthCache::Entry* entry3 = cache.Lookup(origin1);
ASSERT_TRUE(entry3);
EXPECT_EQ(origin1, entry3->origin);
@@ -67,11 +68,11 @@
EXPECT_EQ(kPassword3, entry3->credentials.password());
// Remove entry of origin1.
- cache.Remove(origin1, net::AuthCredentials(kUsername3, kPassword3));
+ cache.Remove(origin1, AuthCredentials(kUsername3, kPassword3));
EXPECT_TRUE(cache.Lookup(origin1) == NULL);
// Remove non-existent entry.
- cache.Remove(origin1, net::AuthCredentials(kUsername3, kPassword3));
+ cache.Remove(origin1, AuthCredentials(kUsername3, kPassword3));
EXPECT_TRUE(cache.Lookup(origin1) == NULL);
}
@@ -83,8 +84,8 @@
GURL origin1("ftp://foo:80");
GURL origin2("ftp://foo:21");
- cache.Add(origin1, net::AuthCredentials(kUsername, kPassword));
- cache.Add(origin2, net::AuthCredentials(kUsername, kPassword));
+ cache.Add(origin1, AuthCredentials(kUsername, kPassword));
+ cache.Add(origin2, AuthCredentials(kUsername, kPassword));
EXPECT_NE(cache.Lookup(origin1), cache.Lookup(origin2));
}
@@ -97,7 +98,7 @@
FtpAuthCache cache;
// Add.
- cache.Add(GURL("ftp://HoSt:21"), net::AuthCredentials(kUsername, kPassword));
+ cache.Add(GURL("ftp://HoSt:21"), AuthCredentials(kUsername, kPassword));
// Lookup.
FtpAuthCache::Entry* entry1 = cache.Lookup(GURL("ftp://HoSt:21"));
@@ -106,7 +107,7 @@
EXPECT_EQ(entry1, cache.Lookup(GURL("ftp://host")));
// Overwrite.
- cache.Add(GURL("ftp://host"), net::AuthCredentials(kOthername, kOtherword));
+ cache.Add(GURL("ftp://host"), AuthCredentials(kOthername, kOtherword));
FtpAuthCache::Entry* entry2 = cache.Lookup(GURL("ftp://HoSt:21"));
ASSERT_TRUE(entry2);
EXPECT_EQ(GURL("ftp://host"), entry2->origin);
@@ -114,23 +115,22 @@
EXPECT_EQ(kOtherword, entry2->credentials.password());
// Remove
- cache.Remove(GURL("ftp://HOsT"),
- net::AuthCredentials(kOthername, kOtherword));
+ cache.Remove(GURL("ftp://HOsT"), AuthCredentials(kOthername, kOtherword));
EXPECT_TRUE(cache.Lookup(GURL("ftp://host")) == NULL);
}
TEST(FtpAuthCacheTest, OnlyRemoveMatching) {
FtpAuthCache cache;
- cache.Add(GURL("ftp://host"), net::AuthCredentials(kUsername, kPassword));
+ cache.Add(GURL("ftp://host"), AuthCredentials(kUsername, kPassword));
EXPECT_TRUE(cache.Lookup(GURL("ftp://host")));
// Auth data doesn't match, shouldn't remove.
- cache.Remove(GURL("ftp://host"), net::AuthCredentials(kBogus, kBogus));
+ cache.Remove(GURL("ftp://host"), AuthCredentials(kBogus, kBogus));
EXPECT_TRUE(cache.Lookup(GURL("ftp://host")));
// Auth data matches, should remove.
- cache.Remove(GURL("ftp://host"), net::AuthCredentials(kUsername, kPassword));
+ cache.Remove(GURL("ftp://host"), AuthCredentials(kUsername, kPassword));
EXPECT_TRUE(cache.Lookup(GURL("ftp://host")) == NULL);
}
@@ -139,7 +139,7 @@
for (size_t i = 0; i < FtpAuthCache::kMaxEntries; i++) {
cache.Add(GURL("ftp://host" + base::IntToString(i)),
- net::AuthCredentials(kUsername, kPassword));
+ AuthCredentials(kUsername, kPassword));
}
// No entries should be evicted before reaching the limit.
@@ -148,8 +148,7 @@
}
// Adding one entry should cause eviction of the first entry.
- cache.Add(GURL("ftp://last_host"),
- net::AuthCredentials(kUsername, kPassword));
+ cache.Add(GURL("ftp://last_host"), AuthCredentials(kUsername, kPassword));
EXPECT_TRUE(cache.Lookup(GURL("ftp://host0")) == NULL);
// Remaining entries should not get evicted.
@@ -158,3 +157,5 @@
}
EXPECT_TRUE(cache.Lookup(GURL("ftp://last_host")));
}
+
+} // namespace net
diff --git a/net/ftp/ftp_ctrl_response_buffer_unittest.cc b/net/ftp/ftp_ctrl_response_buffer_unittest.cc
index f74b287..759ed87 100644
--- a/net/ftp/ftp_ctrl_response_buffer_unittest.cc
+++ b/net/ftp/ftp_ctrl_response_buffer_unittest.cc
@@ -9,28 +9,29 @@
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
class FtpCtrlResponseBufferTest : public testing::Test {
public:
- FtpCtrlResponseBufferTest() : buffer_(net::BoundNetLog()) {
- }
+ FtpCtrlResponseBufferTest() : buffer_(BoundNetLog()) {}
protected:
int PushDataToBuffer(const char* data) {
return buffer_.ConsumeData(data, strlen(data));
}
- net::FtpCtrlResponseBuffer buffer_;
+ FtpCtrlResponseBuffer buffer_;
};
TEST_F(FtpCtrlResponseBufferTest, Basic) {
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("200 Status Text\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("200 Status Text\r\n"));
EXPECT_TRUE(buffer_.ResponseAvailable());
- net::FtpCtrlResponse response = buffer_.PopResponse();
+ FtpCtrlResponse response = buffer_.PopResponse();
EXPECT_FALSE(buffer_.ResponseAvailable());
EXPECT_EQ(200, response.status_code);
ASSERT_EQ(1U, response.lines.size());
@@ -38,18 +39,18 @@
}
TEST_F(FtpCtrlResponseBufferTest, Chunks) {
- EXPECT_EQ(net::OK, PushDataToBuffer("20"));
+ EXPECT_EQ(OK, PushDataToBuffer("20"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("0 Status"));
+ EXPECT_EQ(OK, PushDataToBuffer("0 Status"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer(" Text"));
+ EXPECT_EQ(OK, PushDataToBuffer(" Text"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("\r"));
+ EXPECT_EQ(OK, PushDataToBuffer("\r"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("\n"));
EXPECT_TRUE(buffer_.ResponseAvailable());
- net::FtpCtrlResponse response = buffer_.PopResponse();
+ FtpCtrlResponse response = buffer_.PopResponse();
EXPECT_FALSE(buffer_.ResponseAvailable());
EXPECT_EQ(200, response.status_code);
ASSERT_EQ(1U, response.lines.size());
@@ -57,16 +58,16 @@
}
TEST_F(FtpCtrlResponseBufferTest, Continuation) {
- EXPECT_EQ(net::OK, PushDataToBuffer("230-FirstLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230-FirstLine\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("230-SecondLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230-SecondLine\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("230 LastLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230 LastLine\r\n"));
EXPECT_TRUE(buffer_.ResponseAvailable());
- net::FtpCtrlResponse response = buffer_.PopResponse();
+ FtpCtrlResponse response = buffer_.PopResponse();
EXPECT_FALSE(buffer_.ResponseAvailable());
EXPECT_EQ(230, response.status_code);
ASSERT_EQ(3U, response.lines.size());
@@ -76,22 +77,22 @@
}
TEST_F(FtpCtrlResponseBufferTest, MultilineContinuation) {
- EXPECT_EQ(net::OK, PushDataToBuffer("230-FirstLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230-FirstLine\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("Continued\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("Continued\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("230-SecondLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230-SecondLine\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("215 Continued\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("215 Continued\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("230 LastLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230 LastLine\r\n"));
EXPECT_TRUE(buffer_.ResponseAvailable());
- net::FtpCtrlResponse response = buffer_.PopResponse();
+ FtpCtrlResponse response = buffer_.PopResponse();
EXPECT_FALSE(buffer_.ResponseAvailable());
EXPECT_EQ(230, response.status_code);
ASSERT_EQ(3U, response.lines.size());
@@ -102,16 +103,16 @@
TEST_F(FtpCtrlResponseBufferTest, MultilineContinuationZeroLength) {
// For the corner case from bug 29322.
- EXPECT_EQ(net::OK, PushDataToBuffer("230-\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230-\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("example.com\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("example.com\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("230 LastLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230 LastLine\r\n"));
EXPECT_TRUE(buffer_.ResponseAvailable());
- net::FtpCtrlResponse response = buffer_.PopResponse();
+ FtpCtrlResponse response = buffer_.PopResponse();
EXPECT_FALSE(buffer_.ResponseAvailable());
EXPECT_EQ(230, response.status_code);
ASSERT_EQ(2U, response.lines.size());
@@ -120,18 +121,18 @@
}
TEST_F(FtpCtrlResponseBufferTest, SimilarContinuation) {
- EXPECT_EQ(net::OK, PushDataToBuffer("230-FirstLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230-FirstLine\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
// Notice the space at the start of the line. It should be recognized
// as a continuation, and not the last line.
- EXPECT_EQ(net::OK, PushDataToBuffer(" 230 Continued\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer(" 230 Continued\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("230 TrueLastLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230 TrueLastLine\r\n"));
EXPECT_TRUE(buffer_.ResponseAvailable());
- net::FtpCtrlResponse response = buffer_.PopResponse();
+ FtpCtrlResponse response = buffer_.PopResponse();
EXPECT_FALSE(buffer_.ResponseAvailable());
EXPECT_EQ(230, response.status_code);
ASSERT_EQ(2U, response.lines.size());
@@ -141,19 +142,19 @@
// The nesting of multi-line responses is not allowed.
TEST_F(FtpCtrlResponseBufferTest, NoNesting) {
- EXPECT_EQ(net::OK, PushDataToBuffer("230-FirstLine\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230-FirstLine\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("300-Continuation\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("300-Continuation\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("300 Still continuation\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("300 Still continuation\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
- EXPECT_EQ(net::OK, PushDataToBuffer("230 Real End\r\n"));
+ EXPECT_EQ(OK, PushDataToBuffer("230 Real End\r\n"));
ASSERT_TRUE(buffer_.ResponseAvailable());
- net::FtpCtrlResponse response = buffer_.PopResponse();
+ FtpCtrlResponse response = buffer_.PopResponse();
EXPECT_FALSE(buffer_.ResponseAvailable());
EXPECT_EQ(230, response.status_code);
ASSERT_EQ(2U, response.lines.size());
@@ -163,13 +164,15 @@
}
TEST_F(FtpCtrlResponseBufferTest, NonNumericResponse) {
- EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("Non-numeric\r\n"));
+ EXPECT_EQ(ERR_INVALID_RESPONSE, PushDataToBuffer("Non-numeric\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
}
TEST_F(FtpCtrlResponseBufferTest, OutOfRangeResponse) {
- EXPECT_EQ(net::ERR_INVALID_RESPONSE, PushDataToBuffer("777 OK?\r\n"));
+ EXPECT_EQ(ERR_INVALID_RESPONSE, PushDataToBuffer("777 OK?\r\n"));
EXPECT_FALSE(buffer_.ResponseAvailable());
}
} // namespace
+
+} // namespace net
diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc
index 2d23b6aec..7fb92073 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls.cc
@@ -14,6 +14,8 @@
#include "net/ftp/ftp_directory_listing_parser.h"
#include "net/ftp/ftp_util.h"
+namespace net {
+
namespace {
bool TwoColumnDateListingToTime(const base::string16& date,
@@ -78,11 +80,8 @@
// * 8. year or time <-- column_offset will be the index of this column
// 9. file name (optional, may contain spaces)
for (size_t i = 5U; i < columns.size(); i++) {
- if (net::FtpUtil::LsDateListingToTime(columns[i - 2],
- columns[i - 1],
- columns[i],
- current_time,
- modification_time)) {
+ if (FtpUtil::LsDateListingToTime(columns[i - 2], columns[i - 1], columns[i],
+ current_time, modification_time)) {
*size = columns[i - 3];
*offset = i;
return true;
@@ -93,11 +92,8 @@
// (for example Russian listings). We try to recognize them only after making
// sure no column offset works above (this is a more strict way).
for (size_t i = 5U; i < columns.size(); i++) {
- if (net::FtpUtil::LsDateListingToTime(columns[i - 1],
- columns[i - 2],
- columns[i],
- current_time,
- modification_time)) {
+ if (FtpUtil::LsDateListingToTime(columns[i - 1], columns[i - 2], columns[i],
+ current_time, modification_time)) {
*size = columns[i - 3];
*offset = i;
return true;
@@ -120,8 +116,6 @@
} // namespace
-namespace net {
-
bool ParseFtpDirectoryListingLs(
const std::vector<base::string16>& lines,
const base::Time& current_time,
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index 5732c64..3c67114 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -25,12 +25,14 @@
#include "net/socket/client_socket_factory.h"
#include "net/socket/stream_socket.h"
+namespace net {
+
+namespace {
+
const char kCRLF[] = "\r\n";
const int kCtrlBufLen = 1024;
-namespace {
-
// Returns true if |input| can be safely used as a part of FTP command.
bool IsValidFTPCommandString(const std::string& input) {
// RFC 959 only allows ASCII strings, but at least Firefox can send non-ASCII
@@ -94,21 +96,21 @@
int GetNetErrorCodeForFtpResponseCode(int response_code) {
switch (response_code) {
case 421:
- return net::ERR_FTP_SERVICE_UNAVAILABLE;
+ return ERR_FTP_SERVICE_UNAVAILABLE;
case 426:
- return net::ERR_FTP_TRANSFER_ABORTED;
+ return ERR_FTP_TRANSFER_ABORTED;
case 450:
- return net::ERR_FTP_FILE_BUSY;
+ return ERR_FTP_FILE_BUSY;
case 500:
case 501:
- return net::ERR_FTP_SYNTAX_ERROR;
+ return ERR_FTP_SYNTAX_ERROR;
case 502:
case 504:
- return net::ERR_FTP_COMMAND_NOT_SUPPORTED;
+ return ERR_FTP_COMMAND_NOT_SUPPORTED;
case 503:
- return net::ERR_FTP_BAD_COMMAND_SEQUENCE;
+ return ERR_FTP_BAD_COMMAND_SEQUENCE;
default:
- return net::ERR_FTP_FAILED;
+ return ERR_FTP_FAILED;
}
}
@@ -116,8 +118,7 @@
// The text returned in response to the EPSV command MUST be:
// <some text> (<d><d><d><tcp-port><d>)
// <d> is a delimiter character, ideally to be |
-bool ExtractPortFromEPSVResponse(const net::FtpCtrlResponse& response,
- int* port) {
+bool ExtractPortFromEPSVResponse(const FtpCtrlResponse& response, int* port) {
if (response.lines.size() != 1)
return false;
const char* ptr = response.lines[0].c_str();
@@ -146,8 +147,7 @@
// 127,0,0,1,23,21 IP address and port without ().
//
// See RFC 959, Section 4.1.2
-bool ExtractPortFromPASVResponse(const net::FtpCtrlResponse& response,
- int* port) {
+bool ExtractPortFromPASVResponse(const FtpCtrlResponse& response, int* port) {
if (response.lines.size() != 1)
return false;
@@ -200,8 +200,6 @@
} // namespace
-namespace net {
-
FtpNetworkTransaction::FtpNetworkTransaction(
FtpNetworkSession* session,
ClientSocketFactory* socket_factory)
@@ -492,7 +490,7 @@
UnescapeRule::URL_SPECIAL_CHARS;
// This may unescape to non-ASCII characters, but we allow that. See the
// comment for IsValidFTPCommandString.
- path = net::UnescapeURLComponent(path, unescape_rules);
+ path = UnescapeURLComponent(path, unescape_rules);
if (system_type_ == SYSTEM_TYPE_VMS) {
if (is_directory)
diff --git a/net/ftp/ftp_util_unittest.cc b/net/ftp/ftp_util_unittest.cc
index a2b2849..121780bb 100644
--- a/net/ftp/ftp_util_unittest.cc
+++ b/net/ftp/ftp_util_unittest.cc
@@ -15,6 +15,8 @@
using base::ASCIIToUTF16;
using base::UTF8ToUTF16;
+namespace net {
+
namespace {
TEST(FtpUtilTest, UnixFilePathToVMS) {
@@ -36,7 +38,7 @@
};
for (size_t i = 0; i < arraysize(kTestCases); i++) {
EXPECT_EQ(kTestCases[i].expected_output,
- net::FtpUtil::UnixFilePathToVMS(kTestCases[i].input))
+ FtpUtil::UnixFilePathToVMS(kTestCases[i].input))
<< kTestCases[i].input;
}
}
@@ -69,7 +71,7 @@
};
for (size_t i = 0; i < arraysize(kTestCases); i++) {
EXPECT_EQ(kTestCases[i].expected_output,
- net::FtpUtil::UnixDirectoryPathToVMS(kTestCases[i].input))
+ FtpUtil::UnixDirectoryPathToVMS(kTestCases[i].input))
<< kTestCases[i].input;
}
}
@@ -109,7 +111,7 @@
};
for (size_t i = 0; i < arraysize(kTestCases); i++) {
EXPECT_EQ(kTestCases[i].expected_output,
- net::FtpUtil::VMSPathToUnix(kTestCases[i].input))
+ FtpUtil::VMSPathToUnix(kTestCases[i].input))
<< kTestCases[i].input;
}
}
@@ -169,7 +171,7 @@
kTestCases[i].rest));
base::Time time;
- ASSERT_TRUE(net::FtpUtil::LsDateListingToTime(
+ ASSERT_TRUE(FtpUtil::LsDateListingToTime(
UTF8ToUTF16(kTestCases[i].month), UTF8ToUTF16(kTestCases[i].day),
UTF8ToUTF16(kTestCases[i].rest), mock_current_time, &time));
@@ -209,10 +211,9 @@
kTestCases[i].date, kTestCases[i].time));
base::Time time;
- ASSERT_TRUE(net::FtpUtil::WindowsDateListingToTime(
- UTF8ToUTF16(kTestCases[i].date),
- UTF8ToUTF16(kTestCases[i].time),
- &time));
+ ASSERT_TRUE(FtpUtil::WindowsDateListingToTime(
+ UTF8ToUTF16(kTestCases[i].date), UTF8ToUTF16(kTestCases[i].time),
+ &time));
base::Time::Exploded time_exploded;
time.LocalExplode(&time_exploded);
@@ -248,9 +249,11 @@
kTestCases[i].text, kTestCases[i].column));
EXPECT_EQ(ASCIIToUTF16(kTestCases[i].expected_result),
- net::FtpUtil::GetStringPartAfterColumns(
+ FtpUtil::GetStringPartAfterColumns(
ASCIIToUTF16(kTestCases[i].text), kTestCases[i].column));
}
}
} // namespace
+
+} // namespace net
diff --git a/net/http/disk_cache_based_quic_server_info.cc b/net/http/disk_cache_based_quic_server_info.cc
index 6ac0bcd..19d88a9 100644
--- a/net/http/disk_cache_based_quic_server_info.cc
+++ b/net/http/disk_cache_based_quic_server_info.cc
@@ -400,7 +400,7 @@
if (!backend_) {
UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.APICall.NoBackend", call,
QUIC_SERVER_INFO_NUM_OF_API_CALLS);
- } else if (backend_->GetCacheType() == net::MEMORY_CACHE) {
+ } else if (backend_->GetCacheType() == MEMORY_CACHE) {
UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.APICall.MemoryCache", call,
QUIC_SERVER_INFO_NUM_OF_API_CALLS);
} else {
@@ -425,7 +425,7 @@
if (!backend_) {
UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.NoBackend",
failure, NUM_OF_FAILURES);
- } else if (backend_->GetCacheType() == net::MEMORY_CACHE) {
+ } else if (backend_->GetCacheType() == MEMORY_CACHE) {
UMA_HISTOGRAM_ENUMERATION("Net.QuicDiskCache.FailureReason.MemoryCache",
failure, NUM_OF_FAILURES);
} else {
diff --git a/net/http/disk_cache_based_quic_server_info_unittest.cc b/net/http/disk_cache_based_quic_server_info_unittest.cc
index 991881a7..d4ddfc25 100644
--- a/net/http/disk_cache_based_quic_server_info_unittest.cc
+++ b/net/http/disk_cache_based_quic_server_info_unittest.cc
@@ -50,14 +50,14 @@
0
};
-class DeleteCacheCompletionCallback : public net::TestCompletionCallbackBase {
+class DeleteCacheCompletionCallback : public TestCompletionCallbackBase {
public:
explicit DeleteCacheCompletionCallback(QuicServerInfo* server_info)
: server_info_(server_info),
callback_(base::Bind(&DeleteCacheCompletionCallback::OnComplete,
base::Unretained(this))) {}
- const net::CompletionCallback& callback() const { return callback_; }
+ const CompletionCallback& callback() const { return callback_; }
private:
void OnComplete(int result) {
@@ -66,7 +66,7 @@
}
QuicServerInfo* server_info_;
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
DISALLOW_COPY_AND_ASSIGN(DeleteCacheCompletionCallback);
};
diff --git a/net/http/failing_http_transaction_factory.cc b/net/http/failing_http_transaction_factory.cc
index dfe78f24..a190597 100644
--- a/net/http/failing_http_transaction_factory.cc
+++ b/net/http/failing_http_transaction_factory.cc
@@ -51,7 +51,7 @@
const HttpResponseInfo* GetResponseInfo() const override;
LoadState GetLoadState() const override;
UploadProgress GetUploadProgress() const override;
- void SetQuicServerInfo(net::QuicServerInfo* quic_server_info) override;
+ void SetQuicServerInfo(QuicServerInfo* quic_server_info) override;
bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
void SetPriority(RequestPriority priority) override;
void SetWebSocketHandshakeStreamCreateHelper(
@@ -135,7 +135,8 @@
}
void FailingHttpTransaction::SetQuicServerInfo(
- net::QuicServerInfo* quic_server_info) {}
+ QuicServerInfo* quic_server_info) {
+}
bool FailingHttpTransaction::GetLoadTimingInfo(
LoadTimingInfo* load_timing_info) const {
diff --git a/net/http/http_auth_handler_basic.cc b/net/http/http_auth_handler_basic.cc
index 4837138..b1624b8 100644
--- a/net/http/http_auth_handler_basic.cc
+++ b/net/http/http_auth_handler_basic.cc
@@ -43,8 +43,7 @@
if (!LowerCaseEqualsASCII(parameters.name(), "realm"))
continue;
- if (!net::ConvertToUtf8AndNormalize(parameters.value(), kCharsetLatin1,
- realm)) {
+ if (!ConvertToUtf8AndNormalize(parameters.value(), kCharsetLatin1, realm)) {
return false;
}
}
diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc
index 7dee081..5c2e417 100644
--- a/net/http/http_auth_handler_digest.cc
+++ b/net/http/http_auth_handler_digest.cc
@@ -227,7 +227,7 @@
const std::string& value) {
if (LowerCaseEqualsASCII(name, "realm")) {
std::string realm;
- if (!net::ConvertToUtf8AndNormalize(value, kCharsetLatin1, &realm))
+ if (!ConvertToUtf8AndNormalize(value, kCharsetLatin1, &realm))
return false;
realm_ = realm;
original_realm_ = value;
diff --git a/net/http/http_auth_handler_negotiate_unittest.cc b/net/http/http_auth_handler_negotiate_unittest.cc
index 233597d..eaee8e5 100644
--- a/net/http/http_auth_handler_negotiate_unittest.cc
+++ b/net/http/http_auth_handler_negotiate_unittest.cc
@@ -19,14 +19,14 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-#if defined(OS_WIN)
-typedef net::MockSSPILibrary MockAuthLibrary;
-#elif defined(OS_POSIX)
-typedef net::test::MockGSSAPILibrary MockAuthLibrary;
-#endif
-
namespace net {
+#if defined(OS_WIN)
+typedef MockSSPILibrary MockAuthLibrary;
+#elif defined(OS_POSIX)
+typedef test::MockGSSAPILibrary MockAuthLibrary;
+#endif
+
class HttpAuthHandlerNegotiateTest : public PlatformTest {
public:
void SetUp() override {
diff --git a/net/http/http_auth_handler_unittest.cc b/net/http/http_auth_handler_unittest.cc
index 335bec3a..a057d86 100644
--- a/net/http/http_auth_handler_unittest.cc
+++ b/net/http/http_auth_handler_unittest.cc
@@ -39,8 +39,8 @@
challenge.begin(), challenge.end());
HttpAuthHandlerMock mock_handler;
TestNetLog capturing_net_log;
- BoundNetLog bound_net_log(BoundNetLog::Make(&capturing_net_log,
- net::NetLog::SOURCE_NONE));
+ BoundNetLog bound_net_log(
+ BoundNetLog::Make(&capturing_net_log, NetLog::SOURCE_NONE));
mock_handler.InitFromChallenge(&tokenizer, target,
origin, bound_net_log);
diff --git a/net/http/http_byte_range_unittest.cc b/net/http/http_byte_range_unittest.cc
index d075294..0a77da3e 100644
--- a/net/http/http_byte_range_unittest.cc
+++ b/net/http/http_byte_range_unittest.cc
@@ -5,6 +5,10 @@
#include "net/http/http_byte_range.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
+namespace {
+
TEST(HttpByteRangeTest, ValidRanges) {
const struct {
int64 first_byte_position;
@@ -24,7 +28,7 @@
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- net::HttpByteRange range;
+ HttpByteRange range;
range.set_first_byte_position(tests[i].first_byte_position);
range.set_last_byte_position(tests[i].last_byte_position);
range.set_suffix_length(tests[i].suffix_length);
@@ -56,7 +60,7 @@
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- net::HttpByteRange range;
+ HttpByteRange range;
range.set_first_byte_position(tests[i].first_byte_position);
range.set_last_byte_position(tests[i].last_byte_position);
range.set_suffix_length(tests[i].suffix_length);
@@ -79,14 +83,20 @@
TEST(HttpByteRangeTest, GetHeaderValue) {
static const struct {
- net::HttpByteRange range;
+ HttpByteRange range;
const char* expected;
- } tests[] = {{net::HttpByteRange::Bounded(0, 0), "bytes=0-0"},
- {net::HttpByteRange::Bounded(0, 100), "bytes=0-100"},
- {net::HttpByteRange::Bounded(0, -1), "bytes=0-"},
- {net::HttpByteRange::RightUnbounded(100), "bytes=100-"},
- {net::HttpByteRange::Suffix(100), "bytes=-100"}, };
+ } tests[] = {
+ {HttpByteRange::Bounded(0, 0), "bytes=0-0"},
+ {HttpByteRange::Bounded(0, 100), "bytes=0-100"},
+ {HttpByteRange::Bounded(0, -1), "bytes=0-"},
+ {HttpByteRange::RightUnbounded(100), "bytes=100-"},
+ {HttpByteRange::Suffix(100), "bytes=-100"},
+ };
for (size_t i = 0; i < arraysize(tests); ++i) {
EXPECT_EQ(tests[i].expected, tests[i].range.GetHeaderValue());
}
}
+
+} // namespace
+
+} // namespace net
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 51929ff..b5a79a3 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -76,7 +76,7 @@
// static
HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) {
- return new DefaultBackend(MEMORY_CACHE, net::CACHE_BACKEND_DEFAULT,
+ return new DefaultBackend(MEMORY_CACHE, CACHE_BACKEND_DEFAULT,
base::FilePath(), max_bytes, NULL);
}
@@ -145,8 +145,10 @@
trans_(trans),
entry_(entry),
backend_(NULL) {}
- WorkItem(WorkItemOperation operation, Transaction* trans,
- const net::CompletionCallback& cb, disk_cache::Backend** backend)
+ WorkItem(WorkItemOperation operation,
+ Transaction* trans,
+ const CompletionCallback& cb,
+ disk_cache::Backend** backend)
: operation_(operation),
trans_(trans),
entry_(NULL),
@@ -186,7 +188,7 @@
WorkItemOperation operation_;
Transaction* trans_;
ActiveEntry** entry_;
- net::CompletionCallback callback_; // User callback.
+ CompletionCallback callback_; // User callback.
disk_cache::Backend** backend_;
};
@@ -446,7 +448,7 @@
}
//-----------------------------------------------------------------------------
-HttpCache::HttpCache(const net::HttpNetworkSession::Params& params,
+HttpCache::HttpCache(const HttpNetworkSession::Params& params,
BackendFactory* backend_factory)
: net_log_(params.net_log),
backend_factory_(backend_factory),
@@ -582,7 +584,7 @@
// Do lazy initialization of disk cache if needed.
if (!disk_cache_.get()) {
// We don't care about the result.
- CreateBackend(NULL, net::CompletionCallback());
+ CreateBackend(NULL, CompletionCallback());
}
HttpCache::Transaction* trans =
@@ -622,7 +624,7 @@
// Do lazy initialization of disk cache if needed.
if (!disk_cache_.get()) {
// We don't care about the result.
- CreateBackend(NULL, net::CompletionCallback());
+ CreateBackend(NULL, CompletionCallback());
}
HttpCache::Transaction* transaction =
@@ -655,7 +657,7 @@
//-----------------------------------------------------------------------------
int HttpCache::CreateBackend(disk_cache::Backend** backend,
- const net::CompletionCallback& callback) {
+ const CompletionCallback& callback) {
if (!backend_factory_.get())
return ERR_FAILED;
@@ -696,8 +698,8 @@
if (!building_backend_)
return ERR_FAILED;
- WorkItem* item = new WorkItem(
- WI_CREATE_BACKEND, trans, net::CompletionCallback(), NULL);
+ WorkItem* item =
+ new WorkItem(WI_CREATE_BACKEND, trans, CompletionCallback(), NULL);
PendingOp* pending_op = GetPendingOp(std::string());
DCHECK(pending_op->writer);
pending_op->pending_queue.push_back(item);
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index 8f48c2a..8e99a98 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -128,7 +128,7 @@
// The disk cache is initialized lazily (by CreateTransaction) in this case.
// The HttpCache takes ownership of the |backend_factory|.
- HttpCache(const net::HttpNetworkSession::Params& params,
+ HttpCache(const HttpNetworkSession::Params& params,
BackendFactory* backend_factory);
// The disk cache is initialized lazily (by CreateTransaction) in this case.
@@ -157,7 +157,7 @@
// |callback| will be notified when the operation completes. The pointer that
// receives the |backend| must remain valid until the operation completes.
int GetBackend(disk_cache::Backend** backend,
- const net::CompletionCallback& callback);
+ const CompletionCallback& callback);
// Returns the current backend (can be NULL).
disk_cache::Backend* GetCurrentBackend() const;
@@ -285,7 +285,7 @@
// Creates the |backend| object and notifies the |callback| when the operation
// completes. Returns an error code.
int CreateBackend(disk_cache::Backend** backend,
- const net::CompletionCallback& callback);
+ const CompletionCallback& callback);
// Makes sure that the backend creation is complete before allowing the
// provided transaction to use the object. Returns an error code. |trans|
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index cebecda..24de37ab 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -53,6 +53,8 @@
using base::TimeDelta;
using base::TimeTicks;
+namespace net {
+
namespace {
// TODO(ricea): Move this to HttpResponseHeaders once it is standardised.
@@ -83,9 +85,9 @@
// TODO(brandonsalmon): Remove this when cache keys are stored
// and no longer have to be recomputed to retrieve the OSCertHandle
// from the disk.
-std::string GetCacheKeyForCert(net::X509Certificate::OSCertHandle cert_handle) {
- net::SHA1HashValue fingerprint =
- net::X509Certificate::CalculateFingerprint(cert_handle);
+std::string GetCacheKeyForCert(X509Certificate::OSCertHandle cert_handle) {
+ SHA1HashValue fingerprint =
+ X509Certificate::CalculateFingerprint(cert_handle);
return "cert:" +
base::HexEncode(fingerprint.data, arraysize(fingerprint.data));
@@ -100,7 +102,7 @@
int dist_from_root,
bool is_leaf,
const scoped_refptr<SharedChainData>& shared_chain_data,
- net::X509Certificate::OSCertHandle cert_handle) {
+ X509Certificate::OSCertHandle cert_handle) {
// If |num_pending_ops| is one, this was the last pending read operation
// for this chain of certificates. The total time used to read the chain
// can be calculated by subtracting the starting time from Now().
@@ -174,10 +176,9 @@
// Error codes that will be considered indicative of a page being offline/
// unreachable for LOAD_FROM_CACHE_IF_OFFLINE.
bool IsOfflineError(int error) {
- return (error == net::ERR_NAME_NOT_RESOLVED ||
- error == net::ERR_INTERNET_DISCONNECTED ||
- error == net::ERR_ADDRESS_UNREACHABLE ||
- error == net::ERR_CONNECTION_TIMED_OUT);
+ return (
+ error == ERR_NAME_NOT_RESOLVED || error == ERR_INTERNET_DISCONNECTED ||
+ error == ERR_ADDRESS_UNREACHABLE || error == ERR_CONNECTION_TIMED_OUT);
}
// Enum for UMA, indicating the status (with regard to offline mode) of
@@ -210,15 +211,15 @@
void RecordOfflineStatus(int load_flags, RequestOfflineStatus status) {
// Restrict to main frame to keep statistics close to
// "would have shown them something useful if offline mode was enabled".
- if (load_flags & net::LOAD_MAIN_FRAME) {
+ if (load_flags & LOAD_MAIN_FRAME) {
UMA_HISTOGRAM_ENUMERATION("HttpCache.OfflineStatus", status,
OFFLINE_STATUS_MAX_ENTRIES);
}
}
void RecordNoStoreHeaderHistogram(int load_flags,
- const net::HttpResponseInfo* response) {
- if (load_flags & net::LOAD_MAIN_FRAME) {
+ const HttpResponseInfo* response) {
+ if (load_flags & LOAD_MAIN_FRAME) {
UMA_HISTOGRAM_BOOLEAN(
"Net.MainFrameNoStore",
response->headers->HasHeaderValue("cache-control", "no-store"));
@@ -226,9 +227,9 @@
}
base::Value* NetLogAsyncRevalidationInfoCallback(
- const net::NetLog::Source& source,
- const net::HttpRequestInfo* request,
- net::NetLogCaptureMode capture_mode) {
+ const NetLog::Source& source,
+ const HttpRequestInfo* request,
+ NetLogCaptureMode capture_mode) {
base::DictionaryValue* dict = new base::DictionaryValue();
source.AddToEventParameters(dict);
@@ -246,8 +247,6 @@
} // namespace
-namespace net {
-
struct HeaderNameAndValue {
const char* name;
const char* value;
@@ -2756,7 +2755,7 @@
// blocking page is shown. An alternative would be to reverse-map the cert
// status to a net error and replay the net error.
if ((response_.headers->HasHeaderValue("cache-control", "no-store")) ||
- net::IsCertStatusError(response_.ssl_info.cert_status)) {
+ IsCertStatusError(response_.ssl_info.cert_status)) {
DoneWritingToEntry(false);
if (net_log_.GetCaptureMode().enabled())
net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO);
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h
index d8642c8..d9d99e3 100644
--- a/net/http/http_cache_transaction.h
+++ b/net/http/http_cache_transaction.h
@@ -138,7 +138,7 @@
bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
void SetPriority(RequestPriority priority) override;
void SetWebSocketHandshakeStreamCreateHelper(
- net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override;
+ WebSocketHandshakeStreamBase::CreateHelper* create_helper) override;
void SetBeforeNetworkStartCallback(
const BeforeNetworkStartCallback& callback) override;
void SetBeforeProxyHeadersSentCallback(
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index b64ebbf..d318e91 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -42,19 +42,21 @@
using base::Time;
+namespace net {
+
namespace {
// Tests the load timing values of a request that goes through a
// MockNetworkTransaction.
-void TestLoadTimingNetworkRequest(const net::LoadTimingInfo& load_timing_info) {
+void TestLoadTimingNetworkRequest(const LoadTimingInfo& load_timing_info) {
EXPECT_FALSE(load_timing_info.socket_reused);
- EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
+ EXPECT_NE(NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
- net::ExpectConnectTimingHasTimes(load_timing_info.connect_timing,
- net::CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY);
+ ExpectConnectTimingHasTimes(load_timing_info.connect_timing,
+ CONNECT_TIMING_HAS_CONNECT_TIMES_ONLY);
EXPECT_LE(load_timing_info.connect_timing.connect_end,
load_timing_info.send_start);
@@ -67,14 +69,14 @@
}
// Tests the load timing values of a request that receives a cached response.
-void TestLoadTimingCachedResponse(const net::LoadTimingInfo& load_timing_info) {
+void TestLoadTimingCachedResponse(const LoadTimingInfo& load_timing_info) {
EXPECT_FALSE(load_timing_info.socket_reused);
- EXPECT_EQ(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
+ EXPECT_EQ(NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
- net::ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
+ ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
// Only the send start / end times should be sent, and they should have the
// same value.
@@ -87,7 +89,7 @@
EXPECT_TRUE(load_timing_info.receive_headers_end.is_null());
}
-class DeleteCacheCompletionCallback : public net::TestCompletionCallbackBase {
+class DeleteCacheCompletionCallback : public TestCompletionCallbackBase {
public:
explicit DeleteCacheCompletionCallback(MockHttpCache* cache)
: cache_(cache),
@@ -95,7 +97,7 @@
base::Unretained(this))) {
}
- const net::CompletionCallback& callback() const { return callback_; }
+ const CompletionCallback& callback() const { return callback_; }
private:
void OnComplete(int result) {
@@ -104,7 +106,7 @@
}
MockHttpCache* cache_;
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
DISALLOW_COPY_AND_ASSIGN(DeleteCacheCompletionCallback);
};
@@ -112,41 +114,41 @@
//-----------------------------------------------------------------------------
// helpers
-void ReadAndVerifyTransaction(net::HttpTransaction* trans,
+void ReadAndVerifyTransaction(HttpTransaction* trans,
const MockTransaction& trans_info) {
std::string content;
int rv = ReadTransaction(trans, &content);
- EXPECT_EQ(net::OK, rv);
+ EXPECT_EQ(OK, rv);
std::string expected(trans_info.data);
EXPECT_EQ(expected, content);
}
-void RunTransactionTestBase(net::HttpCache* cache,
+void RunTransactionTestBase(HttpCache* cache,
const MockTransaction& trans_info,
const MockHttpRequest& request,
- net::HttpResponseInfo* response_info,
- const net::BoundNetLog& net_log,
- net::LoadTimingInfo* load_timing_info,
+ HttpResponseInfo* response_info,
+ const BoundNetLog& net_log,
+ LoadTimingInfo* load_timing_info,
int64* received_bytes) {
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
// write to the cache
- scoped_ptr<net::HttpTransaction> trans;
- int rv = cache->CreateTransaction(net::DEFAULT_PRIORITY, &trans);
- EXPECT_EQ(net::OK, rv);
+ scoped_ptr<HttpTransaction> trans;
+ int rv = cache->CreateTransaction(DEFAULT_PRIORITY, &trans);
+ EXPECT_EQ(OK, rv);
ASSERT_TRUE(trans.get());
rv = trans->Start(&request, callback.callback(), net_log);
- if (rv == net::ERR_IO_PENDING)
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(trans_info.return_code, rv);
- if (net::OK != rv)
+ if (OK != rv)
return;
- const net::HttpResponseInfo* response = trans->GetResponseInfo();
+ const HttpResponseInfo* response = trans->GetResponseInfo();
ASSERT_TRUE(response);
if (response_info)
@@ -156,7 +158,7 @@
// If a fake network connection is used, need a NetLog to get a fake socket
// ID.
EXPECT_TRUE(net_log.net_log());
- *load_timing_info = net::LoadTimingInfo();
+ *load_timing_info = LoadTimingInfo();
trans->GetLoadTimingInfo(load_timing_info);
}
@@ -166,65 +168,64 @@
*received_bytes = trans->GetTotalReceivedBytes();
}
-void RunTransactionTestWithRequest(net::HttpCache* cache,
+void RunTransactionTestWithRequest(HttpCache* cache,
const MockTransaction& trans_info,
const MockHttpRequest& request,
- net::HttpResponseInfo* response_info) {
+ HttpResponseInfo* response_info) {
RunTransactionTestBase(cache, trans_info, request, response_info,
- net::BoundNetLog(), NULL, NULL);
+ BoundNetLog(), NULL, NULL);
}
-void RunTransactionTestAndGetTiming(net::HttpCache* cache,
+void RunTransactionTestAndGetTiming(HttpCache* cache,
const MockTransaction& trans_info,
- const net::BoundNetLog& log,
- net::LoadTimingInfo* load_timing_info) {
+ const BoundNetLog& log,
+ LoadTimingInfo* load_timing_info) {
RunTransactionTestBase(cache, trans_info, MockHttpRequest(trans_info),
NULL, log, load_timing_info, NULL);
}
-void RunTransactionTest(net::HttpCache* cache,
- const MockTransaction& trans_info) {
- RunTransactionTestAndGetTiming(cache, trans_info, net::BoundNetLog(), NULL);
+void RunTransactionTest(HttpCache* cache, const MockTransaction& trans_info) {
+ RunTransactionTestAndGetTiming(cache, trans_info, BoundNetLog(), NULL);
}
-void RunTransactionTestWithLog(net::HttpCache* cache,
+void RunTransactionTestWithLog(HttpCache* cache,
const MockTransaction& trans_info,
- const net::BoundNetLog& log) {
+ const BoundNetLog& log) {
RunTransactionTestAndGetTiming(cache, trans_info, log, NULL);
}
-void RunTransactionTestWithResponseInfo(net::HttpCache* cache,
+void RunTransactionTestWithResponseInfo(HttpCache* cache,
const MockTransaction& trans_info,
- net::HttpResponseInfo* response) {
+ HttpResponseInfo* response) {
RunTransactionTestWithRequest(cache, trans_info, MockHttpRequest(trans_info),
response);
}
void RunTransactionTestWithResponseInfoAndGetTiming(
- net::HttpCache* cache,
+ HttpCache* cache,
const MockTransaction& trans_info,
- net::HttpResponseInfo* response,
- const net::BoundNetLog& log,
- net::LoadTimingInfo* load_timing_info) {
+ HttpResponseInfo* response,
+ const BoundNetLog& log,
+ LoadTimingInfo* load_timing_info) {
RunTransactionTestBase(cache, trans_info, MockHttpRequest(trans_info),
response, log, load_timing_info, NULL);
}
-void RunTransactionTestWithResponse(net::HttpCache* cache,
+void RunTransactionTestWithResponse(HttpCache* cache,
const MockTransaction& trans_info,
std::string* response_headers) {
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache, trans_info, &response);
response.headers->GetNormalizedHeaders(response_headers);
}
void RunTransactionTestWithResponseAndGetTiming(
- net::HttpCache* cache,
+ HttpCache* cache,
const MockTransaction& trans_info,
std::string* response_headers,
- const net::BoundNetLog& log,
- net::LoadTimingInfo* load_timing_info) {
- net::HttpResponseInfo response;
+ const BoundNetLog& log,
+ LoadTimingInfo* load_timing_info) {
+ HttpResponseInfo response;
RunTransactionTestBase(cache, trans_info, MockHttpRequest(trans_info),
&response, log, load_timing_info, NULL);
response.headers->GetNormalizedHeaders(response_headers);
@@ -241,7 +242,7 @@
void set_no_store(bool value) { no_store = value; }
- static void FastNoStoreHandler(const net::HttpRequestInfo* request,
+ static void FastNoStoreHandler(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
@@ -256,20 +257,19 @@
bool FastTransactionServer::no_store;
const MockTransaction kFastNoStoreGET_Transaction = {
- "http://www.google.com/nostore",
- "GET",
- base::Time(),
- "",
- net::LOAD_VALIDATE_CACHE,
- "HTTP/1.1 200 OK",
- "Cache-Control: max-age=10000\n",
- base::Time(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_SYNC_NET_START,
- &FastTransactionServer::FastNoStoreHandler,
- 0,
- net::OK
-};
+ "http://www.google.com/nostore",
+ "GET",
+ base::Time(),
+ "",
+ LOAD_VALIDATE_CACHE,
+ "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n",
+ base::Time(),
+ "<html><body>Google Blah Blah</body></html>",
+ TEST_MODE_SYNC_NET_START,
+ &FastTransactionServer::FastNoStoreHandler,
+ 0,
+ OK};
// This class provides a handler for kRangeGET_TransactionOK so that the range
// request can be served on demand.
@@ -299,7 +299,7 @@
// the server reacts to requests headers like so:
// X-Require-Mock-Auth -> return 401.
// X-Return-Default-Range -> assume 40-49 was requested.
- static void RangeHandler(const net::HttpRequestInfo* request,
+ static void RangeHandler(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data);
@@ -327,7 +327,7 @@
static const char kExtraHeaderKey[] = "Extra";
// Static.
-void RangeTransactionServer::RangeHandler(const net::HttpRequestInfo* request,
+void RangeTransactionServer::RangeHandler(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
@@ -353,11 +353,11 @@
return;
}
- std::vector<net::HttpByteRange> ranges;
+ std::vector<HttpByteRange> ranges;
std::string range_header;
- if (!request->extra_headers.GetHeader(
- net::HttpRequestHeaders::kRange, &range_header) ||
- !net::HttpUtil::ParseRangeHeader(range_header, &ranges) || bad_200_ ||
+ if (!request->extra_headers.GetHeader(HttpRequestHeaders::kRange,
+ &range_header) ||
+ !HttpUtil::ParseRangeHeader(range_header, &ranges) || bad_200_ ||
ranges.size() != 1) {
// This is not a byte range request. We return 200.
response_status->assign("HTTP/1.1 200 OK");
@@ -367,7 +367,7 @@
}
// We can handle this range request.
- net::HttpByteRange byte_range = ranges[0];
+ HttpByteRange byte_range = ranges[0];
if (request->extra_headers.HasHeader("X-Return-Default-Range")) {
byte_range.set_first_byte_position(40);
@@ -419,24 +419,22 @@
}
const MockTransaction kRangeGET_TransactionOK = {
- "http://www.google.com/range",
- "GET",
- base::Time(),
- "Range: bytes = 40-49\r\n"
- EXTRA_HEADER,
- net::LOAD_NORMAL,
- "HTTP/1.1 206 Partial Content",
- "Last-Modified: Sat, 18 Apr 2007 01:10:43 GMT\n"
- "ETag: \"foo\"\n"
- "Accept-Ranges: bytes\n"
- "Content-Length: 10\n",
- base::Time(),
- "rg: 40-49 ",
- TEST_MODE_NORMAL,
- &RangeTransactionServer::RangeHandler,
- 0,
- net::OK
-};
+ "http://www.google.com/range",
+ "GET",
+ base::Time(),
+ "Range: bytes = 40-49\r\n" EXTRA_HEADER,
+ LOAD_NORMAL,
+ "HTTP/1.1 206 Partial Content",
+ "Last-Modified: Sat, 18 Apr 2007 01:10:43 GMT\n"
+ "ETag: \"foo\"\n"
+ "Accept-Ranges: bytes\n"
+ "Content-Length: 10\n",
+ base::Time(),
+ "rg: 40-49 ",
+ TEST_MODE_NORMAL,
+ &RangeTransactionServer::RangeHandler,
+ 0,
+ OK};
const char kFullRangeData[] =
"rg: 00-09 rg: 10-19 rg: 20-29 rg: 30-39 "
@@ -445,10 +443,10 @@
// Verifies the response headers (|response|) match a partial content
// response for the range starting at |start| and ending at |end|.
void Verify206Response(std::string response, int start, int end) {
- std::string raw_headers(net::HttpUtil::AssembleRawHeaders(response.data(),
- response.size()));
- scoped_refptr<net::HttpResponseHeaders> headers(
- new net::HttpResponseHeaders(raw_headers));
+ std::string raw_headers(
+ HttpUtil::AssembleRawHeaders(response.data(), response.size()));
+ scoped_refptr<HttpResponseHeaders> headers(
+ new HttpResponseHeaders(raw_headers));
ASSERT_EQ(206, headers->response_code());
@@ -470,20 +468,20 @@
ASSERT_TRUE(cache->CreateBackendEntry(kRangeGET_TransactionOK.url, &entry,
NULL));
- raw_headers = net::HttpUtil::AssembleRawHeaders(raw_headers.data(),
- raw_headers.size());
+ raw_headers =
+ HttpUtil::AssembleRawHeaders(raw_headers.data(), raw_headers.size());
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
response.response_time = base::Time::Now();
response.request_time = base::Time::Now();
- response.headers = new net::HttpResponseHeaders(raw_headers);
+ response.headers = new HttpResponseHeaders(raw_headers);
// Set the last argument for this to be an incomplete request.
EXPECT_TRUE(MockHttpCache::WriteResponseInfo(entry, &response, true, true));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(100));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(100));
int len = static_cast<int>(base::strlcpy(buf->data(),
"rg: 00-09 rg: 10-19 ", 100));
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
int rv = entry->WriteData(1, 0, buf.get(), len, cb.callback(), true);
EXPECT_EQ(len, cb.GetResult(rv));
entry->Close();
@@ -508,24 +506,24 @@
};
struct Context {
- Context() : result(net::ERR_IO_PENDING) {}
+ Context() : result(ERR_IO_PENDING) {}
int result;
- net::TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
+ TestCompletionCallback callback;
+ scoped_ptr<HttpTransaction> trans;
};
class FakeWebSocketHandshakeStreamCreateHelper
- : public net::WebSocketHandshakeStreamBase::CreateHelper {
+ : public WebSocketHandshakeStreamBase::CreateHelper {
public:
~FakeWebSocketHandshakeStreamCreateHelper() override {}
- net::WebSocketHandshakeStreamBase* CreateBasicStream(
- scoped_ptr<net::ClientSocketHandle> connect,
+ WebSocketHandshakeStreamBase* CreateBasicStream(
+ scoped_ptr<ClientSocketHandle> connect,
bool using_proxy) override {
return NULL;
}
- net::WebSocketHandshakeStreamBase* CreateSpdyStream(
- const base::WeakPtr<net::SpdySession>& session,
+ WebSocketHandshakeStreamBase* CreateSpdyStream(
+ const base::WeakPtr<SpdySession>& session,
bool use_relative_url) override {
return NULL;
}
@@ -534,14 +532,14 @@
// Returns true if |entry| is not one of the log types paid attention to in this
// test. Note that TYPE_HTTP_CACHE_WRITE_INFO and TYPE_HTTP_CACHE_*_DATA are
// ignored.
-bool ShouldIgnoreLogEntry(const net::TestNetLog::CapturedEntry& entry) {
+bool ShouldIgnoreLogEntry(const TestNetLog::CapturedEntry& entry) {
switch (entry.type) {
- case net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND:
- case net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY:
- case net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY:
- case net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY:
- case net::NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY:
- case net::NetLog::TYPE_HTTP_CACHE_READ_INFO:
+ case NetLog::TYPE_HTTP_CACHE_GET_BACKEND:
+ case NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY:
+ case NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY:
+ case NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY:
+ case NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY:
+ case NetLog::TYPE_HTTP_CACHE_READ_INFO:
return false;
default:
return true;
@@ -550,15 +548,15 @@
// Modifies |entries| to only include log entries created by the cache layer and
// asserted on in these tests.
-void FilterLogEntries(net::TestNetLog::CapturedEntryList* entries) {
+void FilterLogEntries(TestNetLog::CapturedEntryList* entries) {
entries->erase(std::remove_if(entries->begin(), entries->end(),
&ShouldIgnoreLogEntry),
entries->end());
}
-bool LogContainsEventType(const net::BoundTestNetLog& log,
- net::NetLog::EventType expected) {
- net::TestNetLog::CapturedEntryList entries;
+bool LogContainsEventType(const BoundTestNetLog& log,
+ NetLog::EventType expected) {
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
for (size_t i = 0; i < entries.size(); i++) {
if (entries[i].type == expected)
@@ -576,25 +574,25 @@
TEST(HttpCache, CreateThenDestroy) {
MockHttpCache cache;
- scoped_ptr<net::HttpTransaction> trans;
- EXPECT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ EXPECT_EQ(OK, cache.CreateTransaction(&trans));
ASSERT_TRUE(trans.get());
}
TEST(HttpCache, GetBackend) {
- MockHttpCache cache(net::HttpCache::DefaultBackend::InMemory(0));
+ MockHttpCache cache(HttpCache::DefaultBackend::InMemory(0));
disk_cache::Backend* backend;
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
// This will lazily initialize the backend.
int rv = cache.http_cache()->GetBackend(&backend, cb.callback());
- EXPECT_EQ(net::OK, cb.GetResult(rv));
+ EXPECT_EQ(OK, cb.GetResult(rv));
}
TEST(HttpCache, SimpleGET) {
MockHttpCache cache;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
// Write to the cache.
RunTransactionTestAndGetTiming(cache.http_cache(), kSimpleGET_Transaction,
@@ -611,8 +609,8 @@
cache.disk_cache()->set_fail_requests();
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
// Read from the network, and don't use the cache.
RunTransactionTestAndGetTiming(cache.http_cache(), kSimpleGET_Transaction,
@@ -620,23 +618,23 @@
// Check that the NetLog was filled as expected.
// (We attempted to both Open and Create entries, but both failed).
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
FilterLogEntries(&entries);
EXPECT_EQ(6u, entries.size());
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 3, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 4, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 5, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 0, NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 1, NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 2, NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 3, NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 4, NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 5, NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -666,15 +664,15 @@
RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
MockHttpRequest request(kSimpleGET_Transaction);
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
const int kBufferSize = 10;
- scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kBufferSize));
- net::ReleaseBufferCompletionCallback cb(buffer.get());
+ scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize));
+ ReleaseBufferCompletionCallback cb(buffer.get());
- int rv = trans->Start(&request, cb.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, cb.GetResult(rv));
+ int rv = trans->Start(&request, cb.callback(), BoundNetLog());
+ EXPECT_EQ(OK, cb.GetResult(rv));
rv = trans->Read(buffer.get(), kBufferSize, cb.callback());
EXPECT_EQ(kBufferSize, cb.GetResult(rv));
@@ -709,10 +707,10 @@
scoped_ptr<Context> c(new Context());
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(ERR_IO_PENDING, rv);
rv = c->callback.WaitForResult();
// Start failing request now.
@@ -754,11 +752,11 @@
// Now fail to read from the cache.
scoped_ptr<Context> c(new Context());
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
MockHttpRequest request(kSimpleGET_Transaction);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, c->callback.GetResult(rv));
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, c->callback.GetResult(rv));
// Now verify that the entry was removed from the cache.
cache.disk_cache()->set_soft_failures(false);
@@ -777,41 +775,41 @@
TEST(HttpCache, SimpleGET_LoadOnlyFromCache_Hit) {
MockHttpCache cache;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
// Write to the cache.
RunTransactionTestAndGetTiming(cache.http_cache(), kSimpleGET_Transaction,
log.bound(), &load_timing_info);
// Check that the NetLog was filled as expected.
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
FilterLogEntries(&entries);
EXPECT_EQ(8u, entries.size());
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 3, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 4, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 5, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 6, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 7, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 0, NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 1, NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 2, NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 3, NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 4, NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 5, NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 6, NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 7, NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
TestLoadTimingNetworkRequest(load_timing_info);
// Force this transaction to read from the cache.
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
log.Clear();
@@ -823,22 +821,22 @@
FilterLogEntries(&entries);
EXPECT_EQ(8u, entries.size());
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 3, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 4, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 5, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 6, net::NetLog::TYPE_HTTP_CACHE_READ_INFO));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 7, net::NetLog::TYPE_HTTP_CACHE_READ_INFO));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 0, NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 1, NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 2, NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 3, NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 4, NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 5, NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 6, NetLog::TYPE_HTTP_CACHE_READ_INFO));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 7, NetLog::TYPE_HTTP_CACHE_READ_INFO));
EXPECT_EQ(1, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
@@ -851,18 +849,18 @@
// force this transaction to read from the cache
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
MockHttpRequest request(transaction);
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_CACHE_MISS, rv);
+ ASSERT_EQ(ERR_CACHE_MISS, rv);
trans.reset();
@@ -879,7 +877,7 @@
// force this transaction to read from the cache if valid
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_PREFERRING_CACHE;
+ transaction.load_flags |= LOAD_PREFERRING_CACHE;
RunTransactionTest(cache.http_cache(), transaction);
@@ -893,7 +891,7 @@
// force this transaction to read from the cache if valid
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_PREFERRING_CACHE;
+ transaction.load_flags |= LOAD_PREFERRING_CACHE;
RunTransactionTest(cache.http_cache(), transaction);
@@ -915,7 +913,7 @@
RunTransactionTest(cache.http_cache(), transaction);
// Read from the cache.
- transaction.load_flags |= net::LOAD_PREFERRING_CACHE;
+ transaction.load_flags |= LOAD_PREFERRING_CACHE;
RunTransactionTest(cache.http_cache(), transaction);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -938,10 +936,10 @@
// Attempt to read from the cache... this is a vary mismatch that must reach
// the network again.
- transaction.load_flags |= net::LOAD_PREFERRING_CACHE;
+ transaction.load_flags |= LOAD_PREFERRING_CACHE;
transaction.request_headers = "Foo: none\r\n";
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(),
&load_timing_info);
@@ -959,7 +957,7 @@
// Prime cache.
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_FROM_CACHE_IF_OFFLINE;
+ transaction.load_flags |= LOAD_FROM_CACHE_IF_OFFLINE;
transaction.response_headers = "Cache-Control: no-cache\n";
AddMockTransaction(&transaction);
@@ -972,7 +970,7 @@
// not the cache.
transaction.data = "Changed data.";
AddMockTransaction(&transaction);
- net::HttpResponseInfo response_info;
+ HttpResponseInfo response_info;
RunTransactionTestWithResponseInfo(cache.http_cache(), transaction,
&response_info);
@@ -990,7 +988,7 @@
// Prime cache.
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_FROM_CACHE_IF_OFFLINE;
+ transaction.load_flags |= LOAD_FROM_CACHE_IF_OFFLINE;
transaction.response_headers = "Cache-Control: no-cache\n";
AddMockTransaction(&transaction);
@@ -1001,17 +999,17 @@
// Network failure with offline error; should return cache entry above +
// flag signalling stale data.
- transaction.return_code = net::ERR_NAME_NOT_RESOLVED;
+ transaction.return_code = ERR_NAME_NOT_RESOLVED;
AddMockTransaction(&transaction);
MockHttpRequest request(transaction);
- net::TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, callback.GetResult(rv));
+ TestCompletionCallback callback;
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, callback.GetResult(rv));
- const net::HttpResponseInfo* response_info = trans->GetResponseInfo();
+ const HttpResponseInfo* response_info = trans->GetResponseInfo();
ASSERT_TRUE(response_info);
EXPECT_TRUE(response_info->server_data_unavailable);
EXPECT_TRUE(response_info->was_cached);
@@ -1029,7 +1027,7 @@
// Prime cache.
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_FROM_CACHE_IF_OFFLINE;
+ transaction.load_flags |= LOAD_FROM_CACHE_IF_OFFLINE;
transaction.response_headers = "Cache-Control: no-cache\n";
AddMockTransaction(&transaction);
@@ -1039,10 +1037,10 @@
RemoveMockTransaction(&transaction);
// Network failure with non-offline error; should fail with that error.
- transaction.return_code = net::ERR_PROXY_CONNECTION_FAILED;
+ transaction.return_code = ERR_PROXY_CONNECTION_FAILED;
AddMockTransaction(&transaction);
- net::HttpResponseInfo response_info2;
+ HttpResponseInfo response_info2;
RunTransactionTestWithResponseInfo(cache.http_cache(), transaction,
&response_info2);
@@ -1068,19 +1066,19 @@
RemoveMockTransaction(&transaction);
// Network failure with error; should fail but have was_cached set.
- transaction.return_code = net::ERR_FAILED;
+ transaction.return_code = ERR_FAILED;
AddMockTransaction(&transaction);
MockHttpRequest request(transaction);
- net::TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- int rv = cache.http_cache()->CreateTransaction(net::DEFAULT_PRIORITY, &trans);
- EXPECT_EQ(net::OK, rv);
+ TestCompletionCallback callback;
+ scoped_ptr<HttpTransaction> trans;
+ int rv = cache.http_cache()->CreateTransaction(DEFAULT_PRIORITY, &trans);
+ EXPECT_EQ(OK, rv);
ASSERT_TRUE(trans.get());
- rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::ERR_FAILED, callback.GetResult(rv));
+ rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(ERR_FAILED, callback.GetResult(rv));
- const net::HttpResponseInfo* response_info = trans->GetResponseInfo();
+ const HttpResponseInfo* response_info = trans->GetResponseInfo();
ASSERT_TRUE(response_info);
EXPECT_TRUE(response_info->was_cached);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
@@ -1093,7 +1091,7 @@
MockHttpCache cache;
// write to the cache
- net::HttpResponseInfo response_info;
+ HttpResponseInfo response_info;
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response_info);
@@ -1116,7 +1114,7 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Re-run transaction; make sure we don't mark the network as accessed.
- net::HttpResponseInfo response_info;
+ HttpResponseInfo response_info;
RunTransactionTestWithResponseInfo(cache.http_cache(), transaction,
&response_info);
@@ -1133,37 +1131,37 @@
// Force this transaction to write to the cache again.
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_BYPASS_CACHE;
+ transaction.load_flags |= LOAD_BYPASS_CACHE;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
// Write to the cache.
RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(),
&load_timing_info);
// Check that the NetLog was filled as expected.
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
FilterLogEntries(&entries);
EXPECT_EQ(8u, entries.size());
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 2, net::NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 3, net::NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 4, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 5, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 6, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
- EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 7, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 0, NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 1, NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 2, NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 3, NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 4, NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 5, NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(entries, 6, NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
+ EXPECT_TRUE(
+ LogContainsEndEvent(entries, 7, NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -1216,11 +1214,11 @@
// Force this transaction to validate the cache.
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags |= LOAD_VALIDATE_CACHE;
- net::HttpResponseInfo response_info;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ HttpResponseInfo response_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestWithResponseInfoAndGetTiming(
cache.http_cache(), transaction, &response_info, log.bound(),
&load_timing_info);
@@ -1252,11 +1250,10 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
}
-static void PreserveRequestHeaders_Handler(
- const net::HttpRequestInfo* request,
- std::string* response_status,
- std::string* response_headers,
- std::string* response_data) {
+static void PreserveRequestHeaders_Handler(const HttpRequestInfo* request,
+ std::string* response_status,
+ std::string* response_headers,
+ std::string* response_data) {
EXPECT_TRUE(request->extra_headers.HasHeader(kExtraHeaderKey));
}
@@ -1314,17 +1311,17 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
- EXPECT_EQ(net::LOAD_STATE_IDLE, c->trans->GetLoadState());
+ ASSERT_EQ(OK, c->result);
+ EXPECT_EQ(LOAD_STATE_IDLE, c->trans->GetLoadState());
- c->result = c->trans->Start(
- &request, c->callback.callback(), net::BoundNetLog());
+ c->result =
+ c->trans->Start(&request, c->callback.callback(), BoundNetLog());
}
// All requests are waiting for the active entry.
for (int i = 0; i < kNumTransactions; ++i) {
Context* c = context_list[i];
- EXPECT_EQ(net::LOAD_STATE_WAITING_FOR_CACHE, c->trans->GetLoadState());
+ EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, c->trans->GetLoadState());
}
// Allow all requests to move from the Create queue to the active entry.
@@ -1341,12 +1338,12 @@
// Read, i.e. idle.
for (int i = 0; i < kNumTransactions; ++i) {
Context* c = context_list[i];
- EXPECT_EQ(net::LOAD_STATE_IDLE, c->trans->GetLoadState());
+ EXPECT_EQ(LOAD_STATE_IDLE, c->trans->GetLoadState());
}
for (int i = 0; i < kNumTransactions; ++i) {
Context* c = context_list[i];
- if (c->result == net::ERR_IO_PENDING)
+ if (c->result == ERR_IO_PENDING)
c->result = c->callback.WaitForResult();
ReadAndVerifyTransaction(c->trans.get(), kSimpleGET_Transaction);
}
@@ -1372,7 +1369,7 @@
MockHttpRequest request(kSimpleGET_Transaction);
MockHttpRequest reader_request(kSimpleGET_Transaction);
- reader_request.load_flags = net::LOAD_ONLY_FROM_CACHE;
+ reader_request.load_flags = LOAD_ONLY_FROM_CACHE;
std::vector<Context*> context_list;
const int kNumTransactions = 5;
@@ -1382,14 +1379,14 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
MockHttpRequest* this_request = &request;
if (i == 1 || i == 2)
this_request = &reader_request;
- c->result = c->trans->Start(
- this_request, c->callback.callback(), net::BoundNetLog());
+ c->result =
+ c->trans->Start(this_request, c->callback.callback(), BoundNetLog());
}
// Allow all requests to move from the Create queue to the active entry.
@@ -1403,21 +1400,20 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
Context* c = context_list[0];
- ASSERT_EQ(net::ERR_IO_PENDING, c->result);
+ ASSERT_EQ(ERR_IO_PENDING, c->result);
c->result = c->callback.WaitForResult();
ReadAndVerifyTransaction(c->trans.get(), kSimpleGET_Transaction);
// Now we have 2 active readers and two queued transactions.
- EXPECT_EQ(net::LOAD_STATE_IDLE,
- context_list[2]->trans->GetLoadState());
- EXPECT_EQ(net::LOAD_STATE_WAITING_FOR_CACHE,
+ EXPECT_EQ(LOAD_STATE_IDLE, context_list[2]->trans->GetLoadState());
+ EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE,
context_list[3]->trans->GetLoadState());
c = context_list[1];
- ASSERT_EQ(net::ERR_IO_PENDING, c->result);
+ ASSERT_EQ(ERR_IO_PENDING, c->result);
c->result = c->callback.WaitForResult();
- if (c->result == net::OK)
+ if (c->result == OK)
ReadAndVerifyTransaction(c->trans.get(), kSimpleGET_Transaction);
// At this point we have one reader, two pending transactions and a task on
@@ -1430,9 +1426,9 @@
for (int i = 3; i < kNumTransactions; ++i) {
Context* c = context_list[i];
- if (c->result == net::ERR_IO_PENDING)
+ if (c->result == ERR_IO_PENDING)
c->result = c->callback.WaitForResult();
- if (c->result == net::OK)
+ if (c->result == OK)
ReadAndVerifyTransaction(c->trans.get(), kSimpleGET_Transaction);
}
@@ -1453,11 +1449,11 @@
// See http://code.google.com/p/chromium/issues/detail?id=25588
TEST(HttpCache, SimpleGET_DoomWithPending) {
// We need simultaneous doomed / not_doomed entries so let's use a real cache.
- MockHttpCache cache(net::HttpCache::DefaultBackend::InMemory(1024 * 1024));
+ MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024));
MockHttpRequest request(kSimpleGET_Transaction);
MockHttpRequest writer_request(kSimpleGET_Transaction);
- writer_request.load_flags = net::LOAD_BYPASS_CACHE;
+ writer_request.load_flags = LOAD_BYPASS_CACHE;
ScopedVector<Context> context_list;
const int kNumTransactions = 4;
@@ -1467,14 +1463,14 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
MockHttpRequest* this_request = &request;
if (i == 3)
this_request = &writer_request;
- c->result = c->trans->Start(
- this_request, c->callback.callback(), net::BoundNetLog());
+ c->result =
+ c->trans->Start(this_request, c->callback.callback(), BoundNetLog());
}
// The first request should be a writer at this point, and the two subsequent
@@ -1490,7 +1486,7 @@
if (i == 1)
continue;
Context* c = context_list[i];
- ASSERT_EQ(net::ERR_IO_PENDING, c->result);
+ ASSERT_EQ(ERR_IO_PENDING, c->result);
c->result = c->callback.WaitForResult();
ReadAndVerifyTransaction(c->trans.get(), kSimpleGET_Transaction);
}
@@ -1515,10 +1511,10 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
- c->result = c->trans->Start(
- &request, c->callback.callback(), net::BoundNetLog());
+ c->result =
+ c->trans->Start(&request, c->callback.callback(), BoundNetLog());
}
// Allow all requests to move from the Create queue to the active entry.
@@ -1536,7 +1532,7 @@
for (int i = 0; i < kNumTransactions; ++i) {
Context* c = context_list[i];
- if (c->result == net::ERR_IO_PENDING)
+ if (c->result == ERR_IO_PENDING)
c->result = c->callback.WaitForResult();
ReadAndVerifyTransaction(c->trans.get(), kFastNoStoreGET_Transaction);
delete c;
@@ -1562,10 +1558,10 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
- c->result = c->trans->Start(
- &request, c->callback.callback(), net::BoundNetLog());
+ c->result =
+ c->trans->Start(&request, c->callback.callback(), BoundNetLog());
}
// Allow all requests to move from the Create queue to the active entry.
@@ -1580,7 +1576,7 @@
for (int i = 0; i < kNumTransactions; ++i) {
Context* c = context_list[i];
- if (c->result == net::ERR_IO_PENDING)
+ if (c->result == ERR_IO_PENDING)
c->result = c->callback.WaitForResult();
// Destroy only the first transaction.
if (i == 0) {
@@ -1622,10 +1618,10 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
- c->result = c->trans->Start(
- &request, c->callback.callback(), net::BoundNetLog());
+ c->result =
+ c->trans->Start(&request, c->callback.callback(), BoundNetLog());
}
// The first request should be creating the disk cache entry and the others
@@ -1673,11 +1669,10 @@
Context* c = new Context();
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
- c->result = c->trans->Start(
- &request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::ERR_IO_PENDING, c->result);
+ c->result = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(ERR_IO_PENDING, c->result);
// Release the reference that the mock disk cache keeps for this entry, so
// that we test that the http cache handles the cancellation correctly.
@@ -1693,7 +1688,7 @@
MockHttpCache cache;
MockHttpRequest request(kSimpleGET_Transaction);
- request.load_flags = net::LOAD_BYPASS_CACHE;
+ request.load_flags = LOAD_BYPASS_CACHE;
std::vector<Context*> context_list;
const int kNumTransactions = 5;
@@ -1703,10 +1698,10 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
- c->result = c->trans->Start(
- &request, c->callback.callback(), net::BoundNetLog());
+ c->result =
+ c->trans->Start(&request, c->callback.callback(), BoundNetLog());
}
// The first request should be deleting the disk cache entry and the others
@@ -1742,14 +1737,12 @@
MockHttpRequest request(kSimpleGET_Transaction);
Context c1, c2;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&c1.trans));
- ASSERT_EQ(net::ERR_IO_PENDING,
- c1.trans->Start(&request, c1.callback.callback(),
- net::BoundNetLog()));
- ASSERT_EQ(net::OK, cache.CreateTransaction(&c2.trans));
- ASSERT_EQ(net::ERR_IO_PENDING,
- c2.trans->Start(&request, c2.callback.callback(),
- net::BoundNetLog()));
+ ASSERT_EQ(OK, cache.CreateTransaction(&c1.trans));
+ ASSERT_EQ(ERR_IO_PENDING,
+ c1.trans->Start(&request, c1.callback.callback(), BoundNetLog()));
+ ASSERT_EQ(OK, cache.CreateTransaction(&c2.trans));
+ ASSERT_EQ(ERR_IO_PENDING,
+ c2.trans->Start(&request, c2.callback.callback(), BoundNetLog()));
// The second request is queued after the first one.
@@ -1768,18 +1761,18 @@
RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
MockHttpRequest request(kSimpleGET_Transaction);
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
rv = trans->Read(buf.get(), 256, callback.callback());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ EXPECT_EQ(ERR_IO_PENDING, rv);
// Test that destroying the transaction while it is reading from the cache
// works properly.
@@ -1806,10 +1799,10 @@
Context* c = context_list[i];
c->result = cache->CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
- c->result = c->trans->Start(
- &request, c->callback.callback(), net::BoundNetLog());
+ c->result =
+ c->trans->Start(&request, c->callback.callback(), BoundNetLog());
}
// The first request should be creating the disk cache entry and the others
@@ -1845,15 +1838,15 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
}
context_list[0]->result = context_list[0]->trans->Start(
- &request0, context_list[0]->callback.callback(), net::BoundNetLog());
+ &request0, context_list[0]->callback.callback(), BoundNetLog());
context_list[1]->result = context_list[1]->trans->Start(
- &request1, context_list[1]->callback.callback(), net::BoundNetLog());
+ &request1, context_list[1]->callback.callback(), BoundNetLog());
context_list[2]->result = context_list[2]->trans->Start(
- &request2, context_list[2]->callback.callback(), net::BoundNetLog());
+ &request2, context_list[2]->callback.callback(), BoundNetLog());
// Just to make sure that everything is still pending.
base::MessageLoop::current()->RunUntilIdle();
@@ -1891,15 +1884,15 @@
Context* c = context_list[i];
c->result = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
}
context_list[0]->result = context_list[0]->trans->Start(
- &request0, context_list[0]->callback.callback(), net::BoundNetLog());
+ &request0, context_list[0]->callback.callback(), BoundNetLog());
context_list[1]->result = context_list[1]->trans->Start(
- &request1, context_list[1]->callback.callback(), net::BoundNetLog());
+ &request1, context_list[1]->callback.callback(), BoundNetLog());
context_list[2]->result = context_list[2]->trans->Start(
- &request2, context_list[2]->callback.callback(), net::BoundNetLog());
+ &request2, context_list[2]->callback.callback(), BoundNetLog());
// Just to make sure that everything is still pending.
base::MessageLoop::current()->RunUntilIdle();
@@ -1937,9 +1930,9 @@
scoped_ptr<Context> c(new Context());
c->result = cache->CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
- c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
+ c->trans->Start(&request, c->callback.callback(), BoundNetLog());
// Just to make sure that everything is still pending.
base::MessageLoop::current()->RunUntilIdle();
@@ -1949,14 +1942,14 @@
// We cannot call FinishCreation because the factory itself will go away with
// the cache, so grab the callback and attempt to use it.
- net::CompletionCallback callback = factory->callback();
+ CompletionCallback callback = factory->callback();
scoped_ptr<disk_cache::Backend>* backend = factory->backend();
cache.reset();
base::MessageLoop::current()->RunUntilIdle();
backend->reset();
- callback.Run(net::ERR_ABORTED);
+ callback.Run(ERR_ABORTED);
}
// Tests that we can delete the cache while creating the backend, from within
@@ -1968,21 +1961,21 @@
DeleteCacheCompletionCallback cb(cache);
disk_cache::Backend* backend;
int rv = cache->http_cache()->GetBackend(&backend, cb.callback());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ EXPECT_EQ(ERR_IO_PENDING, rv);
// Now let's queue a regular transaction
MockHttpRequest request(kSimpleGET_Transaction);
scoped_ptr<Context> c(new Context());
c->result = cache->CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, c->result);
+ ASSERT_EQ(OK, c->result);
- c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
+ c->trans->Start(&request, c->callback.callback(), BoundNetLog());
// And another direct backend request.
- net::TestCompletionCallback cb2;
+ TestCompletionCallback cb2;
rv = cache->http_cache()->GetBackend(&backend, cb2.callback());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ EXPECT_EQ(ERR_IO_PENDING, rv);
// Just to make sure that everything is still pending.
base::MessageLoop::current()->RunUntilIdle();
@@ -1996,7 +1989,7 @@
// The cache should be gone by now.
base::MessageLoop::current()->RunUntilIdle();
- EXPECT_EQ(net::OK, c->callback.GetResult(c->result));
+ EXPECT_EQ(OK, c->callback.GetResult(c->result));
EXPECT_FALSE(cb2.have_result());
}
@@ -2012,8 +2005,8 @@
// Get the same URL again, but this time we expect it to result
// in a conditional request.
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestAndGetTiming(cache.http_cache(), kTypicalGET_Transaction,
log.bound(), &load_timing_info);
@@ -2023,13 +2016,12 @@
TestLoadTimingNetworkRequest(load_timing_info);
}
-static void ETagGet_ConditionalRequest_Handler(
- const net::HttpRequestInfo* request,
- std::string* response_status,
- std::string* response_headers,
- std::string* response_data) {
+static void ETagGet_ConditionalRequest_Handler(const HttpRequestInfo* request,
+ std::string* response_status,
+ std::string* response_headers,
+ std::string* response_data) {
EXPECT_TRUE(
- request->extra_headers.HasHeader(net::HttpRequestHeaders::kIfNoneMatch));
+ request->extra_headers.HasHeader(HttpRequestHeaders::kIfNoneMatch));
response_status->assign("HTTP/1.1 304 Not Modified");
response_headers->assign(kETagGET_Transaction.response_headers);
response_data->clear();
@@ -2049,10 +2041,10 @@
// Get the same URL again, but this time we expect it to result
// in a conditional request.
- transaction.load_flags = net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags = LOAD_VALIDATE_CACHE;
transaction.handler = ETagGet_ConditionalRequest_Handler;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(),
&load_timing_info);
@@ -2072,7 +2064,7 @@
bool EtagUsed() { return s_etag_used_; }
bool LastModifiedUsed() { return s_last_modified_used_; }
- static void Handler(const net::HttpRequestInfo* request,
+ static void Handler(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data);
@@ -2084,15 +2076,14 @@
bool RevalidationServer::s_etag_used_ = false;
bool RevalidationServer::s_last_modified_used_ = false;
-void RevalidationServer::Handler(const net::HttpRequestInfo* request,
+void RevalidationServer::Handler(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
- if (request->extra_headers.HasHeader(net::HttpRequestHeaders::kIfNoneMatch))
+ if (request->extra_headers.HasHeader(HttpRequestHeaders::kIfNoneMatch))
s_etag_used_ = true;
- if (request->extra_headers.HasHeader(
- net::HttpRequestHeaders::kIfModifiedSince)) {
+ if (request->extra_headers.HasHeader(HttpRequestHeaders::kIfModifiedSince)) {
s_last_modified_used_ = true;
}
@@ -2126,8 +2117,8 @@
// Read from the cache.
RevalidationServer server;
transaction.handler = server.Handler;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(),
&load_timing_info);
@@ -2160,8 +2151,8 @@
RevalidationServer server;
transaction.handler = server.Handler;
transaction.request_headers = "Foo: none\r\n";
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(),
&load_timing_info);
@@ -2193,8 +2184,8 @@
RevalidationServer server;
transaction.handler = server.Handler;
transaction.request_headers = "Foo: none\r\n";
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestAndGetTiming(cache.http_cache(), transaction, log.bound(),
&load_timing_info);
@@ -2355,13 +2346,12 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
}
-static void ETagGet_UnconditionalRequest_Handler(
- const net::HttpRequestInfo* request,
- std::string* response_status,
- std::string* response_headers,
- std::string* response_data) {
+static void ETagGet_UnconditionalRequest_Handler(const HttpRequestInfo* request,
+ std::string* response_status,
+ std::string* response_headers,
+ std::string* response_data) {
EXPECT_FALSE(
- request->extra_headers.HasHeader(net::HttpRequestHeaders::kIfNoneMatch));
+ request->extra_headers.HasHeader(HttpRequestHeaders::kIfNoneMatch));
}
TEST(HttpCache, ETagGET_Http10) {
@@ -2378,7 +2368,7 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Get the same URL again, without generating a conditional request.
- transaction.load_flags = net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags = LOAD_VALIDATE_CACHE;
transaction.handler = ETagGet_UnconditionalRequest_Handler;
RunTransactionTest(cache.http_cache(), transaction);
@@ -2401,7 +2391,7 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Get the same URL again, but use a byte range request.
- transaction.load_flags = net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags = LOAD_VALIDATE_CACHE;
transaction.handler = ETagGet_UnconditionalRequest_Handler;
transaction.request_headers = "Range: bytes = 5-\r\n";
RunTransactionTest(cache.http_cache(), transaction);
@@ -2412,12 +2402,12 @@
}
static void ETagGet_ConditionalRequest_NoStore_Handler(
- const net::HttpRequestInfo* request,
+ const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
EXPECT_TRUE(
- request->extra_headers.HasHeader(net::HttpRequestHeaders::kIfNoneMatch));
+ request->extra_headers.HasHeader(HttpRequestHeaders::kIfNoneMatch));
response_status->assign("HTTP/1.1 304 Not Modified");
response_headers->assign("Cache-Control: no-store\n");
response_data->clear();
@@ -2437,7 +2427,7 @@
// Get the same URL again, but this time we expect it to result
// in a conditional request.
- transaction.load_flags = net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags = LOAD_VALIDATE_CACHE;
transaction.handler = ETagGet_ConditionalRequest_NoStore_Handler;
RunTransactionTest(cache.http_cache(), transaction);
@@ -2509,7 +2499,7 @@
// Request |kUrl| a second time. Now |kNetResponse1| it is in the HTTP
// cache, so we don't hit the network.
- request.load_flags = net::LOAD_ONLY_FROM_CACHE;
+ request.load_flags = LOAD_ONLY_FROM_CACHE;
kUnexpectedResponse.AssignTo(&mock_network_response); // Network mock.
net_response_1.AssignTo(&request); // Expected result.
@@ -2528,7 +2518,7 @@
// different -- this simulates a change made to the CSS file.
request.request_headers = extra_request_headers;
- request.load_flags = net::LOAD_NORMAL;
+ request.load_flags = LOAD_NORMAL;
net_response_2.AssignTo(&mock_network_response); // Network mock.
net_response_2.AssignTo(&request); // Expected result.
@@ -2547,7 +2537,7 @@
// value in the cache with the modified response.
request.request_headers = "";
- request.load_flags = net::LOAD_ONLY_FROM_CACHE;
+ request.load_flags = LOAD_ONLY_FROM_CACHE;
kUnexpectedResponse.AssignTo(&mock_network_response); // Network mock.
cached_response_2.AssignTo(&request); // Expected result.
@@ -2901,7 +2891,7 @@
// Since the cache key strips the hash sections, this should be a cache hit.
std::string url_with_hash = std::string(trans.url) + "#multiple#hashes";
trans.url = url_with_hash.c_str();
- trans.load_flags = net::LOAD_ONLY_FROM_CACHE;
+ trans.load_flags = LOAD_ONLY_FROM_CACHE;
RunTransactionTest(cache.http_cache(), trans);
@@ -2925,7 +2915,7 @@
// Tests POST handling with a disabled cache (no DCHECK).
TEST(HttpCache, SimplePOST_DisabledCache) {
MockHttpCache cache;
- cache.http_cache()->set_mode(net::HttpCache::Mode::DISABLE);
+ cache.http_cache()->set_mode(HttpCache::Mode::DISABLE);
RunTransactionTest(cache.http_cache(), kSimplePOST_Transaction);
@@ -2938,17 +2928,17 @@
MockHttpCache cache;
MockTransaction transaction(kSimplePOST_Transaction);
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
MockHttpRequest request(transaction);
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
ASSERT_TRUE(trans.get());
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- ASSERT_EQ(net::ERR_CACHE_MISS, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ ASSERT_EQ(ERR_CACHE_MISS, callback.GetResult(rv));
trans.reset();
@@ -2966,10 +2956,10 @@
const int64 kUploadId = 1; // Just a dummy value.
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(),
- kUploadId);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(),
+ kUploadId);
MockHttpRequest request(transaction);
request.upload_data_stream = &upload_data_stream;
@@ -2981,7 +2971,7 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Load from cache.
- request.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ request.load_flags |= LOAD_ONLY_FROM_CACHE;
RunTransactionTestWithRequest(cache.http_cache(), transaction, request, NULL);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -2998,10 +2988,10 @@
const int64 kUploadId = 1; // Just a dummy value.
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(),
- kUploadId);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(),
+ kUploadId);
MockHttpRequest request(transaction);
request.upload_data_stream = &upload_data_stream;
@@ -3018,9 +3008,9 @@
TEST(HttpCache, SimplePOST_SeparateCache) {
MockHttpCache cache;
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1);
MockTransaction transaction(kSimplePOST_Transaction);
MockHttpRequest req1(transaction);
@@ -3057,9 +3047,9 @@
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1);
transaction.method = "POST";
transaction.status = "HTTP/1.1 205 No Content";
@@ -3096,9 +3086,9 @@
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
transaction.method = "POST";
transaction.status = "HTTP/1.1 205 No Content";
@@ -3127,9 +3117,9 @@
factory->FinishCreation();
MockHttpCache cache(factory);
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
MockTransaction transaction(kSimplePOST_Transaction);
AddMockTransaction(&transaction);
@@ -3156,9 +3146,9 @@
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 1);
transaction.method = "POST";
transaction.status = "HTTP/1.1 100 Continue";
@@ -3184,18 +3174,18 @@
MockHttpCache cache;
MockTransaction transaction(kSimplePOST_Transaction);
AddMockTransaction(&transaction);
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
transaction.method = "HEAD";
MockHttpRequest request(transaction);
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
ASSERT_TRUE(trans.get());
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- ASSERT_EQ(net::ERR_CACHE_MISS, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ ASSERT_EQ(ERR_CACHE_MISS, callback.GetResult(rv));
trans.reset();
@@ -3220,7 +3210,7 @@
// Load from cache.
transaction.method = "HEAD";
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
transaction.data = "";
RunTransactionTest(cache.http_cache(), transaction);
@@ -3242,7 +3232,7 @@
// Load from cache.
transaction.method = "HEAD";
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
transaction.data = "";
std::string headers;
@@ -3287,8 +3277,8 @@
// Load from cache.
transaction.method = "HEAD";
transaction.request_headers = "Range: bytes = 0-4\r\n";
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
- transaction.return_code = net::ERR_CACHE_MISS;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
+ transaction.return_code = ERR_CACHE_MISS;
RunTransactionTest(cache.http_cache(), transaction);
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -3386,7 +3376,7 @@
base::MessageLoop::current()->RunUntilIdle();
// Load from the cache.
- transaction2.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction2.load_flags |= LOAD_ONLY_FROM_CACHE;
RunTransactionTestWithResponse(cache.http_cache(), transaction2, &headers);
EXPECT_NE(std::string::npos, headers.find("Foo: bar\n"));
@@ -3426,7 +3416,7 @@
base::MessageLoop::current()->RunUntilIdle();
// Load from the cache.
- transaction2.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction2.load_flags |= LOAD_ONLY_FROM_CACHE;
RunTransactionTestWithResponse(cache.http_cache(), transaction2, &headers);
EXPECT_NE(std::string::npos, headers.find("Foo: bar\n"));
@@ -3453,8 +3443,8 @@
// Load from the cache.
transaction.method = "GET";
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
- transaction.return_code = net::ERR_CACHE_MISS;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
+ transaction.return_code = ERR_CACHE_MISS;
RunTransactionTest(cache.http_cache(), transaction);
RemoveMockTransaction(&transaction);
@@ -3467,9 +3457,9 @@
MockTransaction transaction(kSimplePOST_Transaction);
transaction.method = "PUT";
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
MockHttpRequest request(transaction);
request.upload_data_stream = &upload_data_stream;
@@ -3496,9 +3486,9 @@
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
transaction.method = "PUT";
MockHttpRequest req2(transaction);
@@ -3532,9 +3522,9 @@
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
transaction.method = "PUT";
transaction.status = "HTTP/1.1 305 Use Proxy";
@@ -3570,9 +3560,9 @@
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
transaction.method = "PUT";
transaction.status = "HTTP/1.1 404 Not Found";
@@ -3600,9 +3590,9 @@
MockTransaction transaction(kSimplePOST_Transaction);
transaction.method = "DELETE";
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
MockHttpRequest request(transaction);
request.upload_data_stream = &upload_data_stream;
@@ -3629,9 +3619,9 @@
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
- ScopedVector<net::UploadElementReader> element_readers;
- element_readers.push_back(new net::UploadBytesElementReader("hello", 5));
- net::ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
+ ScopedVector<UploadElementReader> element_readers;
+ element_readers.push_back(new UploadBytesElementReader("hello", 5));
+ ElementsUploadDataStream upload_data_stream(element_readers.Pass(), 0);
transaction.method = "DELETE";
MockHttpRequest req2(transaction);
@@ -3725,16 +3715,16 @@
// Fail the network request.
MockTransaction transaction(kSimpleGET_Transaction);
- transaction.return_code = net::ERR_FAILED;
- transaction.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction.return_code = ERR_FAILED;
+ transaction.load_flags |= LOAD_VALIDATE_CACHE;
AddMockTransaction(&transaction);
RunTransactionTest(cache.http_cache(), transaction);
EXPECT_EQ(2, cache.network_layer()->transaction_count());
RemoveMockTransaction(&transaction);
- transaction.load_flags = net::LOAD_ONLY_FROM_CACHE;
- transaction.return_code = net::OK;
+ transaction.load_flags = LOAD_ONLY_FROM_CACHE;
+ transaction.return_code = OK;
AddMockTransaction(&transaction);
RunTransactionTest(cache.http_cache(), transaction);
@@ -3811,47 +3801,47 @@
TEST(HttpCache, SimpleGET_DoesntLogHeaders) {
MockHttpCache cache;
- net::BoundTestNetLog log;
+ BoundTestNetLog log;
RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction,
log.bound());
EXPECT_FALSE(LogContainsEventType(
- log, net::NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS));
+ log, NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS));
}
TEST(HttpCache, RangeGET_LogsHeaders) {
MockHttpCache cache;
- net::BoundTestNetLog log;
+ BoundTestNetLog log;
RunTransactionTestWithLog(cache.http_cache(), kRangeGET_Transaction,
log.bound());
EXPECT_TRUE(LogContainsEventType(
- log, net::NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS));
+ log, NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS));
}
TEST(HttpCache, ExternalValidation_LogsHeaders) {
MockHttpCache cache;
- net::BoundTestNetLog log;
+ BoundTestNetLog log;
MockTransaction transaction(kSimpleGET_Transaction);
transaction.request_headers = "If-None-Match: foo\r\n" EXTRA_HEADER;
RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound());
EXPECT_TRUE(LogContainsEventType(
- log, net::NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS));
+ log, NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS));
}
TEST(HttpCache, SpecialHeaders_LogsHeaders) {
MockHttpCache cache;
- net::BoundTestNetLog log;
+ BoundTestNetLog log;
MockTransaction transaction(kSimpleGET_Transaction);
transaction.request_headers = "cache-control: no-cache\r\n" EXTRA_HEADER;
RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound());
EXPECT_TRUE(LogContainsEventType(
- log, net::NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS));
+ log, NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS));
}
// Tests that receiving 206 for a regular request is handled correctly.
@@ -3962,12 +3952,12 @@
RunTransactionTest(cache.http_cache(), transaction);
// Now verify that the cached data is not used.
- net::BoundTestNetLog log;
+ BoundTestNetLog log;
RunTransactionTestWithLog(cache.http_cache(), kRangeGET_TransactionOK,
log.bound());
EXPECT_TRUE(LogContainsEventType(
- log, net::NetLog::TYPE_HTTP_CACHE_RESTART_PARTIAL_REQUEST));
+ log, NetLog::TYPE_HTTP_CACHE_RESTART_PARTIAL_REQUEST));
}
// Tests that a failure to conditionalize a regular request (no range) with a
@@ -4124,8 +4114,8 @@
// Write and read from the cache (20-59).
transaction.request_headers = "Range: bytes = 20-59\r\n" EXTRA_HEADER;
transaction.data = "rg: 20-29 rg: 30-39 rg: 40-49 rg: 50-59 ";
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestWithResponseAndGetTiming(
cache.http_cache(), transaction, &headers, log.bound(),
&load_timing_info);
@@ -4184,8 +4174,8 @@
// Write and read from the cache (20-59).
transaction.request_headers = "Range: bytes = 20-59\r\n" EXTRA_HEADER;
transaction.data = "rg: 20-29 rg: 30-39 rg: 40-49 rg: 50-59 ";
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestWithResponseAndGetTiming(
cache.http_cache(), transaction, &headers, log.bound(),
&load_timing_info);
@@ -4221,8 +4211,8 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Read from the cache (40-49).
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestWithResponseAndGetTiming(
cache.http_cache(), transaction, &headers, log.bound(),
&load_timing_info);
@@ -4234,7 +4224,7 @@
TestLoadTimingCachedResponse(load_timing_info);
// Read again forcing the revalidation.
- transaction.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags |= LOAD_VALIDATE_CACHE;
RunTransactionTestWithResponseAndGetTiming(
cache.http_cache(), transaction, &headers, log.bound(),
&load_timing_info);
@@ -4299,7 +4289,7 @@
RangeTransactionServer handler;
handler.set_not_modified(true);
MockTransaction transaction(kRangeGET_TransactionOK);
- transaction.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags |= LOAD_VALIDATE_CACHE;
RunTransactionTestWithResponse(cache.http_cache(), transaction, &headers);
Verify206Response(headers, 40, 49);
@@ -4329,7 +4319,7 @@
RangeTransactionServer handler;
handler.set_modified(true);
MockTransaction transaction(kRangeGET_TransactionOK);
- transaction.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags |= LOAD_VALIDATE_CACHE;
RunTransactionTestWithResponse(cache.http_cache(), transaction, &headers);
Verify206Response(headers, 40, 49);
@@ -4720,8 +4710,8 @@
MockHttpCache cache;
AddMockTransaction(&kRangeGET_TransactionOK);
std::string headers;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
// Write to the cache (40-49).
RunTransactionTestWithResponseAndGetTiming(
@@ -4759,8 +4749,8 @@
MockTransaction transaction(kRangeGET_TransactionOK);
AddMockTransaction(&transaction);
std::string headers;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
// Write to the cache (0-9).
transaction.request_headers = "Range: bytes = 0-9\r\n" EXTRA_HEADER;
@@ -4785,7 +4775,7 @@
TestLoadTimingNetworkRequest(load_timing_info);
// Read from the cache (0-9), write and read from cache (10 - 79).
- transaction.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags |= LOAD_VALIDATE_CACHE;
transaction.request_headers = "Foo: bar\r\n" EXTRA_HEADER;
transaction.data = kFullRangeData;
RunTransactionTestWithResponseAndGetTiming(
@@ -4825,12 +4815,12 @@
// real server will answer with 200.
MockTransaction transaction2(kRangeGET_TransactionOK);
transaction2.request_headers = EXTRA_HEADER;
- transaction2.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction2.load_flags |= LOAD_VALIDATE_CACHE;
transaction2.data = "Not a range";
RangeTransactionServer handler;
handler.set_modified(true);
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestWithResponseAndGetTiming(
cache.http_cache(), transaction2, &headers, log.bound(),
&load_timing_info);
@@ -4860,25 +4850,25 @@
std::string raw_headers(kRangeGET_TransactionOK.status);
raw_headers.append("\n");
raw_headers.append(kRangeGET_TransactionOK.response_headers);
- raw_headers = net::HttpUtil::AssembleRawHeaders(raw_headers.data(),
- raw_headers.size());
+ raw_headers =
+ HttpUtil::AssembleRawHeaders(raw_headers.data(), raw_headers.size());
- net::HttpResponseInfo response;
- response.headers = new net::HttpResponseHeaders(raw_headers);
+ HttpResponseInfo response;
+ response.headers = new HttpResponseHeaders(raw_headers);
EXPECT_TRUE(MockHttpCache::WriteResponseInfo(entry, &response, true, false));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(500));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(500));
int len = static_cast<int>(base::strlcpy(buf->data(),
kRangeGET_TransactionOK.data, 500));
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
int rv = entry->WriteData(1, 0, buf.get(), len, cb.callback(), true);
EXPECT_EQ(len, cb.GetResult(rv));
entry->Close();
// Now see that we don't use the stored entry.
std::string headers;
- net::BoundTestNetLog log;
- net::LoadTimingInfo load_timing_info;
+ BoundTestNetLog log;
+ LoadTimingInfo load_timing_info;
RunTransactionTestWithResponseAndGetTiming(
cache.http_cache(), kSimpleGET_Transaction, &headers, log.bound(),
&load_timing_info);
@@ -4908,17 +4898,17 @@
std::string raw_headers(kRangeGET_TransactionOK.status);
raw_headers.append("\n");
raw_headers.append(kRangeGET_TransactionOK.response_headers);
- raw_headers = net::HttpUtil::AssembleRawHeaders(raw_headers.data(),
- raw_headers.size());
+ raw_headers =
+ HttpUtil::AssembleRawHeaders(raw_headers.data(), raw_headers.size());
- net::HttpResponseInfo response;
- response.headers = new net::HttpResponseHeaders(raw_headers);
+ HttpResponseInfo response;
+ response.headers = new HttpResponseHeaders(raw_headers);
EXPECT_TRUE(MockHttpCache::WriteResponseInfo(entry, &response, true, false));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(500));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(500));
int len = static_cast<int>(base::strlcpy(buf->data(),
kRangeGET_TransactionOK.data, 500));
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
int rv = entry->WriteData(1, 0, buf.get(), len, cb.callback(), true);
EXPECT_EQ(len, cb.GetResult(rv));
entry->Close();
@@ -4950,17 +4940,17 @@
std::string raw_headers(kRangeGET_TransactionOK.status);
raw_headers.append("\n");
raw_headers.append("Content-Length: 80\n");
- raw_headers = net::HttpUtil::AssembleRawHeaders(raw_headers.data(),
- raw_headers.size());
+ raw_headers =
+ HttpUtil::AssembleRawHeaders(raw_headers.data(), raw_headers.size());
- net::HttpResponseInfo response;
- response.headers = new net::HttpResponseHeaders(raw_headers);
+ HttpResponseInfo response;
+ response.headers = new HttpResponseHeaders(raw_headers);
EXPECT_TRUE(MockHttpCache::WriteResponseInfo(entry, &response, true, false));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(500));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(500));
int len = static_cast<int>(base::strlcpy(buf->data(),
kRangeGET_TransactionOK.data, 500));
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
int rv = entry->WriteData(1, 0, buf.get(), len, cb.callback(), true);
EXPECT_EQ(len, cb.GetResult(rv));
entry->Close();
@@ -5017,7 +5007,7 @@
MockTransaction transaction3(kRangeGET_TransactionOK);
transaction3.request_headers = "Range: bytes = 80-90\r\n" EXTRA_HEADER;
transaction3.data = transaction.data;
- transaction3.load_flags = net::LOAD_PREFERRING_CACHE;
+ transaction3.load_flags = LOAD_PREFERRING_CACHE;
RunTransactionTestWithResponse(cache.http_cache(), transaction3, &headers);
EXPECT_EQ(2, cache.disk_cache()->open_count());
EXPECT_EQ(0U, headers.find("HTTP/1.1 200 "));
@@ -5131,10 +5121,10 @@
Context* c = new Context();
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -5142,9 +5132,9 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Make sure that the entry has some data stored.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(10));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(10));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
- if (rv == net::ERR_IO_PENDING)
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(buf->size(), rv);
@@ -5166,14 +5156,14 @@
RunTransactionTest(cache.http_cache(), kRangeGET_TransactionOK);
MockHttpRequest request(kRangeGET_TransactionOK);
- request.load_flags |= net::LOAD_VALIDATE_CACHE;
+ request.load_flags |= LOAD_VALIDATE_CACHE;
Context* c = new Context();
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(2, cache.network_layer()->transaction_count());
@@ -5182,11 +5172,11 @@
// Make sure that we revalidate the entry and read from the cache (a single
// read will return while waiting for the network).
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(5));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(5));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
EXPECT_EQ(5, c->callback.GetResult(rv));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ EXPECT_EQ(ERR_IO_PENDING, rv);
// Destroy the transaction before completing the read.
delete c;
@@ -5211,14 +5201,14 @@
RunTransactionTest(cache.http_cache(), kRangeGET_TransactionOK);
MockHttpRequest request(kRangeGET_TransactionOK);
- request.load_flags |= net::LOAD_VALIDATE_CACHE;
+ request.load_flags |= LOAD_VALIDATE_CACHE;
Context* c = new Context();
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(ERR_IO_PENDING, rv);
rv = c->callback.WaitForResult();
EXPECT_EQ(2, cache.network_layer()->transaction_count());
@@ -5227,11 +5217,11 @@
// Make sure that we revalidate the entry and read from the cache (a single
// read will return while waiting for the network).
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(5));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(5));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
EXPECT_EQ(5, c->callback.GetResult(rv));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ EXPECT_EQ(ERR_IO_PENDING, rv);
// Destroy the transaction before completing the read.
delete c;
@@ -5242,10 +5232,10 @@
c = new Context();
rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(ERR_IO_PENDING, rv);
MockDiskEntry::IgnoreCallbacks(true);
base::MessageLoop::current()->RunUntilIdle();
@@ -5362,7 +5352,7 @@
// Tests that we handle large range values properly.
TEST(HttpCache, RangeGET_LargeValues) {
// We need a real sparse cache for this test.
- MockHttpCache cache(net::HttpCache::DefaultBackend::InMemory(1024 * 1024));
+ MockHttpCache cache(HttpCache::DefaultBackend::InMemory(1024 * 1024));
std::string headers;
MockTransaction transaction(kRangeGET_TransactionOK);
@@ -5436,7 +5426,7 @@
ScopedMockTransaction transaction(kRangeGET_TransactionOK);
transaction.request_headers = "Range: bytes = 40-\r\n" EXTRA_HEADER;
transaction.test_mode = TEST_MODE_SYNC_NET_START;
- transaction.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags |= LOAD_VALIDATE_CACHE;
// Write to the cache.
RunTransactionTest(cache.http_cache(), kRangeGET_TransactionOK);
@@ -5445,14 +5435,14 @@
RangeTransactionServer handler;
handler.set_bad_200(true);
transaction.data = "Not a range";
- net::BoundTestNetLog log;
+ BoundTestNetLog log;
RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound());
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(1, cache.disk_cache()->open_count());
EXPECT_EQ(1, cache.disk_cache()->create_count());
EXPECT_TRUE(LogContainsEventType(
- log, net::NetLog::TYPE_HTTP_CACHE_RE_SEND_PARTIAL_REQUEST));
+ log, NetLog::TYPE_HTTP_CACHE_RE_SEND_PARTIAL_REQUEST));
}
// Tests that when the server gives us less data than expected, we don't keep
@@ -5509,20 +5499,20 @@
// Force this transaction to read from the cache.
MockTransaction transaction(kRangeGET_TransactionOK);
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
MockHttpRequest request(transaction);
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- int rv = cache.http_cache()->CreateTransaction(net::DEFAULT_PRIORITY, &trans);
- EXPECT_EQ(net::OK, rv);
+ scoped_ptr<HttpTransaction> trans;
+ int rv = cache.http_cache()->CreateTransaction(DEFAULT_PRIORITY, &trans);
+ EXPECT_EQ(OK, rv);
ASSERT_TRUE(trans.get());
- rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_CACHE_MISS, rv);
+ ASSERT_EQ(ERR_CACHE_MISS, rv);
trans.reset();
@@ -5542,9 +5532,9 @@
NULL));
std::string headers("HTTP/1.1 200 OK");
- headers = net::HttpUtil::AssembleRawHeaders(headers.data(), headers.size());
- net::HttpResponseInfo response;
- response.headers = new net::HttpResponseHeaders(headers);
+ headers = HttpUtil::AssembleRawHeaders(headers.data(), headers.size());
+ HttpResponseInfo response;
+ response.headers = new HttpResponseHeaders(headers);
// Set the last argument for this to be an incomplete request.
EXPECT_TRUE(MockHttpCache::WriteResponseInfo(entry, &response, true, true));
@@ -5563,17 +5553,17 @@
// Tests basic pickling/unpickling of HttpResponseInfo.
TEST(HttpCache, PersistHttpResponseInfo) {
// Set some fields (add more if needed.)
- net::HttpResponseInfo response1;
+ HttpResponseInfo response1;
response1.was_cached = false;
- response1.socket_address = net::HostPortPair("1.2.3.4", 80);
- response1.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
+ response1.socket_address = HostPortPair("1.2.3.4", 80);
+ response1.headers = new HttpResponseHeaders("HTTP/1.1 200 OK");
// Pickle.
Pickle pickle;
response1.Persist(&pickle, false, false);
// Unpickle.
- net::HttpResponseInfo response2;
+ HttpResponseInfo response2;
bool response_truncated;
EXPECT_TRUE(response2.InitFromPickle(pickle, &response_truncated));
EXPECT_FALSE(response_truncated);
@@ -5594,10 +5584,10 @@
Context* c = new Context();
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
c->result = c->callback.WaitForResult();
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -5624,10 +5614,10 @@
Context* c = new Context();
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -5635,9 +5625,9 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Make sure that the entry has some data stored.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(10));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(10));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
- if (rv == net::ERR_IO_PENDING)
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(buf->size(), rv);
@@ -5667,10 +5657,10 @@
Context* c = new Context();
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -5678,9 +5668,9 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Make sure that the entry has some data stored.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(10));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(10));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
- if (rv == net::ERR_IO_PENDING)
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(buf->size(), rv);
@@ -5711,10 +5701,10 @@
scoped_ptr<Context> c(new Context());
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -5722,15 +5712,15 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Make sure that the entry has some data stored.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(10));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(10));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
- if (rv == net::ERR_IO_PENDING)
+ if (rv == ERR_IO_PENDING)
rv = c->callback.WaitForResult();
EXPECT_EQ(buf->size(), rv);
// We want to cancel the request when the transaction is busy.
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
- EXPECT_EQ(net::ERR_IO_PENDING, rv);
+ EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_FALSE(c->callback.have_result());
MockHttpCache::SetTestMode(TEST_MODE_SYNC_ALL);
@@ -5749,7 +5739,7 @@
// Verify that the entry is marked as incomplete.
disk_cache::Entry* entry;
ASSERT_TRUE(cache.OpenBackendEntry(kSimpleGET_Transaction.url, &entry));
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
bool truncated = false;
EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
EXPECT_TRUE(truncated);
@@ -5772,13 +5762,13 @@
scoped_ptr<Context> c(new Context());
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, c->callback.GetResult(rv));
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, c->callback.GetResult(rv));
// Read everything.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(22));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(22));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
EXPECT_EQ(buf->size(), c->callback.GetResult(rv));
@@ -5788,7 +5778,7 @@
// Verify that the entry is not marked as truncated.
disk_cache::Entry* entry;
ASSERT_TRUE(cache.OpenBackendEntry(kSimpleGET_Transaction.url, &entry));
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
bool truncated = true;
EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
EXPECT_FALSE(truncated);
@@ -5834,7 +5824,7 @@
ASSERT_TRUE(cache.OpenBackendEntry(kRangeGET_TransactionOK.url, &entry));
EXPECT_EQ(80, entry->GetDataSize(1));
bool truncated = true;
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
EXPECT_FALSE(truncated);
entry->Close();
@@ -5913,23 +5903,23 @@
Context* c = new Context();
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
// Queue another request to this transaction. We have to start this request
// before the first one gets the response from the server and dooms the entry,
// otherwise it will just create a new entry without being queued to the first
// request.
Context* pending = new Context();
- ASSERT_EQ(net::OK, cache.CreateTransaction(&pending->trans));
+ ASSERT_EQ(OK, cache.CreateTransaction(&pending->trans));
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::ERR_IO_PENDING,
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(ERR_IO_PENDING,
pending->trans->Start(&request, pending->callback.callback(),
- net::BoundNetLog()));
- EXPECT_EQ(net::OK, c->callback.GetResult(rv));
+ BoundNetLog()));
+ EXPECT_EQ(OK, c->callback.GetResult(rv));
// Make sure that the entry has some data stored.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(5));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(5));
rv = c->trans->Read(buf.get(), buf->size(), c->callback.callback());
EXPECT_EQ(5, c->callback.GetResult(rv));
@@ -6004,11 +5994,11 @@
scoped_ptr<Context> c(new Context);
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
MockHttpRequest request(transaction);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, c->callback.GetResult(rv));
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, c->callback.GetResult(rv));
// We should have checked with the server before finishing Start().
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -6039,18 +6029,17 @@
scoped_ptr<Context> c(new Context);
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
MockHttpRequest request(transaction);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, c->callback.GetResult(rv));
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, c->callback.GetResult(rv));
- const net::HttpResponseInfo* response = c->trans->GetResponseInfo();
+ const HttpResponseInfo* response = c->trans->GetResponseInfo();
ASSERT_TRUE(response);
ASSERT_EQ(401, response->headers->response_code());
- rv = c->trans->RestartWithAuth(net::AuthCredentials(),
- c->callback.callback());
- EXPECT_EQ(net::OK, c->callback.GetResult(rv));
+ rv = c->trans->RestartWithAuth(AuthCredentials(), c->callback.callback());
+ EXPECT_EQ(OK, c->callback.GetResult(rv));
response = c->trans->GetResponseInfo();
ASSERT_TRUE(response);
ASSERT_EQ(200, response->headers->response_code());
@@ -6097,7 +6086,7 @@
ASSERT_TRUE(cache.OpenBackendEntry(kRangeGET_TransactionOK.url, &entry));
EXPECT_EQ(11, entry->GetDataSize(1));
bool truncated = true;
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
EXPECT_FALSE(truncated);
entry->Close();
@@ -6125,13 +6114,13 @@
MockHttpRequest request(transaction);
Context* c = new Context();
int rv = cache.CreateTransaction(&c->trans);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, c->callback.GetResult(rv));
+ rv = c->trans->Start(&request, c->callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, c->callback.GetResult(rv));
// Read 20 bytes from the cache, and 10 from the net.
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(100));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(100));
rv = c->trans->Read(buf.get(), 20, c->callback.callback());
EXPECT_EQ(20, c->callback.GetResult(rv));
rv = c->trans->Read(buf.get(), 10, c->callback.callback());
@@ -6150,7 +6139,7 @@
ASSERT_TRUE(cache.OpenBackendEntry(kRangeGET_TransactionOK.url, &entry));
EXPECT_EQ(30, entry->GetDataSize(1));
bool truncated = false;
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
EXPECT_TRUE(truncated);
entry->Close();
@@ -6198,17 +6187,17 @@
r2(transaction),
r3(transaction);
- TestTransactionConsumer c1(net::DEFAULT_PRIORITY, cache.http_cache()),
- c2(net::DEFAULT_PRIORITY, cache.http_cache()),
- c3(net::DEFAULT_PRIORITY, cache.http_cache());
+ TestTransactionConsumer c1(DEFAULT_PRIORITY, cache.http_cache()),
+ c2(DEFAULT_PRIORITY, cache.http_cache()),
+ c3(DEFAULT_PRIORITY, cache.http_cache());
- c1.Start(&r1, net::BoundNetLog());
+ c1.Start(&r1, BoundNetLog());
- r2.load_flags |= net::LOAD_ONLY_FROM_CACHE;
- c2.Start(&r2, net::BoundNetLog());
+ r2.load_flags |= LOAD_ONLY_FROM_CACHE;
+ c2.Start(&r2, BoundNetLog());
- r3.load_flags |= net::LOAD_ONLY_FROM_CACHE;
- c3.Start(&r3, net::BoundNetLog());
+ r3.load_flags |= LOAD_ONLY_FROM_CACHE;
+ c3.Start(&r3, BoundNetLog());
base::MessageLoop::current()->Run();
@@ -6216,9 +6205,9 @@
EXPECT_TRUE(c2.is_done());
EXPECT_TRUE(c3.is_done());
- EXPECT_EQ(net::OK, c1.error());
- EXPECT_EQ(net::OK, c2.error());
- EXPECT_EQ(net::OK, c3.error());
+ EXPECT_EQ(OK, c1.error());
+ EXPECT_EQ(OK, c2.error());
+ EXPECT_EQ(OK, c3.error());
}
TEST(HttpCache, ValidationResultsIn200) {
@@ -6232,7 +6221,7 @@
// force this transaction to validate the cache
MockTransaction transaction(kETagGET_Transaction);
- transaction.load_flags |= net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags |= LOAD_VALIDATE_CACHE;
RunTransactionTest(cache.http_cache(), transaction);
// read from the cache
@@ -6247,19 +6236,19 @@
kTestTransaction.response_headers = "Location: http://www.bar.com/\n";
MockHttpRequest request(kTestTransaction);
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
// Write to the cache.
{
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- const net::HttpResponseInfo* info = trans->GetResponseInfo();
+ const HttpResponseInfo* info = trans->GetResponseInfo();
ASSERT_TRUE(info);
EXPECT_EQ(info->headers->response_code(), 301);
@@ -6285,15 +6274,15 @@
// Read from the cache.
{
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
- const net::HttpResponseInfo* info = trans->GetResponseInfo();
+ const HttpResponseInfo* info = trans->GetResponseInfo();
ASSERT_TRUE(info);
EXPECT_EQ(info->headers->response_code(), 301);
@@ -6356,7 +6345,7 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// Try loading again with LOAD_PREFERRING_CACHE.
- transaction.load_flags = net::LOAD_PREFERRING_CACHE;
+ transaction.load_flags = LOAD_PREFERRING_CACHE;
RunTransactionTest(cache.http_cache(), transaction);
EXPECT_EQ(1, cache.network_layer()->transaction_count());
@@ -6408,7 +6397,7 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// try loading again; it should result in a network fetch
- transaction.load_flags = net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags = LOAD_VALIDATE_CACHE;
transaction.response_headers = "cache-control: no-store\n";
RunTransactionTest(cache.http_cache(), transaction);
@@ -6436,7 +6425,7 @@
EXPECT_EQ(1, cache.disk_cache()->create_count());
// try loading again; it should result in a network fetch
- transaction.load_flags = net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags = LOAD_VALIDATE_CACHE;
transaction.response_headers = "cache-control: no-store\n";
transaction.status = "HTTP/1.1 304 Not Modified";
RunTransactionTest(cache.http_cache(), transaction);
@@ -6454,33 +6443,33 @@
MockHttpCache cache;
MockTransaction transaction = kSimpleGET_Transaction;
- transaction.cert_status = net::CERT_STATUS_REVOKED;
+ transaction.cert_status = CERT_STATUS_REVOKED;
ScopedMockTransaction scoped_transaction(transaction);
// write to the cache
RunTransactionTest(cache.http_cache(), transaction);
// Test that it was not cached.
- transaction.load_flags |= net::LOAD_ONLY_FROM_CACHE;
+ transaction.load_flags |= LOAD_ONLY_FROM_CACHE;
MockHttpRequest request(transaction);
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_CACHE_MISS, rv);
+ ASSERT_EQ(ERR_CACHE_MISS, rv);
}
// Ensure that we don't crash by if left-behind transactions.
TEST(HttpCache, OutlivedTransactions) {
MockHttpCache* cache = new MockHttpCache;
- scoped_ptr<net::HttpTransaction> trans;
- EXPECT_EQ(net::OK, cache->CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ EXPECT_EQ(OK, cache->CreateTransaction(&trans));
delete cache;
trans.reset();
@@ -6494,7 +6483,7 @@
RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
// go into disabled mode
- cache.http_cache()->set_mode(net::HttpCache::DISABLE);
+ cache.http_cache()->set_mode(HttpCache::DISABLE);
// force this transaction to write to the cache again
MockTransaction transaction(kSimpleGET_Transaction);
@@ -6544,7 +6533,7 @@
// Request |kUrl| again, this time validating the cache and getting
// a 304 back.
- request.load_flags = net::LOAD_VALIDATE_CACHE;
+ request.load_flags = LOAD_VALIDATE_CACHE;
static const Response kNetResponse2 = {
"HTTP/1.1 304 Not Modified",
@@ -6560,7 +6549,7 @@
mock_network_response.request_time = request_time;
mock_network_response.response_time = response_time;
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(), request, &response);
// The request and response times should have been updated.
@@ -6585,22 +6574,22 @@
MockHttpCache cache;
// Write to the cache
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response);
EXPECT_TRUE(response.metadata.get() == NULL);
// Trivial call.
- cache.http_cache()->WriteMetadata(GURL("foo"), net::DEFAULT_PRIORITY,
- Time::Now(), NULL, 0);
+ cache.http_cache()->WriteMetadata(GURL("foo"), DEFAULT_PRIORITY, Time::Now(),
+ NULL, 0);
// Write meta data to the same entry.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(50));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(50));
memset(buf->data(), 0, buf->size());
base::strlcpy(buf->data(), "Hi there", buf->size());
- cache.http_cache()->WriteMetadata(
- GURL(kSimpleGET_Transaction.url), net::DEFAULT_PRIORITY,
- response.response_time, buf.get(), buf->size());
+ cache.http_cache()->WriteMetadata(GURL(kSimpleGET_Transaction.url),
+ DEFAULT_PRIORITY, response.response_time,
+ buf.get(), buf->size());
// Release the buffer before the operation takes place.
buf = NULL;
@@ -6624,20 +6613,20 @@
MockHttpCache cache;
// Write to the cache
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(), kSimpleGET_Transaction,
&response);
EXPECT_TRUE(response.metadata.get() == NULL);
// Attempt to write meta data to the same entry.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(50));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(50));
memset(buf->data(), 0, buf->size());
base::strlcpy(buf->data(), "Hi there", buf->size());
base::Time expected_time = response.response_time -
base::TimeDelta::FromMilliseconds(20);
cache.http_cache()->WriteMetadata(GURL(kSimpleGET_Transaction.url),
- net::DEFAULT_PRIORITY, expected_time,
- buf.get(), buf->size());
+ DEFAULT_PRIORITY, expected_time, buf.get(),
+ buf->size());
// Makes sure we finish pending operations.
base::MessageLoop::current()->RunUntilIdle();
@@ -6657,25 +6646,25 @@
MockHttpCache cache;
// Write to the cache
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
RunTransactionTestWithResponseInfo(cache.http_cache(),
kTypicalGET_Transaction, &response);
EXPECT_TRUE(response.metadata.get() == NULL);
// Write meta data to the same entry.
- scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(50));
+ scoped_refptr<IOBufferWithSize> buf(new IOBufferWithSize(50));
memset(buf->data(), 0, buf->size());
base::strlcpy(buf->data(), "Hi there", buf->size());
- cache.http_cache()->WriteMetadata(
- GURL(kTypicalGET_Transaction.url), net::DEFAULT_PRIORITY,
- response.response_time, buf.get(), buf->size());
+ cache.http_cache()->WriteMetadata(GURL(kTypicalGET_Transaction.url),
+ DEFAULT_PRIORITY, response.response_time,
+ buf.get(), buf->size());
// Makes sure we finish pending operations.
base::MessageLoop::current()->RunUntilIdle();
// Start with a READ mode transaction.
MockTransaction trans1(kTypicalGET_Transaction);
- trans1.load_flags = net::LOAD_ONLY_FROM_CACHE;
+ trans1.load_flags = LOAD_ONLY_FROM_CACHE;
RunTransactionTestWithResponseInfo(cache.http_cache(), trans1, &response);
ASSERT_TRUE(response.metadata.get() != NULL);
@@ -6688,7 +6677,7 @@
base::MessageLoop::current()->RunUntilIdle();
// Now make sure that the entry is re-validated with the server.
- trans1.load_flags = net::LOAD_VALIDATE_CACHE;
+ trans1.load_flags = LOAD_VALIDATE_CACHE;
trans1.status = "HTTP/1.1 304 Not Modified";
AddMockTransaction(&trans1);
@@ -6704,7 +6693,7 @@
// Now return 200 when validating the entry so the metadata will be lost.
MockTransaction trans2(kTypicalGET_Transaction);
- trans2.load_flags = net::LOAD_VALIDATE_CACHE;
+ trans2.load_flags = LOAD_VALIDATE_CACHE;
RunTransactionTestWithResponseInfo(cache.http_cache(), trans2, &response);
EXPECT_TRUE(response.metadata.get() == NULL);
@@ -6717,17 +6706,17 @@
// of the stream.
TEST(HttpCache, FilterCompletion) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
{
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
MockHttpRequest request(kSimpleGET_Transaction);
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, callback.GetResult(rv));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
rv = trans->Read(buf.get(), 256, callback.callback());
EXPECT_GT(callback.GetResult(rv), 0);
@@ -6751,17 +6740,17 @@
// for a redirect.
TEST(HttpCache, DoneReading) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
ScopedMockTransaction transaction(kSimpleGET_Transaction);
transaction.data = "";
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
MockHttpRequest request(transaction);
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, callback.GetResult(rv));
trans->DoneReading();
// Leave the transaction around.
@@ -6780,17 +6769,17 @@
// Tests that we stop caching when told.
TEST(HttpCache, StopCachingDeletesEntry) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
MockHttpRequest request(kSimpleGET_Transaction);
{
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, callback.GetResult(rv));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
rv = trans->Read(buf.get(), 10, callback.callback());
EXPECT_EQ(10, callback.GetResult(rv));
@@ -6818,17 +6807,17 @@
// after StopCaching.
TEST(HttpCache, StopCachingThenDoneReadingDeletesEntry) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
MockHttpRequest request(kSimpleGET_Transaction);
{
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, callback.GetResult(rv));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
rv = trans->Read(buf.get(), 10, callback.callback());
EXPECT_EQ(10, callback.GetResult(rv));
@@ -6858,22 +6847,22 @@
// Tests that we stop caching when told, when using auth.
TEST(HttpCache, StopCachingWithAuthDeletesEntry) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
MockTransaction mock_transaction(kSimpleGET_Transaction);
mock_transaction.status = "HTTP/1.1 401 Unauthorized";
AddMockTransaction(&mock_transaction);
MockHttpRequest request(mock_transaction);
{
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, callback.GetResult(rv));
trans->StopCaching();
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
rv = trans->Read(buf.get(), 10, callback.callback());
EXPECT_EQ(callback.GetResult(rv), 10);
}
@@ -6893,12 +6882,12 @@
// Tests that when we are told to stop caching we don't throw away valid data.
TEST(HttpCache, StopCachingSavesEntry) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
MockHttpRequest request(kSimpleGET_Transaction);
{
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
// Force a response that can be resumed.
MockTransaction mock_transaction(kSimpleGET_Transaction);
@@ -6907,10 +6896,10 @@
"Content-Length: 42\n"
"Etag: \"foo\"\n";
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, callback.GetResult(rv));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
rv = trans->Read(buf.get(), 10, callback.callback());
EXPECT_EQ(callback.GetResult(rv), 10);
@@ -6928,7 +6917,7 @@
// Verify that the entry is marked as incomplete.
disk_cache::Entry* entry;
ASSERT_TRUE(cache.OpenBackendEntry(kSimpleGET_Transaction.url, &entry));
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
bool truncated = false;
EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
EXPECT_TRUE(truncated);
@@ -6938,7 +6927,7 @@
// Tests that we handle truncated enries when StopCaching is called.
TEST(HttpCache, StopCachingTruncatedEntry) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
MockHttpRequest request(kRangeGET_TransactionOK);
request.extra_headers.Clear();
request.extra_headers.AddHeaderFromString(EXTRA_HEADER_LINE);
@@ -6953,13 +6942,13 @@
{
// Now make a regular request.
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.CreateTransaction(&trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.CreateTransaction(&trans));
- int rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::OK, callback.GetResult(rv));
+ int rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ EXPECT_EQ(OK, callback.GetResult(rv));
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
rv = trans->Read(buf.get(), 10, callback.callback());
EXPECT_EQ(callback.GetResult(rv), 10);
@@ -6980,7 +6969,7 @@
ASSERT_TRUE(cache.OpenBackendEntry(kRangeGET_TransactionOK.url, &entry));
EXPECT_EQ(80, entry->GetDataSize(1));
bool truncated = true;
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
EXPECT_FALSE(truncated);
entry->Close();
@@ -6992,7 +6981,7 @@
// a Content-Length header.
TEST(HttpCache, TruncatedByContentLength) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
MockTransaction transaction(kSimpleGET_Transaction);
AddMockTransaction(&transaction);
@@ -7013,7 +7002,7 @@
// from the net.
TEST(HttpCache, TruncatedByContentLength2) {
MockHttpCache cache;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
MockTransaction transaction(kSimpleGET_Transaction);
AddMockTransaction(&transaction);
@@ -7026,7 +7015,7 @@
// Verify that the entry is marked as incomplete.
disk_cache::Entry* entry;
ASSERT_TRUE(cache.OpenBackendEntry(kSimpleGET_Transaction.url, &entry));
- net::HttpResponseInfo response;
+ HttpResponseInfo response;
bool truncated = false;
EXPECT_TRUE(MockHttpCache::ReadResponseInfo(entry, &response, &truncated));
EXPECT_TRUE(truncated);
@@ -7038,40 +7027,36 @@
TEST(HttpCache, SetPriority) {
MockHttpCache cache;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.http_cache()->CreateTransaction(net::IDLE, &trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.http_cache()->CreateTransaction(IDLE, &trans));
// Shouldn't crash, but doesn't do anything either.
- trans->SetPriority(net::LOW);
+ trans->SetPriority(LOW);
EXPECT_FALSE(cache.network_layer()->last_transaction());
- EXPECT_EQ(net::DEFAULT_PRIORITY,
+ EXPECT_EQ(DEFAULT_PRIORITY,
cache.network_layer()->last_create_transaction_priority());
- net::HttpRequestInfo info;
+ HttpRequestInfo info;
info.url = GURL(kSimpleGET_Transaction.url);
- net::TestCompletionCallback callback;
- EXPECT_EQ(net::ERR_IO_PENDING,
- trans->Start(&info, callback.callback(), net::BoundNetLog()));
+ TestCompletionCallback callback;
+ EXPECT_EQ(ERR_IO_PENDING,
+ trans->Start(&info, callback.callback(), BoundNetLog()));
EXPECT_TRUE(cache.network_layer()->last_transaction());
if (cache.network_layer()->last_transaction()) {
- EXPECT_EQ(net::LOW,
- cache.network_layer()->last_create_transaction_priority());
- EXPECT_EQ(net::LOW,
- cache.network_layer()->last_transaction()->priority());
+ EXPECT_EQ(LOW, cache.network_layer()->last_create_transaction_priority());
+ EXPECT_EQ(LOW, cache.network_layer()->last_transaction()->priority());
}
- trans->SetPriority(net::HIGHEST);
+ trans->SetPriority(HIGHEST);
if (cache.network_layer()->last_transaction()) {
- EXPECT_EQ(net::LOW,
- cache.network_layer()->last_create_transaction_priority());
- EXPECT_EQ(net::HIGHEST,
- cache.network_layer()->last_transaction()->priority());
+ EXPECT_EQ(LOW, cache.network_layer()->last_create_transaction_priority());
+ EXPECT_EQ(HIGHEST, cache.network_layer()->last_transaction()->priority());
}
- EXPECT_EQ(net::OK, callback.WaitForResult());
+ EXPECT_EQ(OK, callback.WaitForResult());
}
// Make sure that calling SetWebSocketHandshakeStreamCreateHelper on a cache
@@ -7080,16 +7065,16 @@
MockHttpCache cache;
FakeWebSocketHandshakeStreamCreateHelper create_helper;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK, cache.http_cache()->CreateTransaction(net::IDLE, &trans));
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.http_cache()->CreateTransaction(IDLE, &trans));
EXPECT_FALSE(cache.network_layer()->last_transaction());
- net::HttpRequestInfo info;
+ HttpRequestInfo info;
info.url = GURL(kSimpleGET_Transaction.url);
- net::TestCompletionCallback callback;
- EXPECT_EQ(net::ERR_IO_PENDING,
- trans->Start(&info, callback.callback(), net::BoundNetLog()));
+ TestCompletionCallback callback;
+ EXPECT_EQ(ERR_IO_PENDING,
+ trans->Start(&info, callback.callback(), BoundNetLog()));
ASSERT_TRUE(cache.network_layer()->last_transaction());
EXPECT_FALSE(cache.network_layer()->last_transaction()->
@@ -7098,7 +7083,7 @@
EXPECT_EQ(&create_helper,
cache.network_layer()->last_transaction()->
websocket_handshake_stream_create_helper());
- EXPECT_EQ(net::OK, callback.WaitForResult());
+ EXPECT_EQ(OK, callback.WaitForResult());
}
// Make sure that a cache transaction passes on its priority to
@@ -7120,28 +7105,25 @@
transaction.request_headers = EXTRA_HEADER;
transaction.data = kFullRangeData;
- scoped_ptr<net::HttpTransaction> trans;
- ASSERT_EQ(net::OK,
- cache.http_cache()->CreateTransaction(net::MEDIUM, &trans));
- EXPECT_EQ(net::DEFAULT_PRIORITY,
+ scoped_ptr<HttpTransaction> trans;
+ ASSERT_EQ(OK, cache.http_cache()->CreateTransaction(MEDIUM, &trans));
+ EXPECT_EQ(DEFAULT_PRIORITY,
cache.network_layer()->last_create_transaction_priority());
MockHttpRequest info(transaction);
- net::TestCompletionCallback callback;
- EXPECT_EQ(net::ERR_IO_PENDING,
- trans->Start(&info, callback.callback(), net::BoundNetLog()));
- EXPECT_EQ(net::OK, callback.WaitForResult());
+ TestCompletionCallback callback;
+ EXPECT_EQ(ERR_IO_PENDING,
+ trans->Start(&info, callback.callback(), BoundNetLog()));
+ EXPECT_EQ(OK, callback.WaitForResult());
- EXPECT_EQ(net::MEDIUM,
- cache.network_layer()->last_create_transaction_priority());
+ EXPECT_EQ(MEDIUM, cache.network_layer()->last_create_transaction_priority());
- trans->SetPriority(net::HIGHEST);
+ trans->SetPriority(HIGHEST);
// Should trigger a new network transaction and pick up the new
// priority.
ReadAndVerifyTransaction(trans.get(), transaction);
- EXPECT_EQ(net::HIGHEST,
- cache.network_layer()->last_create_transaction_priority());
+ EXPECT_EQ(HIGHEST, cache.network_layer()->last_create_transaction_priority());
RemoveMockTransaction(&kRangeGET_TransactionOK);
}
@@ -7151,8 +7133,8 @@
const MockTransaction& trans_info) {
int64 received_bytes = -1;
RunTransactionTestBase(cache.http_cache(), trans_info,
- MockHttpRequest(trans_info), NULL, net::BoundNetLog(),
- NULL, &received_bytes);
+ MockHttpRequest(trans_info), NULL, BoundNetLog(), NULL,
+ &received_bytes);
return received_bytes;
}
@@ -7179,7 +7161,7 @@
int64 received_bytes = RunTransactionAndGetReceivedBytes(cache, transaction);
EXPECT_EQ(TransactionSize(transaction), received_bytes);
- transaction.load_flags = net::LOAD_VALIDATE_CACHE;
+ transaction.load_flags = LOAD_VALIDATE_CACHE;
transaction.handler = ETagGet_ConditionalRequest_Handler;
received_bytes = RunTransactionAndGetReceivedBytes(cache, transaction);
EXPECT_EQ(TransactionSize(transaction), received_bytes);
@@ -7246,7 +7228,7 @@
static const int kRequireValidationSecs = kMaxAgeSecs + 1;
HttpCachePrefetchValidationTest() : transaction_(kSimpleGET_Transaction) {
- DCHECK_LT(kMaxAgeSecs, prefetch_reuse_mins() * net::kNumSecondsPerMinute);
+ DCHECK_LT(kMaxAgeSecs, prefetch_reuse_mins() * kNumSecondsPerMinute);
clock_ = new base::SimpleTestClock();
cache_.http_cache()->SetClockForTesting(make_scoped_ptr(clock_));
@@ -7266,7 +7248,7 @@
clock_->Advance(base::TimeDelta::FromSeconds(seconds));
}
- int prefetch_reuse_mins() { return net::HttpCache::kPrefetchReuseMins; }
+ int prefetch_reuse_mins() { return HttpCache::kPrefetchReuseMins; }
// How many times this test has sent requests to the (fake) origin
// server. Every test case needs to make at least one request to initialise
@@ -7282,71 +7264,71 @@
};
TEST_F(HttpCachePrefetchValidationTest, SkipValidationShortlyAfterPrefetch) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_NORMAL));
}
TEST_F(HttpCachePrefetchValidationTest, ValidateLongAfterPrefetch) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
- AdvanceTime(prefetch_reuse_mins() * net::kNumSecondsPerMinute);
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
+ AdvanceTime(prefetch_reuse_mins() * kNumSecondsPerMinute);
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_NORMAL));
}
TEST_F(HttpCachePrefetchValidationTest, SkipValidationOnceOnly) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_NORMAL));
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_NORMAL));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_NORMAL));
}
TEST_F(HttpCachePrefetchValidationTest, SkipValidationOnceReadOnly) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_ONLY_FROM_CACHE));
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_ONLY_FROM_CACHE));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_NORMAL));
}
TEST_F(HttpCachePrefetchValidationTest, BypassCacheOverwritesPrefetch) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_BYPASS_CACHE));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_BYPASS_CACHE));
AdvanceTime(kRequireValidationSecs);
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_NORMAL));
}
TEST_F(HttpCachePrefetchValidationTest,
SkipValidationOnExistingEntryThatNeedsValidation) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_NORMAL));
AdvanceTime(kRequireValidationSecs);
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_NORMAL));
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_NORMAL));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_NORMAL));
}
TEST_F(HttpCachePrefetchValidationTest,
SkipValidationOnExistingEntryThatDoesNotNeedValidation) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_NORMAL));
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_NORMAL));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_NORMAL));
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_NORMAL));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_NORMAL));
}
TEST_F(HttpCachePrefetchValidationTest, PrefetchMultipleTimes) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_NORMAL));
}
TEST_F(HttpCachePrefetchValidationTest, ValidateOnDelayedSecondPrefetch) {
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_TRUE(TransactionRequiredNetwork(net::LOAD_PREFETCH));
+ EXPECT_TRUE(TransactionRequiredNetwork(LOAD_PREFETCH));
AdvanceTime(kRequireValidationSecs);
- EXPECT_FALSE(TransactionRequiredNetwork(net::LOAD_NORMAL));
+ EXPECT_FALSE(TransactionRequiredNetwork(LOAD_NORMAL));
}
// Framework for tests of stale-while-revalidate related functionality. With
@@ -7395,7 +7377,7 @@
std::string validator_;
};
-static void CheckResourceFreshnessHeader(const net::HttpRequestInfo* request,
+static void CheckResourceFreshnessHeader(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
@@ -7422,7 +7404,7 @@
EXPECT_EQ(2, transaction_count());
}
-static void CheckResourceFreshnessAbsent(const net::HttpRequestInfo* request,
+static void CheckResourceFreshnessAbsent(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
@@ -7493,7 +7475,7 @@
RunFixtureTransactionTest();
}
-static void CheckIfModifiedSinceHeader(const net::HttpRequestInfo* request,
+static void CheckIfModifiedSinceHeader(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
@@ -7513,7 +7495,7 @@
RunFixtureTransactionTest();
}
-static void CheckIfNoneMatchHeader(const net::HttpRequestInfo* request,
+static void CheckIfNoneMatchHeader(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
@@ -7536,11 +7518,10 @@
RunFixtureTransactionTest();
}
-static void CheckResourceFreshnessHeaderPresent(
- const net::HttpRequestInfo* request,
- std::string* response_status,
- std::string* response_headers,
- std::string* response_data) {
+static void CheckResourceFreshnessHeaderPresent(const HttpRequestInfo* request,
+ std::string* response_status,
+ std::string* response_headers,
+ std::string* response_data) {
EXPECT_TRUE(request->extra_headers.HasHeader("Resource-Freshness"));
}
@@ -7613,7 +7594,7 @@
EXPECT_EQ(2, transaction_count());
}
-static void CheckUrlMatches(const net::HttpRequestInfo* request,
+static void CheckUrlMatches(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
@@ -7657,13 +7638,13 @@
INSTANTIATE_TEST_CASE_P(HttpCacheStaleWhileRevalidate,
SyncLoadFlagTest,
- ::testing::Values(net::LOAD_VALIDATE_CACHE,
- net::LOAD_BYPASS_CACHE,
- net::LOAD_DISABLE_CACHE));
+ ::testing::Values(LOAD_VALIDATE_CACHE,
+ LOAD_BYPASS_CACHE,
+ LOAD_DISABLE_CACHE));
TEST_F(HttpCacheStaleWhileRevalidateTest,
PreferringCacheDoesNotTriggerAsyncRequest) {
- transaction_.load_flags |= net::LOAD_PREFERRING_CACHE;
+ transaction_.load_flags |= LOAD_PREFERRING_CACHE;
// Write to the cache.
RunFixtureTransactionTest();
@@ -7696,8 +7677,8 @@
TEST_F(HttpCacheStaleWhileRevalidateTest,
OnlyFromCacheDoesNotTriggerAsyncRequest) {
- transaction_.load_flags |= net::LOAD_ONLY_FROM_CACHE;
- transaction_.return_code = net::ERR_CACHE_MISS;
+ transaction_.load_flags |= LOAD_ONLY_FROM_CACHE;
+ transaction_.return_code = ERR_CACHE_MISS;
// Writing to the cache should fail, because we are avoiding the network.
RunFixtureTransactionTest();
@@ -7725,18 +7706,17 @@
// Now read back. RunTransactionTestBase() expects to receive the network
// error back from the HttpCache::Transaction, but since the cache request
// will return OK we need to duplicate some of its implementation here.
- transaction_.return_code = net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED;
- net::TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- int rv =
- cache_.http_cache()->CreateTransaction(net::DEFAULT_PRIORITY, &trans);
- EXPECT_EQ(net::OK, rv);
+ transaction_.return_code = ERR_SSL_CLIENT_AUTH_CERT_NEEDED;
+ TestCompletionCallback callback;
+ scoped_ptr<HttpTransaction> trans;
+ int rv = cache_.http_cache()->CreateTransaction(DEFAULT_PRIORITY, &trans);
+ EXPECT_EQ(OK, rv);
ASSERT_TRUE(trans.get());
MockHttpRequest request(transaction_);
- rv = trans->Start(&request, callback.callback(), net::BoundNetLog());
- ASSERT_EQ(net::ERR_IO_PENDING, rv);
- ASSERT_EQ(net::OK, callback.WaitForResult());
+ rv = trans->Start(&request, callback.callback(), BoundNetLog());
+ ASSERT_EQ(ERR_IO_PENDING, rv);
+ ASSERT_EQ(OK, callback.WaitForResult());
ReadAndVerifyTransaction(trans.get(), transaction_);
EXPECT_EQ(1, transaction_count());
@@ -7747,7 +7727,7 @@
EXPECT_EQ(2, transaction_count());
// Now run the transaction again. It should run synchronously.
- transaction_.return_code = net::OK;
+ transaction_.return_code = OK;
RunFixtureTransactionTest();
EXPECT_EQ(3, transaction_count());
@@ -7767,7 +7747,7 @@
base::RunLoop().RunUntilIdle();
// The cache entry should still be complete.
- transaction_.load_flags = net::LOAD_ONLY_FROM_CACHE;
+ transaction_.load_flags = LOAD_ONLY_FROM_CACHE;
RunFixtureTransactionTest();
}
@@ -7789,17 +7769,17 @@
EXPECT_EQ(2, transaction_count());
}
-static void CheckLoadFlagsAsyncRevalidation(const net::HttpRequestInfo* request,
+static void CheckLoadFlagsAsyncRevalidation(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
- EXPECT_EQ(net::LOAD_ASYNC_REVALIDATION, request->load_flags);
+ EXPECT_EQ(LOAD_ASYNC_REVALIDATION, request->load_flags);
}
// Check that the load flags on the async request are the same as the load flags
// on the original request, plus LOAD_ASYNC_REVALIDATION.
TEST_F(HttpCacheStaleWhileRevalidateTest, LoadFlagsAsyncRevalidation) {
- transaction_.load_flags = net::LOAD_NORMAL;
+ transaction_.load_flags = LOAD_NORMAL;
// Write to the cache.
RunFixtureTransactionTest();
@@ -7816,7 +7796,7 @@
EXPECT_EQ(2, transaction_count());
}
-static void SimpleMockAuthHandler(const net::HttpRequestInfo* request,
+static void SimpleMockAuthHandler(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data) {
@@ -7862,14 +7842,14 @@
transaction.data = "rg: 00-09 ";
AddMockTransaction(&transaction);
- net::TestCompletionCallback callback;
- scoped_ptr<net::HttpTransaction> trans;
- int rv = cache.http_cache()->CreateTransaction(net::DEFAULT_PRIORITY, &trans);
- EXPECT_EQ(net::OK, rv);
+ TestCompletionCallback callback;
+ scoped_ptr<HttpTransaction> trans;
+ int rv = cache.http_cache()->CreateTransaction(DEFAULT_PRIORITY, &trans);
+ EXPECT_EQ(OK, rv);
ASSERT_TRUE(trans.get());
// Start our transaction.
- trans->Start(&request, callback.callback(), net::BoundNetLog());
+ trans->Start(&request, callback.callback(), BoundNetLog());
// A second transaction on a different part of the file (the default
// kRangeGET_TransactionOK requests 40-49) should not be blocked by
@@ -7894,14 +7874,14 @@
scoped_ptr<Context> first(new Context);
first->result = cache.CreateTransaction(&first->trans);
- ASSERT_EQ(net::OK, first->result);
- EXPECT_EQ(net::LOAD_STATE_IDLE, first->trans->GetLoadState());
- first->result = first->trans->Start(
- &request, first->callback.callback(), net::BoundNetLog());
- EXPECT_EQ(net::LOAD_STATE_WAITING_FOR_CACHE, first->trans->GetLoadState());
+ ASSERT_EQ(OK, first->result);
+ EXPECT_EQ(LOAD_STATE_IDLE, first->trans->GetLoadState());
+ first->result =
+ first->trans->Start(&request, first->callback.callback(), BoundNetLog());
+ EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, first->trans->GetLoadState());
base::MessageLoop::current()->RunUntilIdle();
- EXPECT_EQ(net::LOAD_STATE_IDLE, first->trans->GetLoadState());
+ EXPECT_EQ(LOAD_STATE_IDLE, first->trans->GetLoadState());
ASSERT_TRUE(first->trans->GetResponseInfo());
EXPECT_TRUE(first->trans->GetResponseInfo()->headers->HasHeaderValue(
"Cache-Control", "no-store"));
@@ -7910,17 +7890,19 @@
// Let us create the second (read) transaction.
scoped_ptr<Context> second(new Context);
second->result = cache.CreateTransaction(&second->trans);
- ASSERT_EQ(net::OK, second->result);
- EXPECT_EQ(net::LOAD_STATE_IDLE, second->trans->GetLoadState());
- second->result = second->trans->Start(
- &request, second->callback.callback(), net::BoundNetLog());
+ ASSERT_EQ(OK, second->result);
+ EXPECT_EQ(LOAD_STATE_IDLE, second->trans->GetLoadState());
+ second->result = second->trans->Start(&request, second->callback.callback(),
+ BoundNetLog());
// Here the second transaction proceeds without reading the first body.
- EXPECT_EQ(net::LOAD_STATE_WAITING_FOR_CACHE, second->trans->GetLoadState());
+ EXPECT_EQ(LOAD_STATE_WAITING_FOR_CACHE, second->trans->GetLoadState());
base::MessageLoop::current()->RunUntilIdle();
- EXPECT_EQ(net::LOAD_STATE_IDLE, second->trans->GetLoadState());
+ EXPECT_EQ(LOAD_STATE_IDLE, second->trans->GetLoadState());
ASSERT_TRUE(second->trans->GetResponseInfo());
EXPECT_TRUE(second->trans->GetResponseInfo()->headers->HasHeaderValue(
"Cache-Control", "no-store"));
ReadAndVerifyTransaction(second->trans.get(), kSimpleGET_Transaction);
}
+
+} // namespace net
diff --git a/net/http/http_content_disposition.cc b/net/http/http_content_disposition.cc
index 3a1dede..29593cda 100644
--- a/net/http/http_content_disposition.cc
+++ b/net/http/http_content_disposition.cc
@@ -14,6 +14,8 @@
#include "net/base/net_util.h"
#include "net/http/http_util.h"
+namespace net {
+
namespace {
enum RFC2047EncodingType {
@@ -73,7 +75,7 @@
return true;
}
- return net::ConvertToUtf8(decoded, charset.c_str(), output);
+ return ConvertToUtf8(decoded, charset.c_str(), output);
}
bool DecodeWord(const std::string& encoded_word,
@@ -93,15 +95,15 @@
} else {
base::string16 utf16_output;
if (!referrer_charset.empty() &&
- net::ConvertToUTF16(encoded_word, referrer_charset.c_str(),
- &utf16_output)) {
+ ConvertToUTF16(encoded_word, referrer_charset.c_str(),
+ &utf16_output)) {
*output = base::UTF16ToUTF8(utf16_output);
} else {
*output = base::WideToUTF8(base::SysNativeMBToWide(encoded_word));
}
}
- *parse_result_flags |= net::HttpContentDisposition::HAS_NON_ASCII_STRINGS;
+ *parse_result_flags |= HttpContentDisposition::HAS_NON_ASCII_STRINGS;
return true;
}
@@ -173,7 +175,7 @@
if (*(encoded_word.end() - 1) == '=') {
output->swap(decoded_word);
*parse_result_flags |=
- net::HttpContentDisposition::HAS_RFC2047_ENCODED_STRINGS;
+ HttpContentDisposition::HAS_RFC2047_ENCODED_STRINGS;
return true;
}
// encoded_word ending prematurelly with '?' or extra '?'
@@ -186,11 +188,9 @@
// web browser.
// What IE6/7 does: %-escaped UTF-8.
- decoded_word = net::UnescapeURLComponent(encoded_word,
- net::UnescapeRule::SPACES);
+ decoded_word = UnescapeURLComponent(encoded_word, UnescapeRule::SPACES);
if (decoded_word != encoded_word)
- *parse_result_flags |=
- net::HttpContentDisposition::HAS_PERCENT_ENCODED_STRINGS;
+ *parse_result_flags |= HttpContentDisposition::HAS_PERCENT_ENCODED_STRINGS;
if (base::IsStringUTF8(decoded_word)) {
output->swap(decoded_word);
return true;
@@ -322,16 +322,14 @@
return true;
}
- std::string unescaped = net::UnescapeURLComponent(
- value, net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS);
+ std::string unescaped = UnescapeURLComponent(
+ value, UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS);
- return net::ConvertToUtf8AndNormalize(unescaped, charset.c_str(), decoded);
+ return ConvertToUtf8AndNormalize(unescaped, charset.c_str(), decoded);
}
} // namespace
-namespace net {
-
HttpContentDisposition::HttpContentDisposition(
const std::string& header, const std::string& referrer_charset)
: type_(INLINE),
diff --git a/net/http/http_content_disposition_unittest.cc b/net/http/http_content_disposition_unittest.cc
index e617c6ca..ade0d293 100644
--- a/net/http/http_content_disposition_unittest.cc
+++ b/net/http/http_content_disposition_unittest.cc
@@ -207,301 +207,245 @@
TEST(HttpContentDispositionTest, tc2231) {
const struct FileNameCDCase {
const char* header;
- net::HttpContentDisposition::Type expected_type;
+ HttpContentDisposition::Type expected_type;
const wchar_t* expected_filename;
} tests[] = {
- // http://greenbytes.de/tech/tc2231/#inlonly
- { "inline",
- net::HttpContentDisposition::INLINE,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#inlonlyquoted
- { "\"inline\"",
- net::HttpContentDisposition::INLINE,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#inlwithasciifilename
- { "inline; filename=\"foo.html\"",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#inlwithfnattach
- { "inline; filename=\"Not an attachment!\"",
- net::HttpContentDisposition::INLINE,
- L"Not an attachment!"
- },
- // http://greenbytes.de/tech/tc2231/#inlwithasciifilenamepdf
- { "inline; filename=\"foo.pdf\"",
- net::HttpContentDisposition::INLINE,
- L"foo.pdf"
- },
- // http://greenbytes.de/tech/tc2231/#attonly
- { "attachment",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attonlyquoted
- { "\"attachment\"",
- net::HttpContentDisposition::INLINE,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attonly403
- // TODO(abarth): This isn't testable in this unit test.
- // http://greenbytes.de/tech/tc2231/#attonlyucase
- { "ATTACHMENT",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilename
- { "attachment; filename=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifnescapedchar
- { "attachment; filename=\"f\\oo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifnescapedquote
- { "attachment; filename=\"\\\"quoting\\\" tested.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"\"quoting\" tested.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithquotedsemicolon
- { "attachment; filename=\"Here's a semicolon;.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"Here's a semicolon;.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfilenameandextparam
- { "attachment; foo=\"bar\"; filename=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfilenameandextparamescaped
- { "attachment; foo=\"\\\"\\\\\";filename=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenameucase
- { "attachment; FILENAME=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenq
- { "attachment; filename=foo.html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenqs
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo.html ;",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attemptyparam
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; ;filename=foo",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenqws
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo bar.html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo bar.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfntokensq
- { "attachment; filename='foo.bar'",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.bar" // Should be L"'foo.bar'"
- },
+ // http://greenbytes.de/tech/tc2231/#inlonly
+ {"inline", HttpContentDisposition::INLINE, L""},
+ // http://greenbytes.de/tech/tc2231/#inlonlyquoted
+ {"\"inline\"", HttpContentDisposition::INLINE, L""},
+ // http://greenbytes.de/tech/tc2231/#inlwithasciifilename
+ {"inline; filename=\"foo.html\"",
+ HttpContentDisposition::INLINE,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#inlwithfnattach
+ {"inline; filename=\"Not an attachment!\"",
+ HttpContentDisposition::INLINE,
+ L"Not an attachment!"},
+ // http://greenbytes.de/tech/tc2231/#inlwithasciifilenamepdf
+ {"inline; filename=\"foo.pdf\"",
+ HttpContentDisposition::INLINE,
+ L"foo.pdf"},
+ // http://greenbytes.de/tech/tc2231/#attonly
+ {"attachment", HttpContentDisposition::ATTACHMENT, L""},
+ // http://greenbytes.de/tech/tc2231/#attonlyquoted
+ {"\"attachment\"", HttpContentDisposition::INLINE, L""},
+ // http://greenbytes.de/tech/tc2231/#attonly403
+ // TODO(abarth): This isn't testable in this unit test.
+ // http://greenbytes.de/tech/tc2231/#attonlyucase
+ {"ATTACHMENT", HttpContentDisposition::ATTACHMENT, L""},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilename
+ {"attachment; filename=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifnescapedchar
+ {"attachment; filename=\"f\\oo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifnescapedquote
+ {"attachment; filename=\"\\\"quoting\\\" tested.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"\"quoting\" tested.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithquotedsemicolon
+ {"attachment; filename=\"Here's a semicolon;.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"Here's a semicolon;.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfilenameandextparam
+ {"attachment; foo=\"bar\"; filename=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfilenameandextparamescaped
+ {"attachment; foo=\"\\\"\\\\\";filename=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenameucase
+ {"attachment; FILENAME=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenq
+ {"attachment; filename=foo.html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenqs
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo.html ;",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attemptyparam
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; ;filename=foo", HttpContentDisposition::ATTACHMENT, L"foo"},
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenamenqws
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo bar.html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo bar.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfntokensq
+ {
+ "attachment; filename='foo.bar'",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.bar" // Should be L"'foo.bar'"
+ },
#ifdef ICU_SHOULD_FAIL_CONVERSION_ON_INVALID_CHARACTER
- // http://greenbytes.de/tech/tc2231/#attwithisofnplain
- { "attachment; filename=\"foo-\xE4html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"" // Should be L"foo-\xE4.html"
- },
+ // http://greenbytes.de/tech/tc2231/#attwithisofnplain
+ {
+ "attachment; filename=\"foo-\xE4html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"" // Should be L"foo-\xE4.html"
+ },
#endif
- // http://greenbytes.de/tech/tc2231/#attwithutf8fnplain
- // Note: We'll UTF-8 decode the file name, even though tc2231 says not to.
- { "attachment; filename=\"foo-\xC3\xA4.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-\xE4.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfnrawpctenca
- { "attachment; filename=\"foo-%41.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-A.html" // Should be L"foo-%41.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfnusingpct
- { "attachment; filename=\"50%.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"50%.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithfnrawpctencaq
- { "attachment; filename=\"foo-%\\41.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-A.html" // Should be L"foo-%41.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithnamepct
- { "attachment; name=\"foo-%41.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-A.html" // Should be L"foo-%41.html"
- },
+ // http://greenbytes.de/tech/tc2231/#attwithutf8fnplain
+ // Note: We'll UTF-8 decode the file name, even though tc2231 says not to.
+ {"attachment; filename=\"foo-\xC3\xA4.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-\xE4.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfnrawpctenca
+ {
+ "attachment; filename=\"foo-%41.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-A.html" // Should be L"foo-%41.html"
+ },
+ // http://greenbytes.de/tech/tc2231/#attwithfnusingpct
+ {"attachment; filename=\"50%.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"50%.html"},
+ // http://greenbytes.de/tech/tc2231/#attwithfnrawpctencaq
+ {
+ "attachment; filename=\"foo-%\\41.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-A.html" // Should be L"foo-%41.html"
+ },
+ // http://greenbytes.de/tech/tc2231/#attwithnamepct
+ {
+ "attachment; name=\"foo-%41.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-A.html" // Should be L"foo-%41.html"
+ },
#ifdef ICU_SHOULD_FAIL_CONVERSION_ON_INVALID_CHARACTER
- // http://greenbytes.de/tech/tc2231/#attwithfilenamepctandiso
- { "attachment; filename=\"\xE4-%41.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"" // Should be L"\xE4-%41.htm"
- },
+ // http://greenbytes.de/tech/tc2231/#attwithfilenamepctandiso
+ {
+ "attachment; filename=\"\xE4-%41.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"" // Should be L"\xE4-%41.htm"
+ },
#endif
- // http://greenbytes.de/tech/tc2231/#attwithfnrawpctenclong
- { "attachment; filename=\"foo-%c3%a4-%e2%82%ac.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-\xE4-\u20AC.html" // Should be L"foo-%c3%a4-%e2%82%ac.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwithasciifilenamews1
- { "attachment; filename =\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attwith2filenames
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=\"foo.html\"; filename=\"bar.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attfnbrokentoken
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo[1](2).html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo[1](2).html"
- },
+ // http://greenbytes.de/tech/tc2231/#attwithfnrawpctenclong
+ {
+ "attachment; filename=\"foo-%c3%a4-%e2%82%ac.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-\xE4-\u20AC.html" // Should be L"foo-%c3%a4-%e2%82%ac.html"
+ },
+ // http://greenbytes.de/tech/tc2231/#attwithasciifilenamews1
+ {"attachment; filename =\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attwith2filenames
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=\"foo.html\"; filename=\"bar.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attfnbrokentoken
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo[1](2).html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo[1](2).html"},
#ifdef ICU_SHOULD_FAIL_CONVERSION_ON_INVALID_CHARACTER
- // http://greenbytes.de/tech/tc2231/#attfnbrokentokeniso
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo-\xE4.html",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
+ // http://greenbytes.de/tech/tc2231/#attfnbrokentokeniso
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo-\xE4.html",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
#endif
- // http://greenbytes.de/tech/tc2231/#attfnbrokentokenutf
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo-\xC3\xA4.html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo-\xE4.html"
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdisposition
- // Note: tc2231 says we should fail to parse this header.
- { "filename=foo.html",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdisposition2
- // Note: tc2231 says we should fail to parse this header.
- { "x=y; filename=foo.html",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdisposition3
- // Note: tc2231 says we should fail to parse this header.
- { "\"foo; filename=bar;baz\"; filename=qux",
- net::HttpContentDisposition::INLINE,
- L"" // Firefox gets qux
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdisposition4
- // Note: tc2231 says we should fail to parse this header.
- { "filename=foo.html, filename=bar.html",
- net::HttpContentDisposition::INLINE,
- L"foo.html, filename=bar.html"
- },
- // http://greenbytes.de/tech/tc2231/#emptydisposition
- // Note: tc2231 says we should fail to parse this header.
- { "; filename=foo.html",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attandinline
- // Note: tc2231 says we should fail to parse this header.
- { "inline; attachment; filename=foo.html",
- net::HttpContentDisposition::INLINE,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attandinline2
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; inline; filename=foo.html",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=\"foo.html\".txt",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html\".txt"
- },
- // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn2
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=\"bar",
- net::HttpContentDisposition::ATTACHMENT,
- L"bar"
- },
- // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn3
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo\"bar;baz\"qux",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo\"bar;baz\"qux"
- },
- // http://greenbytes.de/tech/tc2231/#attmultinstances
- // Note: tc2231 says we should fail to parse this header.
- { "attachment; filename=foo.html, attachment; filename=bar.html",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html, attachment"
- },
- // http://greenbytes.de/tech/tc2231/#attmissingdelim
- { "attachment; foo=foo filename=bar",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attreversed
- // Note: tc2231 says we should fail to parse this header.
- { "filename=foo.html; attachment",
- net::HttpContentDisposition::INLINE,
- L"foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attconfusedparam
- { "attachment; xfilename=foo.html",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attabspath
- { "attachment; filename=\"/foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"/foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#attabspathwin
- { "attachment; filename=\"\\\\foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"\\foo.html"
- },
- // http://greenbytes.de/tech/tc2231/#dispext
- { "foobar",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#dispextbadfn
- { "attachment; example=\"filename=example.txt\"",
- net::HttpContentDisposition::ATTACHMENT,
- L""
- },
- // http://greenbytes.de/tech/tc2231/#attnewandfn
- { "attachment; foobar=x; filename=\"foo.html\"",
- net::HttpContentDisposition::ATTACHMENT,
- L"foo.html"
- },
- // TODO(abarth): Add the filename* tests, but check
- // HttpContentDispositionTest.Filename for overlap.
- // TODO(abarth): http://greenbytes.de/tech/tc2231/#attrfc2047token
- // TODO(abarth): http://greenbytes.de/tech/tc2231/#attrfc2047quoted
+ // http://greenbytes.de/tech/tc2231/#attfnbrokentokenutf
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo-\xC3\xA4.html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo-\xE4.html"},
+ // http://greenbytes.de/tech/tc2231/#attmissingdisposition
+ // Note: tc2231 says we should fail to parse this header.
+ {"filename=foo.html", HttpContentDisposition::INLINE, L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attmissingdisposition2
+ // Note: tc2231 says we should fail to parse this header.
+ {"x=y; filename=foo.html", HttpContentDisposition::INLINE, L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attmissingdisposition3
+ // Note: tc2231 says we should fail to parse this header.
+ {
+ "\"foo; filename=bar;baz\"; filename=qux",
+ HttpContentDisposition::INLINE,
+ L"" // Firefox gets qux
+ },
+ // http://greenbytes.de/tech/tc2231/#attmissingdisposition4
+ // Note: tc2231 says we should fail to parse this header.
+ {"filename=foo.html, filename=bar.html",
+ HttpContentDisposition::INLINE,
+ L"foo.html, filename=bar.html"},
+ // http://greenbytes.de/tech/tc2231/#emptydisposition
+ // Note: tc2231 says we should fail to parse this header.
+ {"; filename=foo.html", HttpContentDisposition::INLINE, L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attandinline
+ // Note: tc2231 says we should fail to parse this header.
+ {"inline; attachment; filename=foo.html",
+ HttpContentDisposition::INLINE,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attandinline2
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; inline; filename=foo.html",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=\"foo.html\".txt",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html\".txt"},
+ // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn2
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=\"bar",
+ HttpContentDisposition::ATTACHMENT,
+ L"bar"},
+ // http://greenbytes.de/tech/tc2231/#attbrokenquotedfn3
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo\"bar;baz\"qux",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo\"bar;baz\"qux"},
+ // http://greenbytes.de/tech/tc2231/#attmultinstances
+ // Note: tc2231 says we should fail to parse this header.
+ {"attachment; filename=foo.html, attachment; filename=bar.html",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html, attachment"},
+ // http://greenbytes.de/tech/tc2231/#attmissingdelim
+ {"attachment; foo=foo filename=bar",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attreversed
+ // Note: tc2231 says we should fail to parse this header.
+ {"filename=foo.html; attachment",
+ HttpContentDisposition::INLINE,
+ L"foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attconfusedparam
+ {"attachment; xfilename=foo.html",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attabspath
+ {"attachment; filename=\"/foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"/foo.html"},
+ // http://greenbytes.de/tech/tc2231/#attabspathwin
+ {"attachment; filename=\"\\\\foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"\\foo.html"},
+ // http://greenbytes.de/tech/tc2231/#dispext
+ {"foobar", HttpContentDisposition::ATTACHMENT, L""},
+ // http://greenbytes.de/tech/tc2231/#dispextbadfn
+ {"attachment; example=\"filename=example.txt\"",
+ HttpContentDisposition::ATTACHMENT,
+ L""},
+ // http://greenbytes.de/tech/tc2231/#attnewandfn
+ {"attachment; foobar=x; filename=\"foo.html\"",
+ HttpContentDisposition::ATTACHMENT,
+ L"foo.html"},
+ // TODO(abarth): Add the filename* tests, but check
+ // HttpContentDispositionTest.Filename for overlap.
+ // TODO(abarth): http://greenbytes.de/tech/tc2231/#attrfc2047token
+ // TODO(abarth): http://greenbytes.de/tech/tc2231/#attrfc2047quoted
};
for (size_t i = 0; i < arraysize(tests); ++i) {
HttpContentDisposition header(tests[i].header, std::string());
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 4ff037b..639db9f 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -30,17 +30,19 @@
#include "net/socket/ssl_client_socket.h"
#include "net/spdy/spdy_session_pool.h"
+namespace net {
+
namespace {
-net::ClientSocketPoolManager* CreateSocketPoolManager(
- net::HttpNetworkSession::SocketPoolType pool_type,
- const net::HttpNetworkSession::Params& params) {
+ClientSocketPoolManager* CreateSocketPoolManager(
+ HttpNetworkSession::SocketPoolType pool_type,
+ const HttpNetworkSession::Params& params) {
// TODO(yutak): Differentiate WebSocket pool manager and allow more
// simultaneous connections for WebSockets.
- return new net::ClientSocketPoolManagerImpl(
- params.net_log, params.client_socket_factory
- ? params.client_socket_factory
- : net::ClientSocketFactory::GetDefaultFactory(),
+ return new ClientSocketPoolManagerImpl(
+ params.net_log,
+ params.client_socket_factory ? params.client_socket_factory
+ : ClientSocketFactory::GetDefaultFactory(),
params.host_resolver, params.cert_verifier, params.channel_id_service,
params.transport_security_state, params.cert_transparency_verifier,
params.cert_policy_enforcer, params.ssl_session_cache_shard,
@@ -49,8 +51,6 @@
} // unnamed namespace
-namespace net {
-
// The maximum receive window sizes for HTTP/2 sessions and streams.
const int32 kSpdySessionMaxRecvWindowSize = 10 * 1024 * 1024; // 10 MB
const int32 kSpdyStreamMaxRecvWindowSize = 10 * 1024 * 1024; // 10 MB
@@ -124,7 +124,7 @@
params.host_resolver,
params.client_socket_factory
? params.client_socket_factory
- : net::ClientSocketFactory::GetDefaultFactory(),
+ : ClientSocketFactory::GetDefaultFactory(),
params.http_server_properties,
params.cert_verifier,
params.channel_id_service,
@@ -323,4 +323,4 @@
return NULL;
}
-} // namespace net
+} // namespace net
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index a1bba94e..44e200c 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -82,6 +82,8 @@
//-----------------------------------------------------------------------------
+namespace net {
+
namespace {
const base::string16 kBar(ASCIIToUTF16("bar"));
@@ -97,19 +99,19 @@
const base::string16 kTestingNTLM(ASCIIToUTF16("testing-ntlm"));
const base::string16 kWrongPassword(ASCIIToUTF16("wrongpassword"));
-int GetIdleSocketCountInTransportSocketPool(net::HttpNetworkSession* session) {
- return session->GetTransportSocketPool(
- net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount();
+int GetIdleSocketCountInTransportSocketPool(HttpNetworkSession* session) {
+ return session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)
+ ->IdleSocketCount();
}
-int GetIdleSocketCountInSSLSocketPool(net::HttpNetworkSession* session) {
- return session->GetSSLSocketPool(
- net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IdleSocketCount();
+int GetIdleSocketCountInSSLSocketPool(HttpNetworkSession* session) {
+ return session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)
+ ->IdleSocketCount();
}
-bool IsTransportSocketPoolStalled(net::HttpNetworkSession* session) {
- return session->GetTransportSocketPool(
- net::HttpNetworkSession::NORMAL_SOCKET_POOL)->IsStalled();
+bool IsTransportSocketPoolStalled(HttpNetworkSession* session) {
+ return session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)
+ ->IsStalled();
}
// Takes in a Value created from a NetLogHttpResponseParameter, and returns
@@ -129,14 +131,14 @@
// Tests LoadTimingInfo in the case a socket is reused and no PAC script is
// used.
-void TestLoadTimingReused(const net::LoadTimingInfo& load_timing_info) {
+void TestLoadTimingReused(const LoadTimingInfo& load_timing_info) {
EXPECT_TRUE(load_timing_info.socket_reused);
- EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
+ EXPECT_NE(NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
- net::ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
+ ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
EXPECT_FALSE(load_timing_info.send_start.is_null());
EXPECT_LE(load_timing_info.send_start, load_timing_info.send_end);
@@ -149,16 +151,16 @@
// Tests LoadTimingInfo in the case a new socket is used and no PAC script is
// used.
-void TestLoadTimingNotReused(const net::LoadTimingInfo& load_timing_info,
+void TestLoadTimingNotReused(const LoadTimingInfo& load_timing_info,
int connect_timing_flags) {
EXPECT_FALSE(load_timing_info.socket_reused);
- EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
+ EXPECT_NE(NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
EXPECT_TRUE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_TRUE(load_timing_info.proxy_resolve_end.is_null());
- net::ExpectConnectTimingHasTimes(load_timing_info.connect_timing,
- connect_timing_flags);
+ ExpectConnectTimingHasTimes(load_timing_info.connect_timing,
+ connect_timing_flags);
EXPECT_LE(load_timing_info.connect_timing.connect_end,
load_timing_info.send_start);
@@ -172,11 +174,11 @@
// Tests LoadTimingInfo in the case a socket is reused and a PAC script is
// used.
-void TestLoadTimingReusedWithPac(const net::LoadTimingInfo& load_timing_info) {
+void TestLoadTimingReusedWithPac(const LoadTimingInfo& load_timing_info) {
EXPECT_TRUE(load_timing_info.socket_reused);
- EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
+ EXPECT_NE(NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
- net::ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
+ ExpectConnectTimingHasNoTimes(load_timing_info.connect_timing);
EXPECT_FALSE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_LE(load_timing_info.proxy_resolve_start,
@@ -193,18 +195,18 @@
// Tests LoadTimingInfo in the case a new socket is used and a PAC script is
// used.
-void TestLoadTimingNotReusedWithPac(const net::LoadTimingInfo& load_timing_info,
+void TestLoadTimingNotReusedWithPac(const LoadTimingInfo& load_timing_info,
int connect_timing_flags) {
EXPECT_FALSE(load_timing_info.socket_reused);
- EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
+ EXPECT_NE(NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
EXPECT_FALSE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_LE(load_timing_info.proxy_resolve_start,
load_timing_info.proxy_resolve_end);
EXPECT_LE(load_timing_info.proxy_resolve_end,
load_timing_info.connect_timing.connect_start);
- net::ExpectConnectTimingHasTimes(load_timing_info.connect_timing,
- connect_timing_flags);
+ ExpectConnectTimingHasTimes(load_timing_info.connect_timing,
+ connect_timing_flags);
EXPECT_LE(load_timing_info.connect_timing.connect_end,
load_timing_info.send_start);
@@ -216,7 +218,7 @@
EXPECT_TRUE(load_timing_info.receive_headers_end.is_null());
}
-void AddWebSocketHeaders(net::HttpRequestHeaders* headers) {
+void AddWebSocketHeaders(HttpRequestHeaders* headers) {
headers->SetHeader("Connection", "Upgrade");
headers->SetHeader("Upgrade", "websocket");
headers->SetHeader("Origin", "http://www.example.org");
@@ -224,12 +226,6 @@
headers->SetHeader("Sec-WebSocket-Key", "dGhlIHNhbXBsZSBub25jZQ==");
}
-} // namespace
-
-namespace net {
-
-namespace {
-
HttpNetworkSession* CreateSession(SpdySessionDependencies* session_deps) {
return SpdySessionDependencies::SpdyCreateSession(session_deps);
}
@@ -358,7 +354,7 @@
rv = ReadTransaction(trans.get(), &out.response_data);
EXPECT_EQ(OK, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS,
@@ -1435,7 +1431,7 @@
session_deps_.socket_factory->AddSocketDataProvider(&data2);
// Preconnect a socket.
- net::SSLConfig ssl_config;
+ SSLConfig ssl_config;
session->ssl_config_service()->GetSSLConfig(&ssl_config);
session->GetNextProtos(&ssl_config.next_protos);
session->http_stream_factory()->PreconnectStreams(
@@ -1988,7 +1984,7 @@
HttpRequestInfo request;
request.method = "GET";
request.url = GURL("http://www.example.org/");
- request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
+ request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
scoped_ptr<HttpTransaction> trans(
@@ -2391,7 +2387,7 @@
request.method = "GET";
request.url = GURL("https://www.example.org/");
// when the no authentication data flag is set.
- request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
+ request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
session_deps_.proxy_service.reset(
@@ -2452,7 +2448,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -2509,7 +2505,7 @@
request.method = "GET";
request.url = GURL("https://www.example.org/");
// when the no authentication data flag is set.
- request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
+ request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
session_deps_.proxy_service.reset(
@@ -2571,7 +2567,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -2630,7 +2626,7 @@
request.url = GURL("https://www.example.org/");
// Ensure that proxy authentication is attempted even
// when the no authentication data flag is set.
- request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
+ request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
@@ -2687,7 +2683,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -2737,7 +2733,7 @@
request.url = GURL("https://www.example.org/");
// Ensure that proxy authentication is attempted even
// when the no authentication data flag is set.
- request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
+ request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against proxy server "myproxy:70".
session_deps_.proxy_service.reset(ProxyService::CreateFixed("myproxy:70"));
@@ -2792,7 +2788,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -3055,7 +3051,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(ERR_UNEXPECTED_PROXY_AUTH, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -3934,7 +3930,7 @@
EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
std::string response_data;
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
EXPECT_EQ(1, trans->Read(buf.get(), 256, callback.callback()));
scoped_ptr<HttpTransaction> trans2(
@@ -4068,7 +4064,7 @@
EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
std::string response_data;
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
EXPECT_EQ(1, trans->Read(buf.get(), 256, callback.callback()));
trans.reset();
@@ -4179,7 +4175,7 @@
EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
std::string response_data;
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
EXPECT_EQ(ERR_IO_PENDING, trans->Read(buf.get(), 256, callback.callback()));
spdy_data.RunFor(1);
EXPECT_EQ(1, callback.WaitForResult());
@@ -4213,7 +4209,7 @@
request.method = "GET";
request.url = GURL("http://www.example.org/");
// when the no authentication data flag is set.
- request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
+ request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against https proxy server "myproxy:70".
session_deps_.proxy_service.reset(
@@ -6566,7 +6562,7 @@
EXPECT_TRUE(trans->GetLoadTimingInfo(&load_timing_info));
EXPECT_FALSE(load_timing_info.socket_reused);
- EXPECT_NE(net::NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
+ EXPECT_NE(NetLog::Source::kInvalidId, load_timing_info.socket_log_id);
EXPECT_FALSE(load_timing_info.proxy_resolve_start.is_null());
EXPECT_LE(load_timing_info.proxy_resolve_start,
@@ -6759,7 +6755,7 @@
request.method = "GET";
request.url = GURL("https://www.example.org/");
// when the no authentication data flag is set.
- request.load_flags = net::LOAD_DO_NOT_SEND_AUTH_DATA;
+ request.load_flags = LOAD_DO_NOT_SEND_AUTH_DATA;
// Configure against https proxy server "myproxy:70".
session_deps_.proxy_service.reset(
@@ -6845,7 +6841,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -10909,7 +10905,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(OK, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -10983,7 +10979,7 @@
rv = callback1.WaitForResult();
EXPECT_EQ(ERR_EMPTY_RESPONSE, rv);
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
size_t pos = ExpectLogContainsSomewhere(
entries, 0, NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
@@ -11048,17 +11044,16 @@
// call and verify that the HttpTransaction fails with that error.
void HttpNetworkTransactionTest::CheckErrorIsPassedBack(
int error, IoMode mode) {
- net::HttpRequestInfo request_info;
+ HttpRequestInfo request_info;
request_info.url = GURL("https://www.example.com/");
request_info.method = "GET";
- request_info.load_flags = net::LOAD_NORMAL;
+ request_info.load_flags = LOAD_NORMAL;
SSLSocketDataProvider ssl_data(mode, OK);
- net::MockWrite data_writes[] = {
- net::MockWrite(mode, error),
+ MockWrite data_writes[] = {
+ MockWrite(mode, error),
};
- net::StaticSocketDataProvider data(NULL, 0,
- data_writes, arraysize(data_writes));
+ StaticSocketDataProvider data(NULL, 0, data_writes, arraysize(data_writes));
session_deps_.socket_factory->AddSocketDataProvider(&data);
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data);
@@ -11067,8 +11062,8 @@
new HttpNetworkTransaction(DEFAULT_PRIORITY, session.get()));
TestCompletionCallback callback;
- int rv = trans->Start(&request_info, callback.callback(), net::BoundNetLog());
- if (rv == net::ERR_IO_PENDING)
+ int rv = trans->Start(&request_info, callback.callback(), BoundNetLog());
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
ASSERT_EQ(error, rv);
}
@@ -11094,10 +11089,10 @@
// 4) The client supplies an invalid/unacceptable certificate.
TEST_P(HttpNetworkTransactionTest,
ClientAuthCertCache_Direct_NoFalseStart) {
- net::HttpRequestInfo request_info;
+ HttpRequestInfo request_info;
request_info.url = GURL("https://www.example.com/");
request_info.method = "GET";
- request_info.load_flags = net::LOAD_NORMAL;
+ request_info.load_flags = LOAD_NORMAL;
scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo());
cert_request->host_and_port = HostPortPair("www.example.com", 443);
@@ -11105,10 +11100,10 @@
// [ssl_]data1 contains the data for the first SSL handshake. When a
// CertificateRequest is received for the first time, the handshake will
// be aborted to allow the caller to provide a certificate.
- SSLSocketDataProvider ssl_data1(ASYNC, net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED);
+ SSLSocketDataProvider ssl_data1(ASYNC, ERR_SSL_CLIENT_AUTH_CERT_NEEDED);
ssl_data1.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data1);
- net::StaticSocketDataProvider data1(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data1(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data1);
// [ssl_]data2 contains the data for the second SSL handshake. When TLS
@@ -11117,10 +11112,10 @@
// matches the result of a server sending a handshake_failure alert,
// rather than a Finished message, because it requires a client
// certificate and none was supplied.
- SSLSocketDataProvider ssl_data2(ASYNC, net::ERR_SSL_PROTOCOL_ERROR);
+ SSLSocketDataProvider ssl_data2(ASYNC, ERR_SSL_PROTOCOL_ERROR);
ssl_data2.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data2);
- net::StaticSocketDataProvider data2(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data2(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data2);
// [ssl_]data3 contains the data for the third SSL handshake. When a
@@ -11130,10 +11125,10 @@
// of the HttpNetworkTransaction. Because this test failure is due to
// requiring a client certificate, this fallback handshake should also
// fail.
- SSLSocketDataProvider ssl_data3(ASYNC, net::ERR_SSL_PROTOCOL_ERROR);
+ SSLSocketDataProvider ssl_data3(ASYNC, ERR_SSL_PROTOCOL_ERROR);
ssl_data3.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data3);
- net::StaticSocketDataProvider data3(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data3(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data3);
// [ssl_]data4 contains the data for the fourth SSL handshake. When a
@@ -11143,17 +11138,17 @@
// of the HttpNetworkTransaction. Because this test failure is due to
// requiring a client certificate, this fallback handshake should also
// fail.
- SSLSocketDataProvider ssl_data4(ASYNC, net::ERR_SSL_PROTOCOL_ERROR);
+ SSLSocketDataProvider ssl_data4(ASYNC, ERR_SSL_PROTOCOL_ERROR);
ssl_data4.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4);
- net::StaticSocketDataProvider data4(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data4(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data4);
// Need one more if TLSv1.2 is enabled.
- SSLSocketDataProvider ssl_data5(ASYNC, net::ERR_SSL_PROTOCOL_ERROR);
+ SSLSocketDataProvider ssl_data5(ASYNC, ERR_SSL_PROTOCOL_ERROR);
ssl_data5.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data5);
- net::StaticSocketDataProvider data5(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data5(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data5);
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -11162,20 +11157,20 @@
// Begin the SSL handshake with the peer. This consumes ssl_data1.
TestCompletionCallback callback;
- int rv = trans->Start(&request_info, callback.callback(), net::BoundNetLog());
- ASSERT_EQ(net::ERR_IO_PENDING, rv);
+ int rv = trans->Start(&request_info, callback.callback(), BoundNetLog());
+ ASSERT_EQ(ERR_IO_PENDING, rv);
// Complete the SSL handshake, which should abort due to requiring a
// client certificate.
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED, rv);
+ ASSERT_EQ(ERR_SSL_CLIENT_AUTH_CERT_NEEDED, rv);
// Indicate that no certificate should be supplied. From the perspective
// of SSLClientCertCache, NULL is just as meaningful as a real
// certificate, so this is the same as supply a
// legitimate-but-unacceptable certificate.
rv = trans->RestartWithCertificate(NULL, callback.callback());
- ASSERT_EQ(net::ERR_IO_PENDING, rv);
+ ASSERT_EQ(ERR_IO_PENDING, rv);
// Ensure the certificate was added to the client auth cache before
// allowing the connection to continue restarting.
@@ -11188,7 +11183,7 @@
// then consume ssl_data3 and ssl_data4, both of which should also fail.
// The result code is checked against what ssl_data4 should return.
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_SSL_PROTOCOL_ERROR, rv);
+ ASSERT_EQ(ERR_SSL_PROTOCOL_ERROR, rv);
// Ensure that the client certificate is removed from the cache on a
// handshake failure.
@@ -11204,10 +11199,10 @@
// 4) The client supplies an invalid/unacceptable certificate.
TEST_P(HttpNetworkTransactionTest,
ClientAuthCertCache_Direct_FalseStart) {
- net::HttpRequestInfo request_info;
+ HttpRequestInfo request_info;
request_info.url = GURL("https://www.example.com/");
request_info.method = "GET";
- request_info.load_flags = net::LOAD_NORMAL;
+ request_info.load_flags = LOAD_NORMAL;
scoped_refptr<SSLCertRequestInfo> cert_request(new SSLCertRequestInfo());
cert_request->host_and_port = HostPortPair("www.example.com", 443);
@@ -11227,10 +11222,10 @@
// Like the non-False Start case, when a client certificate is requested by
// the peer, the handshake is aborted during the Connect() call.
// [ssl_]data1 represents the initial SSL handshake with the peer.
- SSLSocketDataProvider ssl_data1(ASYNC, net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED);
+ SSLSocketDataProvider ssl_data1(ASYNC, ERR_SSL_CLIENT_AUTH_CERT_NEEDED);
ssl_data1.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data1);
- net::StaticSocketDataProvider data1(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data1(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data1);
// When a client certificate is supplied, Connect() will not be aborted
@@ -11240,41 +11235,37 @@
// called, which then detects that the handshake was aborted, due to the
// peer sending a handshake_failure because it requires a client
// certificate.
- SSLSocketDataProvider ssl_data2(ASYNC, net::OK);
+ SSLSocketDataProvider ssl_data2(ASYNC, OK);
ssl_data2.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data2);
- net::MockRead data2_reads[] = {
- net::MockRead(ASYNC /* async */, net::ERR_SSL_PROTOCOL_ERROR),
+ MockRead data2_reads[] = {
+ MockRead(ASYNC /* async */, ERR_SSL_PROTOCOL_ERROR),
};
- net::StaticSocketDataProvider data2(
- data2_reads, arraysize(data2_reads), NULL, 0);
+ StaticSocketDataProvider data2(data2_reads, arraysize(data2_reads), NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data2);
// As described in ClientAuthCertCache_Direct_NoFalseStart, [ssl_]data3 is
// the data for the SSL handshake once the TLSv1.1 connection falls back to
// TLSv1. It has the same behaviour as [ssl_]data2.
- SSLSocketDataProvider ssl_data3(ASYNC, net::OK);
+ SSLSocketDataProvider ssl_data3(ASYNC, OK);
ssl_data3.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data3);
- net::StaticSocketDataProvider data3(
- data2_reads, arraysize(data2_reads), NULL, 0);
+ StaticSocketDataProvider data3(data2_reads, arraysize(data2_reads), NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data3);
// [ssl_]data4 is the data for the SSL handshake once the TLSv1 connection
// falls back to SSLv3. It has the same behaviour as [ssl_]data2.
- SSLSocketDataProvider ssl_data4(ASYNC, net::OK);
+ SSLSocketDataProvider ssl_data4(ASYNC, OK);
ssl_data4.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data4);
- net::StaticSocketDataProvider data4(
- data2_reads, arraysize(data2_reads), NULL, 0);
+ StaticSocketDataProvider data4(data2_reads, arraysize(data2_reads), NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data4);
// Need one more if TLSv1.2 is enabled.
- SSLSocketDataProvider ssl_data5(ASYNC, net::OK);
+ SSLSocketDataProvider ssl_data5(ASYNC, OK);
ssl_data5.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data5);
- net::StaticSocketDataProvider data5(
- data2_reads, arraysize(data2_reads), NULL, 0);
+ StaticSocketDataProvider data5(data2_reads, arraysize(data2_reads), NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data5);
scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps_));
@@ -11283,20 +11274,20 @@
// Begin the initial SSL handshake.
TestCompletionCallback callback;
- int rv = trans->Start(&request_info, callback.callback(), net::BoundNetLog());
- ASSERT_EQ(net::ERR_IO_PENDING, rv);
+ int rv = trans->Start(&request_info, callback.callback(), BoundNetLog());
+ ASSERT_EQ(ERR_IO_PENDING, rv);
// Complete the SSL handshake, which should abort due to requiring a
// client certificate.
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED, rv);
+ ASSERT_EQ(ERR_SSL_CLIENT_AUTH_CERT_NEEDED, rv);
// Indicate that no certificate should be supplied. From the perspective
// of SSLClientCertCache, NULL is just as meaningful as a real
// certificate, so this is the same as supply a
// legitimate-but-unacceptable certificate.
rv = trans->RestartWithCertificate(NULL, callback.callback());
- ASSERT_EQ(net::ERR_IO_PENDING, rv);
+ ASSERT_EQ(ERR_IO_PENDING, rv);
// Ensure the certificate was added to the client auth cache before
// allowing the connection to continue restarting.
@@ -11309,7 +11300,7 @@
// then consume ssl_data3 and ssl_data4, both of which should also fail.
// The result code is checked against what ssl_data4 should return.
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_SSL_PROTOCOL_ERROR, rv);
+ ASSERT_EQ(ERR_SSL_PROTOCOL_ERROR, rv);
// Ensure that the client certificate is removed from the cache on a
// handshake failure.
@@ -11338,35 +11329,35 @@
// [ssl_]data[1-3]. Rather than represending the endpoint
// (www.example.com:443), they represent failures with the HTTPS proxy
// (proxy:70).
- SSLSocketDataProvider ssl_data1(ASYNC, net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED);
+ SSLSocketDataProvider ssl_data1(ASYNC, ERR_SSL_CLIENT_AUTH_CERT_NEEDED);
ssl_data1.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data1);
- net::StaticSocketDataProvider data1(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data1(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data1);
- SSLSocketDataProvider ssl_data2(ASYNC, net::ERR_SSL_PROTOCOL_ERROR);
+ SSLSocketDataProvider ssl_data2(ASYNC, ERR_SSL_PROTOCOL_ERROR);
ssl_data2.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data2);
- net::StaticSocketDataProvider data2(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data2(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data2);
// TODO(wtc): find out why this unit test doesn't need [ssl_]data3.
#if 0
- SSLSocketDataProvider ssl_data3(ASYNC, net::ERR_SSL_PROTOCOL_ERROR);
+ SSLSocketDataProvider ssl_data3(ASYNC, ERR_SSL_PROTOCOL_ERROR);
ssl_data3.cert_request_info = cert_request.get();
session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl_data3);
- net::StaticSocketDataProvider data3(NULL, 0, NULL, 0);
+ StaticSocketDataProvider data3(NULL, 0, NULL, 0);
session_deps_.socket_factory->AddSocketDataProvider(&data3);
#endif
- net::HttpRequestInfo requests[2];
+ HttpRequestInfo requests[2];
requests[0].url = GURL("https://www.example.com/");
requests[0].method = "GET";
- requests[0].load_flags = net::LOAD_NORMAL;
+ requests[0].load_flags = LOAD_NORMAL;
requests[1].url = GURL("http://www.example.com/");
requests[1].method = "GET";
- requests[1].load_flags = net::LOAD_NORMAL;
+ requests[1].load_flags = LOAD_NORMAL;
for (size_t i = 0; i < arraysize(requests); ++i) {
session_deps_.socket_factory->ResetNextMockIndexes();
@@ -11376,21 +11367,20 @@
// Begin the SSL handshake with the proxy.
TestCompletionCallback callback;
- int rv = trans->Start(
- &requests[i], callback.callback(), net::BoundNetLog());
- ASSERT_EQ(net::ERR_IO_PENDING, rv);
+ int rv = trans->Start(&requests[i], callback.callback(), BoundNetLog());
+ ASSERT_EQ(ERR_IO_PENDING, rv);
// Complete the SSL handshake, which should abort due to requiring a
// client certificate.
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_SSL_CLIENT_AUTH_CERT_NEEDED, rv);
+ ASSERT_EQ(ERR_SSL_CLIENT_AUTH_CERT_NEEDED, rv);
// Indicate that no certificate should be supplied. From the perspective
// of SSLClientCertCache, NULL is just as meaningful as a real
// certificate, so this is the same as supply a
// legitimate-but-unacceptable certificate.
rv = trans->RestartWithCertificate(NULL, callback.callback());
- ASSERT_EQ(net::ERR_IO_PENDING, rv);
+ ASSERT_EQ(ERR_IO_PENDING, rv);
// Ensure the certificate was added to the client auth cache before
// allowing the connection to continue restarting.
@@ -11407,7 +11397,7 @@
// then consume ssl_data3, which should also fail. The result code is
// checked against what ssl_data3 should return.
rv = callback.WaitForResult();
- ASSERT_EQ(net::ERR_PROXY_CONNECTION_FAILED, rv);
+ ASSERT_EQ(ERR_PROXY_CONNECTION_FAILED, rv);
// Now that the new handshake has failed, ensure that the client
// certificate was removed from the client auth cache.
@@ -11625,7 +11615,7 @@
EXPECT_EQ("hello!", response_data);
}
-class OneTimeCachingHostResolver : public net::HostResolver {
+class OneTimeCachingHostResolver : public HostResolver {
public:
explicit OneTimeCachingHostResolver(const HostPortPair& host_port)
: host_port_(host_port) {}
@@ -13202,8 +13192,8 @@
// Preconnect an SSL socket. A preconnect is needed because connect jobs are
// cancelled when a normal transaction is cancelled.
- net::HttpStreamFactory* http_stream_factory = session->http_stream_factory();
- net::SSLConfig ssl_config;
+ HttpStreamFactory* http_stream_factory = session->http_stream_factory();
+ SSLConfig ssl_config;
session->ssl_config_service()->GetSSLConfig(&ssl_config);
http_stream_factory->PreconnectStreams(1, ssl_request, DEFAULT_PRIORITY,
ssl_config, ssl_config);
diff --git a/net/http/http_proxy_client_socket_pool_unittest.cc b/net/http/http_proxy_client_socket_pool_unittest.cc
index 2dd9bae..fffb897f 100644
--- a/net/http/http_proxy_client_socket_pool_unittest.cc
+++ b/net/http/http_proxy_client_socket_pool_unittest.cc
@@ -120,8 +120,8 @@
const ProxyInfo& proxy_info,
HttpRequestHeaders* headers) override {}
- void OnBeforeTunnelRequest(const net::HostPortPair& proxy_server,
- net::HttpRequestHeaders* extra_headers) override {
+ void OnBeforeTunnelRequest(const HostPortPair& proxy_server,
+ HttpRequestHeaders* extra_headers) override {
on_before_tunnel_request_called_ = true;
if (extra_headers) {
extra_headers->SetHeader("Foo", proxy_server.ToString());
@@ -129,9 +129,9 @@
}
void OnTunnelHeadersReceived(
- const net::HostPortPair& origin,
- const net::HostPortPair& proxy_server,
- const net::HttpResponseHeaders& response_headers) override {
+ const HostPortPair& origin,
+ const HostPortPair& proxy_server,
+ const HttpResponseHeaders& response_headers) override {
on_tunnel_headers_received_called_ = true;
on_tunnel_headers_received_origin_ = origin;
on_tunnel_headers_received_proxy_server_ = proxy_server;
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index 81bd5a3..c3aff96e 100644
--- a/net/http/http_response_headers_unittest.cc
+++ b/net/http/http_response_headers_unittest.cc
@@ -15,14 +15,16 @@
#include "net/http/http_response_headers.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
struct TestData {
const char* raw_headers;
const char* expected_headers;
int expected_response_code;
- net::HttpVersion expected_parsed_version;
- net::HttpVersion expected_version;
+ HttpVersion expected_parsed_version;
+ HttpVersion expected_version;
};
class HttpResponseHeadersTest : public testing::Test {
@@ -50,10 +52,10 @@
raw_headers += cache_control;
raw_headers += "\n";
HeadersToRaw(&raw_headers);
- headers_ = new net::HttpResponseHeaders(raw_headers);
+ headers_ = new HttpResponseHeaders(raw_headers);
}
- const scoped_refptr<net::HttpResponseHeaders>& headers() { return headers_; }
+ const scoped_refptr<HttpResponseHeaders>& headers() { return headers_; }
// Return a pointer to a TimeDelta object. For use when the value doesn't
// matter.
@@ -79,7 +81,7 @@
}
private:
- scoped_refptr<net::HttpResponseHeaders> headers_;
+ scoped_refptr<HttpResponseHeaders> headers_;
TimeDelta delta_;
};
@@ -96,8 +98,8 @@
std::string expected_headers(test.expected_headers);
std::string headers;
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(raw_headers));
+ scoped_refptr<HttpResponseHeaders> parsed(
+ new HttpResponseHeaders(raw_headers));
parsed->GetNormalizedHeaders(&headers);
// Transform to readable output format (so it's easier to see diffs).
@@ -115,193 +117,167 @@
}
TestData response_headers_tests[] = {
- {
- // Normalise whitespace.
+ {// Normalise whitespace.
- "HTTP/1.1 202 Accepted \n"
- "Content-TYPE : text/html; charset=utf-8 \n"
- "Set-Cookie: a \n"
- "Set-Cookie: b \n",
+ "HTTP/1.1 202 Accepted \n"
+ "Content-TYPE : text/html; charset=utf-8 \n"
+ "Set-Cookie: a \n"
+ "Set-Cookie: b \n",
- "HTTP/1.1 202 Accepted\n"
- "Content-TYPE: text/html; charset=utf-8\n"
- "Set-Cookie: a, b\n",
+ "HTTP/1.1 202 Accepted\n"
+ "Content-TYPE: text/html; charset=utf-8\n"
+ "Set-Cookie: a, b\n",
- 202,
- net::HttpVersion(1,1),
- net::HttpVersion(1,1)
- },
- {
- // Normalize leading whitespace.
+ 202,
+ HttpVersion(1, 1),
+ HttpVersion(1, 1)},
+ {// Normalize leading whitespace.
- "HTTP/1.1 202 Accepted \n"
- // Starts with space -- will be skipped as invalid.
- " Content-TYPE : text/html; charset=utf-8 \n"
- "Set-Cookie: a \n"
- "Set-Cookie: b \n",
+ "HTTP/1.1 202 Accepted \n"
+ // Starts with space -- will be skipped as invalid.
+ " Content-TYPE : text/html; charset=utf-8 \n"
+ "Set-Cookie: a \n"
+ "Set-Cookie: b \n",
- "HTTP/1.1 202 Accepted\n"
- "Set-Cookie: a, b\n",
+ "HTTP/1.1 202 Accepted\n"
+ "Set-Cookie: a, b\n",
- 202,
- net::HttpVersion(1,1),
- net::HttpVersion(1,1)
- },
- {
- // Normalize blank headers.
+ 202,
+ HttpVersion(1, 1),
+ HttpVersion(1, 1)},
+ {// Normalize blank headers.
- "HTTP/1.1 200 OK\n"
- "Header1 : \n"
- "Header2: \n"
- "Header3:\n"
- "Header4\n"
- "Header5 :\n",
+ "HTTP/1.1 200 OK\n"
+ "Header1 : \n"
+ "Header2: \n"
+ "Header3:\n"
+ "Header4\n"
+ "Header5 :\n",
- "HTTP/1.1 200 OK\n"
- "Header1: \n"
- "Header2: \n"
- "Header3: \n"
- "Header5: \n",
+ "HTTP/1.1 200 OK\n"
+ "Header1: \n"
+ "Header2: \n"
+ "Header3: \n"
+ "Header5: \n",
- 200,
- net::HttpVersion(1,1),
- net::HttpVersion(1,1)
- },
- {
- // Don't believe the http/0.9 version if there are headers!
+ 200,
+ HttpVersion(1, 1),
+ HttpVersion(1, 1)},
+ {// Don't believe the http/0.9 version if there are headers!
- "hTtP/0.9 201\n"
- "Content-TYPE: text/html; charset=utf-8\n",
+ "hTtP/0.9 201\n"
+ "Content-TYPE: text/html; charset=utf-8\n",
- "HTTP/1.0 201 OK\n"
- "Content-TYPE: text/html; charset=utf-8\n",
+ "HTTP/1.0 201 OK\n"
+ "Content-TYPE: text/html; charset=utf-8\n",
- 201,
- net::HttpVersion(0,9),
- net::HttpVersion(1,0)
- },
- {
- // Accept the HTTP/0.9 version number if there are no headers.
- // This is how HTTP/0.9 responses get constructed from
- // HttpNetworkTransaction.
+ 201,
+ HttpVersion(0, 9),
+ HttpVersion(1, 0)},
+ {// Accept the HTTP/0.9 version number if there are no headers.
+ // This is how HTTP/0.9 responses get constructed from
+ // HttpNetworkTransaction.
- "hTtP/0.9 200 OK\n",
+ "hTtP/0.9 200 OK\n",
- "HTTP/0.9 200 OK\n",
+ "HTTP/0.9 200 OK\n",
- 200,
- net::HttpVersion(0,9),
- net::HttpVersion(0,9)
- },
- {
- // Add missing OK.
+ 200,
+ HttpVersion(0, 9),
+ HttpVersion(0, 9)},
+ {// Add missing OK.
- "HTTP/1.1 201\n"
- "Content-TYPE: text/html; charset=utf-8\n",
+ "HTTP/1.1 201\n"
+ "Content-TYPE: text/html; charset=utf-8\n",
- "HTTP/1.1 201 OK\n"
- "Content-TYPE: text/html; charset=utf-8\n",
+ "HTTP/1.1 201 OK\n"
+ "Content-TYPE: text/html; charset=utf-8\n",
- 201,
- net::HttpVersion(1,1),
- net::HttpVersion(1,1)
- },
- {
- // Normalize bad status line.
+ 201,
+ HttpVersion(1, 1),
+ HttpVersion(1, 1)},
+ {// Normalize bad status line.
- "SCREWED_UP_STATUS_LINE\n"
- "Content-TYPE: text/html; charset=utf-8\n",
+ "SCREWED_UP_STATUS_LINE\n"
+ "Content-TYPE: text/html; charset=utf-8\n",
- "HTTP/1.0 200 OK\n"
- "Content-TYPE: text/html; charset=utf-8\n",
+ "HTTP/1.0 200 OK\n"
+ "Content-TYPE: text/html; charset=utf-8\n",
- 200,
- net::HttpVersion(0,0), // Parse error.
- net::HttpVersion(1,0)
- },
- {
- // Normalize invalid status code.
+ 200,
+ HttpVersion(0, 0), // Parse error.
+ HttpVersion(1, 0)},
+ {// Normalize invalid status code.
- "HTTP/1.1 -1 Unknown\n",
+ "HTTP/1.1 -1 Unknown\n",
- "HTTP/1.1 200 OK\n",
+ "HTTP/1.1 200 OK\n",
- 200,
- net::HttpVersion(1,1),
- net::HttpVersion(1,1)
- },
- {
- // Normalize empty header.
+ 200,
+ HttpVersion(1, 1),
+ HttpVersion(1, 1)},
+ {// Normalize empty header.
- "",
+ "",
- "HTTP/1.0 200 OK\n",
+ "HTTP/1.0 200 OK\n",
- 200,
- net::HttpVersion(0,0), // Parse Error.
- net::HttpVersion(1,0)
- },
- {
- // Normalize headers that start with a colon.
+ 200,
+ HttpVersion(0, 0), // Parse Error.
+ HttpVersion(1, 0)},
+ {// Normalize headers that start with a colon.
- "HTTP/1.1 202 Accepted \n"
- "foo: bar\n"
- ": a \n"
- " : b\n"
- "baz: blat \n",
+ "HTTP/1.1 202 Accepted \n"
+ "foo: bar\n"
+ ": a \n"
+ " : b\n"
+ "baz: blat \n",
- "HTTP/1.1 202 Accepted\n"
- "foo: bar\n"
- "baz: blat\n",
+ "HTTP/1.1 202 Accepted\n"
+ "foo: bar\n"
+ "baz: blat\n",
- 202,
- net::HttpVersion(1,1),
- net::HttpVersion(1,1)
- },
- {
- // Normalize headers that end with a colon.
+ 202,
+ HttpVersion(1, 1),
+ HttpVersion(1, 1)},
+ {// Normalize headers that end with a colon.
- "HTTP/1.1 202 Accepted \n"
- "foo: \n"
- "bar:\n"
- "baz: blat \n"
- "zip:\n",
+ "HTTP/1.1 202 Accepted \n"
+ "foo: \n"
+ "bar:\n"
+ "baz: blat \n"
+ "zip:\n",
- "HTTP/1.1 202 Accepted\n"
- "foo: \n"
- "bar: \n"
- "baz: blat\n"
- "zip: \n",
+ "HTTP/1.1 202 Accepted\n"
+ "foo: \n"
+ "bar: \n"
+ "baz: blat\n"
+ "zip: \n",
- 202,
- net::HttpVersion(1,1),
- net::HttpVersion(1,1)
- },
- {
- // Normalize whitespace headers.
+ 202,
+ HttpVersion(1, 1),
+ HttpVersion(1, 1)},
+ {// Normalize whitespace headers.
- "\n \n",
+ "\n \n",
- "HTTP/1.0 200 OK\n",
+ "HTTP/1.0 200 OK\n",
- 200,
- net::HttpVersion(0,0), // Parse error.
- net::HttpVersion(1,0)
- },
- {
- // Consolidate Set-Cookie headers.
+ 200,
+ HttpVersion(0, 0), // Parse error.
+ HttpVersion(1, 0)},
+ {// Consolidate Set-Cookie headers.
- "HTTP/1.1 200 OK\n"
- "Set-Cookie: x=1\n"
- "Set-Cookie: y=2\n",
+ "HTTP/1.1 200 OK\n"
+ "Set-Cookie: x=1\n"
+ "Set-Cookie: y=2\n",
- "HTTP/1.1 200 OK\n"
- "Set-Cookie: x=1, y=2\n",
+ "HTTP/1.1 200 OK\n"
+ "Set-Cookie: x=1, y=2\n",
- 200,
- net::HttpVersion(1,1),
- net::HttpVersion(1,1)
- },
+ 200,
+ HttpVersion(1, 1),
+ HttpVersion(1, 1)},
};
INSTANTIATE_TEST_CASE_P(HttpResponseHeaders,
@@ -314,8 +290,7 @@
"Cache-control: private\n"
"cache-Control: no-store\n";
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
std::string value;
EXPECT_TRUE(parsed->GetNormalizedHeader("cache-control", &value));
@@ -323,7 +298,7 @@
}
struct PersistData {
- net::HttpResponseHeaders::PersistOptions options;
+ HttpResponseHeaders::PersistOptions options;
const char* raw_headers;
const char* expected_headers;
};
@@ -338,15 +313,13 @@
std::string headers = test.raw_headers;
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed1(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed1(new HttpResponseHeaders(headers));
Pickle pickle;
parsed1->Persist(&pickle, test.options);
PickleIterator iter(pickle);
- scoped_refptr<net::HttpResponseHeaders> parsed2(
- new net::HttpResponseHeaders(&iter));
+ scoped_refptr<HttpResponseHeaders> parsed2(new HttpResponseHeaders(&iter));
std::string h2;
parsed2->GetNormalizedHeaders(&h2);
@@ -354,167 +327,151 @@
}
const struct PersistData persistence_tests[] = {
- { net::HttpResponseHeaders::PERSIST_ALL,
- "HTTP/1.1 200 OK\n"
- "Cache-control:private\n"
- "cache-Control:no-store\n",
+ {HttpResponseHeaders::PERSIST_ALL,
+ "HTTP/1.1 200 OK\n"
+ "Cache-control:private\n"
+ "cache-Control:no-store\n",
- "HTTP/1.1 200 OK\n"
- "Cache-control: private, no-store\n"
- },
- { net::HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP,
- "HTTP/1.1 200 OK\n"
- "connection: keep-alive\n"
- "server: blah\n",
+ "HTTP/1.1 200 OK\n"
+ "Cache-control: private, no-store\n"},
+ {HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP,
+ "HTTP/1.1 200 OK\n"
+ "connection: keep-alive\n"
+ "server: blah\n",
- "HTTP/1.1 200 OK\n"
- "server: blah\n"
- },
- { net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE |
- net::HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP,
- "HTTP/1.1 200 OK\n"
- "fOo: 1\n"
- "Foo: 2\n"
- "Transfer-Encoding: chunked\n"
- "CoNnection: keep-alive\n"
- "cache-control: private, no-cache=\"foo\"\n",
+ "HTTP/1.1 200 OK\n"
+ "server: blah\n"},
+ {HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE |
+ HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP,
+ "HTTP/1.1 200 OK\n"
+ "fOo: 1\n"
+ "Foo: 2\n"
+ "Transfer-Encoding: chunked\n"
+ "CoNnection: keep-alive\n"
+ "cache-control: private, no-cache=\"foo\"\n",
- "HTTP/1.1 200 OK\n"
- "cache-control: private, no-cache=\"foo\"\n"
- },
- { net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private,no-cache=\"foo, bar\"\n"
- "bar",
+ "HTTP/1.1 200 OK\n"
+ "cache-control: private, no-cache=\"foo\"\n"},
+ {HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private,no-cache=\"foo, bar\"\n"
+ "bar",
- "HTTP/1.1 200 OK\n"
- "Cache-Control: private,no-cache=\"foo, bar\"\n"
- },
- // Ignore bogus no-cache value.
- { net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private,no-cache=foo\n",
+ "HTTP/1.1 200 OK\n"
+ "Cache-Control: private,no-cache=\"foo, bar\"\n"},
+ // Ignore bogus no-cache value.
+ {HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private,no-cache=foo\n",
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private,no-cache=foo\n"
- },
- // Ignore bogus no-cache value.
- { net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\n",
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private,no-cache=foo\n"},
+ // Ignore bogus no-cache value.
+ {HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\n",
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\n"
- },
- // Ignore empty no-cache value.
- { net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\"\"\n",
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\n"},
+ // Ignore empty no-cache value.
+ {HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\"\"\n",
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\"\"\n"
- },
- // Ignore wrong quotes no-cache value.
- { net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\'foo\'\n",
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\"\"\n"},
+ // Ignore wrong quotes no-cache value.
+ {HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\'foo\'\n",
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\'foo\'\n"
- },
- // Ignore unterminated quotes no-cache value.
- { net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\"foo\n",
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\'foo\'\n"},
+ // Ignore unterminated quotes no-cache value.
+ {HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\"foo\n",
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\"foo\n"
- },
- // Accept sloppy LWS.
- { net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
- "HTTP/1.1 200 OK\n"
- "Foo: 2\n"
- "Cache-Control: private, no-cache=\" foo\t, bar\"\n",
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\"foo\n"},
+ // Accept sloppy LWS.
+ {HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 2\n"
+ "Cache-Control: private, no-cache=\" foo\t, bar\"\n",
- "HTTP/1.1 200 OK\n"
- "Cache-Control: private, no-cache=\" foo\t, bar\"\n"
- },
- // Header name appears twice, separated by another header.
- { net::HttpResponseHeaders::PERSIST_ALL,
- "HTTP/1.1 200 OK\n"
- "Foo: 1\n"
- "Bar: 2\n"
- "Foo: 3\n",
+ "HTTP/1.1 200 OK\n"
+ "Cache-Control: private, no-cache=\" foo\t, bar\"\n"},
+ // Header name appears twice, separated by another header.
+ {HttpResponseHeaders::PERSIST_ALL,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 1\n"
+ "Bar: 2\n"
+ "Foo: 3\n",
- "HTTP/1.1 200 OK\n"
- "Foo: 1, 3\n"
- "Bar: 2\n"
- },
- // Header name appears twice, separated by another header (type 2).
- { net::HttpResponseHeaders::PERSIST_ALL,
- "HTTP/1.1 200 OK\n"
- "Foo: 1, 3\n"
- "Bar: 2\n"
- "Foo: 4\n",
+ "HTTP/1.1 200 OK\n"
+ "Foo: 1, 3\n"
+ "Bar: 2\n"},
+ // Header name appears twice, separated by another header (type 2).
+ {HttpResponseHeaders::PERSIST_ALL,
+ "HTTP/1.1 200 OK\n"
+ "Foo: 1, 3\n"
+ "Bar: 2\n"
+ "Foo: 4\n",
- "HTTP/1.1 200 OK\n"
- "Foo: 1, 3, 4\n"
- "Bar: 2\n"
- },
- // Test filtering of cookie headers.
- { net::HttpResponseHeaders::PERSIST_SANS_COOKIES,
- "HTTP/1.1 200 OK\n"
- "Set-Cookie: foo=bar; httponly\n"
- "Set-Cookie: bar=foo\n"
- "Bar: 1\n"
- "Set-Cookie2: bar2=foo2\n",
+ "HTTP/1.1 200 OK\n"
+ "Foo: 1, 3, 4\n"
+ "Bar: 2\n"},
+ // Test filtering of cookie headers.
+ {HttpResponseHeaders::PERSIST_SANS_COOKIES,
+ "HTTP/1.1 200 OK\n"
+ "Set-Cookie: foo=bar; httponly\n"
+ "Set-Cookie: bar=foo\n"
+ "Bar: 1\n"
+ "Set-Cookie2: bar2=foo2\n",
- "HTTP/1.1 200 OK\n"
- "Bar: 1\n"
- },
- // Test LWS at the end of a header.
- { net::HttpResponseHeaders::PERSIST_ALL,
- "HTTP/1.1 200 OK\n"
- "Content-Length: 450 \n"
- "Content-Encoding: gzip\n",
+ "HTTP/1.1 200 OK\n"
+ "Bar: 1\n"},
+ // Test LWS at the end of a header.
+ {HttpResponseHeaders::PERSIST_ALL,
+ "HTTP/1.1 200 OK\n"
+ "Content-Length: 450 \n"
+ "Content-Encoding: gzip\n",
- "HTTP/1.1 200 OK\n"
- "Content-Length: 450\n"
- "Content-Encoding: gzip\n"
- },
- // Test LWS at the end of a header.
- { net::HttpResponseHeaders::PERSIST_RAW,
- "HTTP/1.1 200 OK\n"
- "Content-Length: 450 \n"
- "Content-Encoding: gzip\n",
+ "HTTP/1.1 200 OK\n"
+ "Content-Length: 450\n"
+ "Content-Encoding: gzip\n"},
+ // Test LWS at the end of a header.
+ {HttpResponseHeaders::PERSIST_RAW,
+ "HTTP/1.1 200 OK\n"
+ "Content-Length: 450 \n"
+ "Content-Encoding: gzip\n",
- "HTTP/1.1 200 OK\n"
- "Content-Length: 450\n"
- "Content-Encoding: gzip\n"
- },
- // Test filtering of transport security state headers.
- { net::HttpResponseHeaders::PERSIST_SANS_SECURITY_STATE,
- "HTTP/1.1 200 OK\n"
- "Strict-Transport-Security: max-age=1576800\n"
- "Bar: 1\n"
- "Public-Key-Pins: max-age=100000; "
- "pin-sha1=\"ObT42aoSpAqWdY9WfRfL7i0HsVk=\";"
- "pin-sha1=\"7kW49EVwZG0hSNx41ZO/fUPN0ek=\"",
+ "HTTP/1.1 200 OK\n"
+ "Content-Length: 450\n"
+ "Content-Encoding: gzip\n"},
+ // Test filtering of transport security state headers.
+ {HttpResponseHeaders::PERSIST_SANS_SECURITY_STATE,
+ "HTTP/1.1 200 OK\n"
+ "Strict-Transport-Security: max-age=1576800\n"
+ "Bar: 1\n"
+ "Public-Key-Pins: max-age=100000; "
+ "pin-sha1=\"ObT42aoSpAqWdY9WfRfL7i0HsVk=\";"
+ "pin-sha1=\"7kW49EVwZG0hSNx41ZO/fUPN0ek=\"",
- "HTTP/1.1 200 OK\n"
- "Bar: 1\n"
- },
+ "HTTP/1.1 200 OK\n"
+ "Bar: 1\n"},
};
INSTANTIATE_TEST_CASE_P(HttpResponseHeaders,
@@ -529,8 +486,7 @@
"Cache-control:private , no-cache=\"set-cookie,server\" \n"
"cache-Control: no-store\n";
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
void* iter = NULL;
std::string value;
@@ -551,8 +507,7 @@
"WWW-Authenticate:Digest realm=foobar, nonce=x, domain=y\n"
"WWW-Authenticate:Basic realm=quatar\n";
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
void* iter = NULL;
std::string value;
@@ -571,8 +526,7 @@
"Date: Tue, 07 Aug 2007 23:10:55 GMT\n"
"Last-Modified: Wed, 01 Aug 2007 23:23:45 GMT\n";
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
std::string value;
EXPECT_TRUE(parsed->EnumerateHeader(NULL, "date", &value));
@@ -590,8 +544,7 @@
"Last-Modified: Tue, 07 Aug 2007 19:10:55 EDT\n"
"Expires: Tue, 07 Aug 2007 23:10:55 UTC\n";
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
base::Time expected_value;
ASSERT_TRUE(base::Time::FromString("Tue, 07 Aug 2007 23:10:55 GMT",
&expected_value));
@@ -630,8 +583,7 @@
std::string headers(test.raw_headers);
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
std::string value;
EXPECT_EQ(test.has_mimetype, parsed->GetMimeType(&value));
@@ -778,11 +730,6 @@
ContentTypeTest,
testing::ValuesIn(mimetype_tests));
-using net::ValidationType;
-using net::VALIDATION_NONE;
-using net::VALIDATION_SYNCHRONOUS;
-using net::VALIDATION_ASYNCHRONOUS;
-
struct RequiresValidationTestData {
const char* headers;
ValidationType validation_type;
@@ -803,8 +750,7 @@
std::string headers(test.headers);
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
ValidationType validation_type =
parsed->RequiresValidation(request_time, response_time, current_time);
@@ -1021,13 +967,13 @@
std::string orig_headers(test.orig_headers);
HeadersToRaw(&orig_headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(orig_headers));
+ scoped_refptr<HttpResponseHeaders> parsed(
+ new HttpResponseHeaders(orig_headers));
std::string new_headers(test.new_headers);
HeadersToRaw(&new_headers);
- scoped_refptr<net::HttpResponseHeaders> new_parsed(
- new net::HttpResponseHeaders(new_headers));
+ scoped_refptr<HttpResponseHeaders> new_parsed(
+ new HttpResponseHeaders(new_headers));
parsed->Update(*new_parsed.get());
@@ -1136,8 +1082,7 @@
std::string headers(test.headers);
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
std::string name, value, lines;
@@ -1196,8 +1141,7 @@
std::string headers(test.headers);
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
std::string location;
EXPECT_EQ(parsed->IsRedirect(&location), test.is_redirect);
@@ -1283,8 +1227,7 @@
std::string headers(test.headers);
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
EXPECT_EQ(test.expected_len, parsed->GetContentLength());
}
@@ -1382,8 +1325,7 @@
std::string headers(test.headers);
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
int64 first_byte_position;
int64 last_byte_position;
@@ -1659,8 +1601,7 @@
std::string headers(test.headers);
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
EXPECT_EQ(test.expected_keep_alive, parsed->IsKeepAlive());
}
@@ -1820,8 +1761,7 @@
std::string headers(test.headers);
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
EXPECT_EQ(test.expected_result, parsed->HasStrongValidators());
}
@@ -1879,16 +1819,14 @@
TEST(HttpResponseHeadersTest, GetStatusText) {
std::string headers("HTTP/1.1 404 Not Found");
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
EXPECT_EQ(std::string("Not Found"), parsed->GetStatusText());
}
TEST(HttpResponseHeadersTest, GetStatusTextMissing) {
std::string headers("HTTP/1.1 404");
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
// Since the status line gets normalized, we have OK.
EXPECT_EQ(std::string("OK"), parsed->GetStatusText());
}
@@ -1896,16 +1834,14 @@
TEST(HttpResponseHeadersTest, GetStatusTextMultiSpace) {
std::string headers("HTTP/1.0 404 Not Found");
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
EXPECT_EQ(std::string("Not Found"), parsed->GetStatusText());
}
TEST(HttpResponseHeadersTest, GetStatusBadStatusLine) {
std::string headers("Foo bar.");
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
// The bad status line would have gotten rewritten as
// HTTP/1.0 200 OK.
EXPECT_EQ(std::string("OK"), parsed->GetStatusText());
@@ -1927,8 +1863,8 @@
std::string orig_headers(test.orig_headers);
HeadersToRaw(&orig_headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(orig_headers));
+ scoped_refptr<HttpResponseHeaders> parsed(
+ new HttpResponseHeaders(orig_headers));
std::string new_header(test.new_header);
parsed->AddHeader(new_header);
@@ -1983,8 +1919,8 @@
std::string orig_headers(test.orig_headers);
HeadersToRaw(&orig_headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(orig_headers));
+ scoped_refptr<HttpResponseHeaders> parsed(
+ new HttpResponseHeaders(orig_headers));
std::string name(test.to_remove);
parsed->RemoveHeader(name);
@@ -2040,8 +1976,8 @@
std::string orig_headers(test.orig_headers);
HeadersToRaw(&orig_headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(orig_headers));
+ scoped_refptr<HttpResponseHeaders> parsed(
+ new HttpResponseHeaders(orig_headers));
std::string name(test.to_remove_name);
std::string value(test.to_remove_value);
@@ -2144,8 +2080,8 @@
std::string orig_headers(test.orig_headers);
HeadersToRaw(&orig_headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(orig_headers));
+ scoped_refptr<HttpResponseHeaders> parsed(
+ new HttpResponseHeaders(orig_headers));
std::string name(test.new_status);
parsed->ReplaceStatusLine(name);
@@ -2208,12 +2144,12 @@
TEST_P(UpdateWithNewRangeTest, UpdateWithNewRange) {
const UpdateWithNewRangeTestData test = GetParam();
- const net::HttpByteRange range = net::HttpByteRange::Bounded(3, 5);
+ const HttpByteRange range = HttpByteRange::Bounded(3, 5);
std::string orig_headers(test.orig_headers);
std::replace(orig_headers.begin(), orig_headers.end(), '\n', '\0');
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(orig_headers + '\0'));
+ scoped_refptr<HttpResponseHeaders> parsed(
+ new HttpResponseHeaders(orig_headers + '\0'));
int64 content_size = parsed->GetContentLength();
std::string resulting_headers;
@@ -2263,15 +2199,14 @@
"Content-Length: 450\n"
"Connection: keep-alive\n");
HeadersToRaw(&headers);
- scoped_refptr<net::HttpResponseHeaders> parsed(
- new net::HttpResponseHeaders(headers));
+ scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers));
scoped_ptr<base::Value> event_param(parsed->NetLogCallback(
- net::NetLogCaptureMode::IncludeCookiesAndCredentials()));
- scoped_refptr<net::HttpResponseHeaders> recreated;
+ NetLogCaptureMode::IncludeCookiesAndCredentials()));
+ scoped_refptr<HttpResponseHeaders> recreated;
- ASSERT_TRUE(net::HttpResponseHeaders::FromNetLogParam(event_param.get(),
- &recreated));
+ ASSERT_TRUE(
+ HttpResponseHeaders::FromNetLogParam(event_param.get(), &recreated));
ASSERT_TRUE(recreated.get());
EXPECT_EQ(parsed->GetHttpVersion(), recreated->GetHttpVersion());
EXPECT_EQ(parsed->response_code(), recreated->response_code());
@@ -2396,4 +2331,6 @@
EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue());
}
-} // end namespace
+} // namespace
+
+} // namespace net
diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc
index eb4b3c5..ba118ac6 100644
--- a/net/http/http_response_info.cc
+++ b/net/http/http_response_info.cc
@@ -324,17 +324,16 @@
pickle->WriteInt64(request_time.ToInternalValue());
pickle->WriteInt64(response_time.ToInternalValue());
- net::HttpResponseHeaders::PersistOptions persist_options =
- net::HttpResponseHeaders::PERSIST_RAW;
+ HttpResponseHeaders::PersistOptions persist_options =
+ HttpResponseHeaders::PERSIST_RAW;
if (skip_transient_headers) {
- persist_options =
- net::HttpResponseHeaders::PERSIST_SANS_COOKIES |
- net::HttpResponseHeaders::PERSIST_SANS_CHALLENGES |
- net::HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP |
- net::HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE |
- net::HttpResponseHeaders::PERSIST_SANS_RANGES |
- net::HttpResponseHeaders::PERSIST_SANS_SECURITY_STATE;
+ persist_options = HttpResponseHeaders::PERSIST_SANS_COOKIES |
+ HttpResponseHeaders::PERSIST_SANS_CHALLENGES |
+ HttpResponseHeaders::PERSIST_SANS_HOP_BY_HOP |
+ HttpResponseHeaders::PERSIST_SANS_NON_CACHEABLE |
+ HttpResponseHeaders::PERSIST_SANS_RANGES |
+ HttpResponseHeaders::PERSIST_SANS_SECURITY_STATE;
}
headers->Persist(pickle, persist_options);
diff --git a/net/http/http_response_info_unittest.cc b/net/http/http_response_info_unittest.cc
index 07e4b6de..b0f91557 100644
--- a/net/http/http_response_info_unittest.cc
+++ b/net/http/http_response_info_unittest.cc
@@ -8,21 +8,25 @@
#include "net/http/http_response_headers.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
+namespace {
+
class HttpResponseInfoTest : public testing::Test {
protected:
void SetUp() override {
- response_info_.headers = new net::HttpResponseHeaders("");
+ response_info_.headers = new HttpResponseHeaders("");
}
- void PickleAndRestore(const net::HttpResponseInfo& response_info,
- net::HttpResponseInfo* restored_response_info) const {
+ void PickleAndRestore(const HttpResponseInfo& response_info,
+ HttpResponseInfo* restored_response_info) const {
Pickle pickle;
response_info.Persist(&pickle, false, false);
bool truncated = false;
restored_response_info->InitFromPickle(pickle, &truncated);
}
- net::HttpResponseInfo response_info_;
+ HttpResponseInfo response_info_;
};
TEST_F(HttpResponseInfoTest, UnusedSincePrefetchDefault) {
@@ -31,19 +35,23 @@
TEST_F(HttpResponseInfoTest, UnusedSincePrefetchCopy) {
response_info_.unused_since_prefetch = true;
- net::HttpResponseInfo response_info_clone(response_info_);
+ HttpResponseInfo response_info_clone(response_info_);
EXPECT_TRUE(response_info_clone.unused_since_prefetch);
}
TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistFalse) {
- net::HttpResponseInfo restored_response_info;
+ HttpResponseInfo restored_response_info;
PickleAndRestore(response_info_, &restored_response_info);
EXPECT_FALSE(restored_response_info.unused_since_prefetch);
}
TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistTrue) {
response_info_.unused_since_prefetch = true;
- net::HttpResponseInfo restored_response_info;
+ HttpResponseInfo restored_response_info;
PickleAndRestore(response_info_, &restored_response_info);
EXPECT_TRUE(restored_response_info.unused_since_prefetch);
}
+
+} // namespace
+
+} // namespace net
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index 11d20f61..8b3bed2 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -185,7 +185,7 @@
}
bool HttpServerPropertiesImpl::RequiresHTTP11(
- const net::HostPortPair& host_port_pair) {
+ const HostPortPair& host_port_pair) {
DCHECK(CalledOnValidThread());
if (host_port_pair.host().empty())
return false;
@@ -194,7 +194,7 @@
}
void HttpServerPropertiesImpl::SetHTTP11Required(
- const net::HostPortPair& host_port_pair) {
+ const HostPortPair& host_port_pair) {
DCHECK(CalledOnValidThread());
if (host_port_pair.host().empty())
return;
diff --git a/net/http/http_transaction_test_util.cc b/net/http/http_transaction_test_util.cc
index f3bbf98..5951a5c 100644
--- a/net/http/http_transaction_test_util.cc
+++ b/net/http/http_transaction_test_util.cc
@@ -21,6 +21,8 @@
#include "net/http/http_transaction.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
typedef base::hash_map<std::string, const MockTransaction*> MockTransactionMap;
static MockTransactionMap mock_transactions;
@@ -30,86 +32,81 @@
// 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(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.google.com/",
+ "GET",
+ base::Time(),
+ "",
+ LOAD_NORMAL,
+ "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n",
+ base::Time(),
+ "<html><body>Google Blah Blah</body></html>",
+ TEST_MODE_NORMAL,
+ NULL,
+ 0,
+ OK};
const MockTransaction kSimplePOST_Transaction = {
- "http://bugdatabase.com/edit",
- "POST",
- base::Time(),
- "",
- net::LOAD_NORMAL,
- "HTTP/1.1 200 OK",
- "",
- base::Time(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://bugdatabase.com/edit",
+ "POST",
+ base::Time(),
+ "",
+ LOAD_NORMAL,
+ "HTTP/1.1 200 OK",
+ "",
+ base::Time(),
+ "<html><body>Google Blah Blah</body></html>",
+ TEST_MODE_NORMAL,
+ NULL,
+ 0,
+ OK};
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(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.example.com/~foo/bar.html",
+ "GET",
+ base::Time(),
+ "",
+ 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(),
+ "<html><body>Google Blah Blah</body></html>",
+ TEST_MODE_NORMAL,
+ NULL,
+ 0,
+ OK};
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(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.google.com/foopy",
+ "GET",
+ base::Time(),
+ "",
+ LOAD_NORMAL,
+ "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n"
+ "Etag: \"foopy\"\n",
+ base::Time(),
+ "<html><body>Google Blah Blah</body></html>",
+ TEST_MODE_NORMAL,
+ NULL,
+ 0,
+ OK};
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(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.google.com/",
+ "GET",
+ base::Time(),
+ "Range: 0-100\r\n",
+ LOAD_NORMAL,
+ "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n",
+ base::Time(),
+ "<html><body>Google Blah Blah</body></html>",
+ TEST_MODE_NORMAL,
+ NULL,
+ 0,
+ OK};
static const MockTransaction* const kBuiltinMockTransactions[] = {
&kSimpleGET_Transaction,
@@ -154,9 +151,9 @@
int TestTransactionConsumer::quit_counter_ = 0;
TestTransactionConsumer::TestTransactionConsumer(
- net::RequestPriority priority,
- net::HttpTransactionFactory* factory)
- : state_(IDLE), error_(net::OK) {
+ RequestPriority priority,
+ HttpTransactionFactory* factory)
+ : state_(IDLE), error_(OK) {
// Disregard the error code.
factory->CreateTransaction(priority, &trans_);
++quit_counter_;
@@ -165,18 +162,18 @@
TestTransactionConsumer::~TestTransactionConsumer() {
}
-void TestTransactionConsumer::Start(const net::HttpRequestInfo* request,
- const net::BoundNetLog& net_log) {
+void TestTransactionConsumer::Start(const HttpRequestInfo* request,
+ const BoundNetLog& net_log) {
state_ = STARTING;
int result = trans_->Start(
request, base::Bind(&TestTransactionConsumer::OnIOComplete,
base::Unretained(this)), net_log);
- if (result != net::ERR_IO_PENDING)
+ if (result != ERR_IO_PENDING)
DidStart(result);
}
void TestTransactionConsumer::DidStart(int result) {
- if (result != net::OK) {
+ if (result != OK) {
DidFinish(result);
} else {
Read();
@@ -201,12 +198,12 @@
void TestTransactionConsumer::Read() {
state_ = READING;
- read_buf_ = new net::IOBuffer(1024);
+ read_buf_ = new IOBuffer(1024);
int result = trans_->Read(read_buf_.get(),
1024,
base::Bind(&TestTransactionConsumer::OnIOComplete,
base::Unretained(this)));
- if (result != net::ERR_IO_PENDING)
+ if (result != ERR_IO_PENDING)
DidRead(result);
}
@@ -223,55 +220,54 @@
}
}
-MockNetworkTransaction::MockNetworkTransaction(
- net::RequestPriority priority,
- MockNetworkLayer* factory)
+MockNetworkTransaction::MockNetworkTransaction(RequestPriority priority,
+ MockNetworkLayer* factory)
: request_(NULL),
data_cursor_(0),
priority_(priority),
websocket_handshake_stream_create_helper_(NULL),
transaction_factory_(factory->AsWeakPtr()),
received_bytes_(0),
- socket_log_id_(net::NetLog::Source::kInvalidId),
+ socket_log_id_(NetLog::Source::kInvalidId),
weak_factory_(this) {
}
MockNetworkTransaction::~MockNetworkTransaction() {}
-int MockNetworkTransaction::Start(const net::HttpRequestInfo* request,
- const net::CompletionCallback& callback,
- const net::BoundNetLog& net_log) {
+int MockNetworkTransaction::Start(const HttpRequestInfo* request,
+ const CompletionCallback& callback,
+ const BoundNetLog& net_log) {
if (request_)
- return net::ERR_FAILED;
+ return ERR_FAILED;
request_ = request;
return StartInternal(request, callback, net_log);
}
int MockNetworkTransaction::RestartIgnoringLastError(
- const net::CompletionCallback& callback) {
- return net::ERR_FAILED;
+ const CompletionCallback& callback) {
+ return ERR_FAILED;
}
int MockNetworkTransaction::RestartWithCertificate(
- net::X509Certificate* client_cert,
- const net::CompletionCallback& callback) {
- return net::ERR_FAILED;
+ X509Certificate* client_cert,
+ const CompletionCallback& callback) {
+ return ERR_FAILED;
}
int MockNetworkTransaction::RestartWithAuth(
- const net::AuthCredentials& credentials,
- const net::CompletionCallback& callback) {
+ const AuthCredentials& credentials,
+ const CompletionCallback& callback) {
if (!IsReadyToRestartForAuth())
- return net::ERR_FAILED;
+ return ERR_FAILED;
- net::HttpRequestInfo auth_request_info = *request_;
+ HttpRequestInfo auth_request_info = *request_;
auth_request_info.extra_headers.AddHeaderFromString("Authorization: Bar");
// Let the MockTransactionHandler worry about this: the only way for this
// test to succeed is by using an explicit handler for the transaction so
// that server behavior can be simulated.
- return StartInternal(&auth_request_info, callback, net::BoundNetLog());
+ return StartInternal(&auth_request_info, callback, BoundNetLog());
}
bool MockNetworkTransaction::IsReadyToRestartForAuth() {
@@ -287,8 +283,9 @@
status_line.find(" 407 ") != std::string::npos;
}
-int MockNetworkTransaction::Read(net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback) {
+int MockNetworkTransaction::Read(IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback) {
int data_len = static_cast<int>(data_.size());
int num = std::min(buf_len, data_len - data_cursor_);
if (test_mode_ & TEST_MODE_SLOW_READ)
@@ -301,7 +298,7 @@
return num;
CallbackLater(callback, num);
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
void MockNetworkTransaction::StopCaching() {
@@ -310,7 +307,7 @@
}
bool MockNetworkTransaction::GetFullRequestHeaders(
- net::HttpRequestHeaders* headers) const {
+ HttpRequestHeaders* headers) const {
return false;
}
@@ -323,26 +320,27 @@
transaction_factory_->TransactionDoneReading();
}
-const net::HttpResponseInfo* MockNetworkTransaction::GetResponseInfo() const {
+const HttpResponseInfo* MockNetworkTransaction::GetResponseInfo() const {
return &response_;
}
-net::LoadState MockNetworkTransaction::GetLoadState() const {
+LoadState MockNetworkTransaction::GetLoadState() const {
if (data_cursor_)
- return net::LOAD_STATE_READING_RESPONSE;
- return net::LOAD_STATE_IDLE;
+ return LOAD_STATE_READING_RESPONSE;
+ return LOAD_STATE_IDLE;
}
-net::UploadProgress MockNetworkTransaction::GetUploadProgress() const {
- return net::UploadProgress();
+UploadProgress MockNetworkTransaction::GetUploadProgress() const {
+ return UploadProgress();
}
void MockNetworkTransaction::SetQuicServerInfo(
- net::QuicServerInfo* quic_server_info) {}
+ QuicServerInfo* quic_server_info) {
+}
bool MockNetworkTransaction::GetLoadTimingInfo(
- net::LoadTimingInfo* load_timing_info) const {
- if (socket_log_id_ != net::NetLog::Source::kInvalidId) {
+ LoadTimingInfo* load_timing_info) const {
+ if (socket_log_id_ != NetLog::Source::kInvalidId) {
// The minimal set of times for a request that gets a response, assuming it
// gets a new socket.
load_timing_info->socket_reused = false;
@@ -362,31 +360,30 @@
return true;
}
-void MockNetworkTransaction::SetPriority(net::RequestPriority priority) {
+void MockNetworkTransaction::SetPriority(RequestPriority priority) {
priority_ = priority;
}
void MockNetworkTransaction::SetWebSocketHandshakeStreamCreateHelper(
- net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) {
+ WebSocketHandshakeStreamBase::CreateHelper* create_helper) {
websocket_handshake_stream_create_helper_ = create_helper;
}
-int MockNetworkTransaction::StartInternal(
- const net::HttpRequestInfo* request,
- const net::CompletionCallback& callback,
- const net::BoundNetLog& net_log) {
+int MockNetworkTransaction::StartInternal(const HttpRequestInfo* request,
+ const CompletionCallback& callback,
+ const BoundNetLog& net_log) {
const MockTransaction* t = FindMockTransaction(request->url);
if (!t)
- return net::ERR_FAILED;
+ return ERR_FAILED;
test_mode_ = t->test_mode;
// Return immediately if we're returning an error.
- if (net::OK != t->return_code) {
+ if (OK != t->return_code) {
if (test_mode_ & TEST_MODE_SYNC_NET_START)
return t->return_code;
CallbackLater(callback, t->return_code);
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
std::string resp_status = t->status;
@@ -411,7 +408,7 @@
if (!t->response_time.is_null())
response_.response_time = t->response_time;
- response_.headers = new net::HttpResponseHeaders(header_data);
+ response_.headers = new HttpResponseHeaders(header_data);
response_.vary_data.Init(*request, *response_.headers.get());
response_.ssl_info.cert_status = t->cert_status;
data_ = resp_data;
@@ -419,14 +416,14 @@
if (net_log.net_log())
socket_log_id_ = net_log.net_log()->NextID();
- if (request_->load_flags & net::LOAD_PREFETCH)
+ if (request_->load_flags & LOAD_PREFETCH)
response_.unused_since_prefetch = true;
if (test_mode_ & TEST_MODE_SYNC_NET_START)
- return net::OK;
+ return OK;
- CallbackLater(callback, net::OK);
- return net::ERR_IO_PENDING;
+ CallbackLater(callback, OK);
+ return ERR_IO_PENDING;
}
void MockNetworkTransaction::SetBeforeNetworkStartCallback(
@@ -439,18 +436,18 @@
int MockNetworkTransaction::ResumeNetworkStart() {
// Should not get here.
- return net::ERR_FAILED;
+ return ERR_FAILED;
}
-void MockNetworkTransaction::CallbackLater(
- const net::CompletionCallback& callback, int result) {
+void MockNetworkTransaction::CallbackLater(const CompletionCallback& callback,
+ int result) {
base::MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback,
weak_factory_.GetWeakPtr(), callback, result));
}
-void MockNetworkTransaction::RunCallback(
- const net::CompletionCallback& callback, int result) {
+void MockNetworkTransaction::RunCallback(const CompletionCallback& callback,
+ int result) {
callback.Run(result);
}
@@ -458,7 +455,7 @@
: transaction_count_(0),
done_reading_called_(false),
stop_caching_called_(false),
- last_create_transaction_priority_(net::DEFAULT_PRIORITY),
+ last_create_transaction_priority_(DEFAULT_PRIORITY),
clock_(nullptr) {
}
@@ -472,23 +469,22 @@
stop_caching_called_ = true;
}
-int MockNetworkLayer::CreateTransaction(
- net::RequestPriority priority,
- scoped_ptr<net::HttpTransaction>* trans) {
+int MockNetworkLayer::CreateTransaction(RequestPriority priority,
+ scoped_ptr<HttpTransaction>* trans) {
transaction_count_++;
last_create_transaction_priority_ = priority;
scoped_ptr<MockNetworkTransaction> mock_transaction(
new MockNetworkTransaction(priority, this));
last_transaction_ = mock_transaction->AsWeakPtr();
*trans = mock_transaction.Pass();
- return net::OK;
+ return OK;
}
-net::HttpCache* MockNetworkLayer::GetCache() {
+HttpCache* MockNetworkLayer::GetCache() {
return NULL;
}
-net::HttpNetworkSession* MockNetworkLayer::GetSession() {
+HttpNetworkSession* MockNetworkLayer::GetSession() {
return NULL;
}
@@ -506,16 +502,16 @@
//-----------------------------------------------------------------------------
// helpers
-int ReadTransaction(net::HttpTransaction* trans, std::string* result) {
+int ReadTransaction(HttpTransaction* trans, std::string* result) {
int rv;
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
std::string content;
do {
- scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
+ scoped_refptr<IOBuffer> buf(new IOBuffer(256));
rv = trans->Read(buf.get(), 256, callback.callback());
- if (rv == net::ERR_IO_PENDING)
+ if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
if (rv > 0)
@@ -525,5 +521,7 @@
} while (rv > 0);
result->swap(content);
- return net::OK;
+ return OK;
}
+
+} // namespace net
diff --git a/net/http/http_transaction_test_util.h b/net/http/http_transaction_test_util.h
index 6d968b4..e63e433 100644
--- a/net/http/http_transaction_test_util.h
+++ b/net/http/http_transaction_test_util.h
@@ -26,10 +26,10 @@
#include "net/log/net_log.h"
namespace net {
+
class HttpRequestHeaders;
class IOBuffer;
struct HttpRequestInfo;
-}
//-----------------------------------------------------------------------------
// mock transaction data
@@ -48,7 +48,7 @@
TEST_MODE_SLOW_READ = 1 << 5
};
-typedef void (*MockTransactionHandler)(const net::HttpRequestInfo* request,
+typedef void (*MockTransactionHandler)(const HttpRequestInfo* request,
std::string* response_status,
std::string* response_headers,
std::string* response_data);
@@ -67,10 +67,10 @@
const char* data;
int test_mode;
MockTransactionHandler handler;
- net::CertStatus cert_status;
+ CertStatus cert_status;
// Value returned by MockNetworkTransaction::Start (potentially
// asynchronously if |!(test_mode & TEST_MODE_SYNC_NET_START)|.)
- net::Error return_code;
+ Error return_code;
};
extern const MockTransaction kSimpleGET_Transaction;
@@ -103,7 +103,7 @@
//-----------------------------------------------------------------------------
// mock http request
-class MockHttpRequest : public net::HttpRequestInfo {
+class MockHttpRequest : public HttpRequestInfo {
public:
explicit MockHttpRequest(const MockTransaction& t);
};
@@ -113,17 +113,16 @@
class TestTransactionConsumer {
public:
- TestTransactionConsumer(net::RequestPriority priority,
- net::HttpTransactionFactory* factory);
+ TestTransactionConsumer(RequestPriority priority,
+ HttpTransactionFactory* factory);
virtual ~TestTransactionConsumer();
- void Start(const net::HttpRequestInfo* request,
- const net::BoundNetLog& net_log);
+ void Start(const HttpRequestInfo* request, const BoundNetLog& net_log);
bool is_done() const { return state_ == DONE; }
int error() const { return error_; }
- const net::HttpResponseInfo* response_info() const {
+ const HttpResponseInfo* response_info() const {
return trans_->GetResponseInfo();
}
const std::string& content() const { return content_; }
@@ -144,9 +143,9 @@
void OnIOComplete(int result);
State state_;
- scoped_ptr<net::HttpTransaction> trans_;
+ scoped_ptr<HttpTransaction> trans_;
std::string content_;
- scoped_refptr<net::IOBuffer> read_buf_;
+ scoped_refptr<IOBuffer> read_buf_;
int error_;
static int quit_counter_;
@@ -162,52 +161,51 @@
// synchronously or asynchronously to help exercise different code paths in the
// HttpCache implementation.
class MockNetworkTransaction
- : public net::HttpTransaction,
+ : public HttpTransaction,
public base::SupportsWeakPtr<MockNetworkTransaction> {
- typedef net::WebSocketHandshakeStreamBase::CreateHelper CreateHelper;
+ typedef WebSocketHandshakeStreamBase::CreateHelper CreateHelper;
+
public:
- MockNetworkTransaction(net::RequestPriority priority,
- MockNetworkLayer* factory);
+ MockNetworkTransaction(RequestPriority priority, MockNetworkLayer* factory);
~MockNetworkTransaction() override;
- int Start(const net::HttpRequestInfo* request,
- const net::CompletionCallback& callback,
- const net::BoundNetLog& net_log) override;
+ int Start(const HttpRequestInfo* request,
+ const CompletionCallback& callback,
+ const BoundNetLog& net_log) override;
- int RestartIgnoringLastError(
- const net::CompletionCallback& callback) override;
+ int RestartIgnoringLastError(const CompletionCallback& callback) override;
- int RestartWithCertificate(net::X509Certificate* client_cert,
- const net::CompletionCallback& callback) override;
+ int RestartWithCertificate(X509Certificate* client_cert,
+ const CompletionCallback& callback) override;
- int RestartWithAuth(const net::AuthCredentials& credentials,
- const net::CompletionCallback& callback) override;
+ int RestartWithAuth(const AuthCredentials& credentials,
+ const CompletionCallback& callback) override;
bool IsReadyToRestartForAuth() override;
- int Read(net::IOBuffer* buf,
+ int Read(IOBuffer* buf,
int buf_len,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
void StopCaching() override;
- bool GetFullRequestHeaders(net::HttpRequestHeaders* headers) const override;
+ bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override;
int64 GetTotalReceivedBytes() const override;
void DoneReading() override;
- const net::HttpResponseInfo* GetResponseInfo() const override;
+ const HttpResponseInfo* GetResponseInfo() const override;
- net::LoadState GetLoadState() const override;
+ LoadState GetLoadState() const override;
- net::UploadProgress GetUploadProgress() const override;
+ UploadProgress GetUploadProgress() const override;
- void SetQuicServerInfo(net::QuicServerInfo* quic_server_info) override;
+ void SetQuicServerInfo(QuicServerInfo* quic_server_info) override;
- bool GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
+ bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
- void SetPriority(net::RequestPriority priority) override;
+ void SetPriority(RequestPriority priority) override;
void SetWebSocketHandshakeStreamCreateHelper(
CreateHelper* create_helper) override;
@@ -223,22 +221,22 @@
CreateHelper* websocket_handshake_stream_create_helper() {
return websocket_handshake_stream_create_helper_;
}
- net::RequestPriority priority() const { return priority_; }
- const net::HttpRequestInfo* request() const { return request_; }
+ RequestPriority priority() const { return priority_; }
+ const HttpRequestInfo* request() const { return request_; }
private:
- int StartInternal(const net::HttpRequestInfo* request,
- const net::CompletionCallback& callback,
- const net::BoundNetLog& net_log);
- void CallbackLater(const net::CompletionCallback& callback, int result);
- void RunCallback(const net::CompletionCallback& callback, int result);
+ int StartInternal(const HttpRequestInfo* request,
+ const CompletionCallback& callback,
+ const BoundNetLog& net_log);
+ void CallbackLater(const CompletionCallback& callback, int result);
+ void RunCallback(const CompletionCallback& callback, int result);
- const net::HttpRequestInfo* request_;
- net::HttpResponseInfo response_;
+ const HttpRequestInfo* request_;
+ HttpResponseInfo response_;
std::string data_;
int data_cursor_;
int test_mode_;
- net::RequestPriority priority_;
+ RequestPriority priority_;
CreateHelper* websocket_handshake_stream_create_helper_;
base::WeakPtr<MockNetworkLayer> transaction_factory_;
int64 received_bytes_;
@@ -252,7 +250,7 @@
};
-class MockNetworkLayer : public net::HttpTransactionFactory,
+class MockNetworkLayer : public HttpTransactionFactory,
public base::SupportsWeakPtr<MockNetworkLayer> {
public:
MockNetworkLayer();
@@ -266,7 +264,7 @@
// Returns the last priority passed to CreateTransaction, or
// DEFAULT_PRIORITY if it hasn't been called yet.
- net::RequestPriority last_create_transaction_priority() const {
+ RequestPriority last_create_transaction_priority() const {
return last_create_transaction_priority_;
}
@@ -285,11 +283,11 @@
last_transaction_.reset();
}
- // net::HttpTransactionFactory:
- int CreateTransaction(net::RequestPriority priority,
- scoped_ptr<net::HttpTransaction>* trans) override;
- net::HttpCache* GetCache() override;
- net::HttpNetworkSession* GetSession() override;
+ // HttpTransactionFactory:
+ int CreateTransaction(RequestPriority priority,
+ scoped_ptr<HttpTransaction>* trans) override;
+ HttpCache* GetCache() override;
+ HttpNetworkSession* GetSession() override;
// The caller must guarantee that |clock| will outlive this object.
void SetClock(base::Clock* clock);
@@ -302,7 +300,7 @@
int transaction_count_;
bool done_reading_called_;
bool stop_caching_called_;
- net::RequestPriority last_create_transaction_priority_;
+ RequestPriority last_create_transaction_priority_;
// By default clock_ is NULL but it can be set to a custom clock by test
// frameworks using SetClock.
@@ -315,6 +313,8 @@
// helpers
// read the transaction completely
-int ReadTransaction(net::HttpTransaction* trans, std::string* result);
+int ReadTransaction(HttpTransaction* trans, std::string* result);
+
+} // namespace net
#endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 5e342270..baa2eff1 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -380,7 +380,7 @@
const char* const headers_to_remove[],
size_t headers_to_remove_len) {
std::string stripped_headers;
- net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\r\n");
+ HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\r\n");
while (it.GetNext()) {
bool should_remove = false;
@@ -711,7 +711,7 @@
std::string* headers) {
if (header_value.empty())
return;
- if (net::HttpUtil::HasHeader(*headers, header_name))
+ if (HttpUtil::HasHeader(*headers, header_name))
return;
*headers += std::string(header_name) + ": " + header_value + "\r\n";
}
diff --git a/net/http/http_util_unittest.cc b/net/http/http_util_unittest.cc
index ee501c7..3f4f625 100644
--- a/net/http/http_util_unittest.cc
+++ b/net/http/http_util_unittest.cc
@@ -9,7 +9,7 @@
#include "net/http/http_util.h"
#include "testing/gtest/include/gtest/gtest.h"
-using net::HttpUtil;
+namespace net {
namespace {
class HttpUtilTest : public testing::Test {};
@@ -730,8 +730,8 @@
std::string charset;
bool had_charset = false;
std::string boundary;
- net::HttpUtil::ParseContentType(tests[i].content_type, &mime_type,
- &charset, &had_charset, &boundary);
+ HttpUtil::ParseContentType(tests[i].content_type, &mime_type, &charset,
+ &had_charset, &boundary);
EXPECT_EQ(tests[i].expected_mime_type, mime_type) << "i=" << i;
EXPECT_EQ(tests[i].expected_charset, charset) << "i=" << i;
EXPECT_EQ(tests[i].expected_had_charset, had_charset) << "i=" << i;
@@ -854,7 +854,7 @@
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- std::vector<net::HttpByteRange> ranges;
+ std::vector<HttpByteRange> ranges;
bool return_value = HttpUtil::ParseRanges(std::string(tests[i].headers),
&ranges);
EXPECT_EQ(tests[i].expected_return_value, return_value);
@@ -993,7 +993,7 @@
ASSERT_FALSE(invalid_parser.valid());
}
-} // anonymous namespace
+} // namespace
TEST(HttpUtilTest, NameValuePairsIteratorCopyAndAssign) {
std::string data = "alpha='\\'a\\''; beta=\" b \"; cappa='c;'; delta=\"d\"";
@@ -1114,3 +1114,5 @@
ASSERT_NO_FATAL_FAILURE(CheckNextNameValuePair(
&parser, false, true, std::string(), std::string()));
}
+
+} // namespace net
diff --git a/net/http/http_vary_data_unittest.cc b/net/http/http_vary_data_unittest.cc
index 19dbbd77..c9bff65 100644
--- a/net/http/http_vary_data_unittest.cc
+++ b/net/http/http_vary_data_unittest.cc
@@ -9,19 +9,21 @@
#include "net/http/http_vary_data.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
typedef testing::Test HttpVaryDataTest;
struct TestTransaction {
- net::HttpRequestInfo request;
- scoped_refptr<net::HttpResponseHeaders> response;
+ HttpRequestInfo request;
+ scoped_refptr<HttpResponseHeaders> response;
void Init(const std::string& request_headers,
const std::string& response_headers) {
std::string temp(response_headers);
std::replace(temp.begin(), temp.end(), '\n', '\0');
- response = new net::HttpResponseHeaders(temp);
+ response = new HttpResponseHeaders(temp);
request.extra_headers.Clear();
request.extra_headers.AddHeadersFromString(request_headers);
@@ -43,7 +45,7 @@
TestTransaction t;
t.Init(std::string(), kTestResponses[i]);
- net::HttpVaryData v;
+ HttpVaryData v;
EXPECT_FALSE(v.is_valid());
EXPECT_FALSE(v.Init(t.request, *t.response.get()));
EXPECT_FALSE(v.is_valid());
@@ -51,7 +53,7 @@
}
TEST(HttpVaryDataTest, MultipleInit) {
- net::HttpVaryData v;
+ HttpVaryData v;
// Init to something valid.
TestTransaction t1;
@@ -73,7 +75,7 @@
TestTransaction b;
b.Init("Foo: 2", "HTTP/1.1 200 OK\nVary: foo\n\n");
- net::HttpVaryData v;
+ HttpVaryData v;
EXPECT_TRUE(v.Init(a.request, *a.response.get()));
EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get()));
@@ -86,7 +88,7 @@
TestTransaction b;
b.Init("Foo: 12\r\nbar: 3", "HTTP/1.1 200 OK\nVary: foo, bar\n\n");
- net::HttpVaryData v;
+ HttpVaryData v;
EXPECT_TRUE(v.Init(a.request, *a.response.get()));
EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get()));
@@ -99,7 +101,7 @@
TestTransaction b;
b.Init("Foo: 1", "HTTP/1.1 200 OK\nVary: foo\n\n");
- net::HttpVaryData v;
+ HttpVaryData v;
EXPECT_TRUE(v.Init(a.request, *a.response.get()));
EXPECT_TRUE(v.MatchesRequest(b.request, *b.response.get()));
@@ -112,7 +114,7 @@
TestTransaction b;
b.Init("Foo: 1\r\nbaR: 2", "HTTP/1.1 200 OK\nVary: foo\nVary: bar\n\n");
- net::HttpVaryData v;
+ HttpVaryData v;
EXPECT_TRUE(v.Init(a.request, *a.response.get()));
EXPECT_TRUE(v.MatchesRequest(b.request, *b.response.get()));
@@ -125,7 +127,7 @@
TestTransaction b;
b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\n\n");
- net::HttpVaryData v;
+ HttpVaryData v;
EXPECT_TRUE(v.Init(a.request, *a.response.get()));
EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get()));
@@ -140,8 +142,10 @@
TestTransaction b;
b.Init("Cookie: 2", "HTTP/1.1 301 Moved\nLocation: x\nVary: cooKie\n\n");
- net::HttpVaryData v;
+ HttpVaryData v;
EXPECT_TRUE(v.Init(a.request, *a.response.get()));
EXPECT_FALSE(v.MatchesRequest(b.request, *b.response.get()));
}
+
+} // namespace net
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc
index a423a04a..02b74bc 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -10,6 +10,8 @@
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
// We can override the test mode for a given operation by setting this global
@@ -36,7 +38,7 @@
return t->test_mode;
}
-void CallbackForwader(const net::CompletionCallback& callback, int result) {
+void CallbackForwader(const CompletionCallback& callback, int result) {
callback.Run(result);
}
@@ -46,7 +48,7 @@
struct MockDiskEntry::CallbackInfo {
scoped_refptr<MockDiskEntry> entry;
- net::CompletionCallback callback;
+ CompletionCallback callback;
int result;
};
@@ -82,17 +84,19 @@
return static_cast<int32>(data_[index].size());
}
-int MockDiskEntry::ReadData(
- int index, int offset, net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback) {
+int MockDiskEntry::ReadData(int index,
+ int offset,
+ IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback) {
DCHECK(index >= 0 && index < kNumCacheEntryDataIndices);
DCHECK(!callback.is_null());
if (fail_requests_)
- return net::ERR_CACHE_READ_FAILURE;
+ return ERR_CACHE_READ_FAILURE;
if (offset < 0 || offset > static_cast<int>(data_[index].size()))
- return net::ERR_FAILED;
+ return ERR_FAILED;
if (static_cast<size_t>(offset) == data_[index].size())
return 0;
@@ -103,23 +107,26 @@
return num;
CallbackLater(callback, num);
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
-int MockDiskEntry::WriteData(
- int index, int offset, net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback, bool truncate) {
+int MockDiskEntry::WriteData(int index,
+ int offset,
+ IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback,
+ bool truncate) {
DCHECK(index >= 0 && index < kNumCacheEntryDataIndices);
DCHECK(!callback.is_null());
DCHECK(truncate);
if (fail_requests_) {
- CallbackLater(callback, net::ERR_CACHE_READ_FAILURE);
- return net::ERR_IO_PENDING;
+ CallbackLater(callback, ERR_CACHE_READ_FAILURE);
+ return ERR_IO_PENDING;
}
if (offset < 0 || offset > static_cast<int>(data_[index].size()))
- return net::ERR_FAILED;
+ return ERR_FAILED;
data_[index].resize(offset + buf_len);
if (buf_len)
@@ -129,21 +136,23 @@
return buf_len;
CallbackLater(callback, buf_len);
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
-int MockDiskEntry::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback) {
+int MockDiskEntry::ReadSparseData(int64 offset,
+ IOBuffer* buf,
+ int buf_len,
+ const CompletionCallback& callback) {
DCHECK(!callback.is_null());
if (fail_sparse_requests_)
- return net::ERR_NOT_IMPLEMENTED;
+ return ERR_NOT_IMPLEMENTED;
if (!sparse_ || busy_)
- return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
+ return ERR_CACHE_OPERATION_NOT_SUPPORTED;
if (offset < 0)
- return net::ERR_FAILED;
+ return ERR_FAILED;
if (fail_requests_)
- return net::ERR_CACHE_READ_FAILURE;
+ return ERR_CACHE_READ_FAILURE;
DCHECK(offset < kint32max);
int real_offset = static_cast<int>(offset);
@@ -160,29 +169,30 @@
CallbackLater(callback, num);
busy_ = true;
delayed_ = false;
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
-int MockDiskEntry::WriteSparseData(int64 offset, net::IOBuffer* buf,
+int MockDiskEntry::WriteSparseData(int64 offset,
+ IOBuffer* buf,
int buf_len,
- const net::CompletionCallback& callback) {
+ const CompletionCallback& callback) {
DCHECK(!callback.is_null());
if (fail_sparse_requests_)
- return net::ERR_NOT_IMPLEMENTED;
+ return ERR_NOT_IMPLEMENTED;
if (busy_)
- return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
+ return ERR_CACHE_OPERATION_NOT_SUPPORTED;
if (!sparse_) {
if (data_[1].size())
- return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
+ return ERR_CACHE_OPERATION_NOT_SUPPORTED;
sparse_ = true;
}
if (offset < 0)
- return net::ERR_FAILED;
+ return ERR_FAILED;
if (!buf_len)
return 0;
if (fail_requests_)
- return net::ERR_CACHE_READ_FAILURE;
+ return ERR_CACHE_READ_FAILURE;
DCHECK(offset < kint32max);
int real_offset = static_cast<int>(offset);
@@ -195,19 +205,21 @@
return buf_len;
CallbackLater(callback, buf_len);
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
-int MockDiskEntry::GetAvailableRange(int64 offset, int len, int64* start,
- const net::CompletionCallback& callback) {
+int MockDiskEntry::GetAvailableRange(int64 offset,
+ int len,
+ int64* start,
+ const CompletionCallback& callback) {
DCHECK(!callback.is_null());
if (!sparse_ || busy_)
- return net::ERR_CACHE_OPERATION_NOT_SUPPORTED;
+ return ERR_CACHE_OPERATION_NOT_SUPPORTED;
if (offset < 0)
- return net::ERR_FAILED;
+ return ERR_FAILED;
if (fail_requests_)
- return net::ERR_CACHE_READ_FAILURE;
+ return ERR_CACHE_READ_FAILURE;
*start = offset;
DCHECK(offset < kint32max);
@@ -233,7 +245,7 @@
return count;
CallbackLater(callback, count);
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
bool MockDiskEntry::CouldBeSparse() const {
@@ -246,21 +258,21 @@
cancel_ = true;
}
-int MockDiskEntry::ReadyForSparseIO(const net::CompletionCallback& callback) {
+int MockDiskEntry::ReadyForSparseIO(const CompletionCallback& callback) {
if (fail_sparse_requests_)
- return net::ERR_NOT_IMPLEMENTED;
+ return ERR_NOT_IMPLEMENTED;
if (!cancel_)
- return net::OK;
+ return OK;
cancel_ = false;
DCHECK(!callback.is_null());
if (MockHttpCache::GetTestMode(test_mode_) & TEST_MODE_SYNC_CACHE_READ)
- return net::OK;
+ return OK;
// The pending operation is already in the message loop (and hopefully
// already in the second pass). Just notify the caller that it finished.
CallbackLater(callback, 0);
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
// If |value| is true, don't deliver any completion callbacks until called
@@ -272,7 +284,7 @@
return;
ignore_callbacks_ = value;
if (!value)
- StoreAndDeliverCallbacks(false, NULL, net::CompletionCallback(), 0);
+ StoreAndDeliverCallbacks(false, NULL, CompletionCallback(), 0);
}
MockDiskEntry::~MockDiskEntry() {
@@ -281,7 +293,7 @@
// Unlike the callbacks for MockHttpTransaction, we want this one to run even
// if the consumer called Close on the MockDiskEntry. We achieve that by
// leveraging the fact that this class is reference counted.
-void MockDiskEntry::CallbackLater(const net::CompletionCallback& callback,
+void MockDiskEntry::CallbackLater(const CompletionCallback& callback,
int result) {
if (ignore_callbacks_)
return StoreAndDeliverCallbacks(true, this, callback, result);
@@ -290,8 +302,8 @@
base::Bind(&MockDiskEntry::RunCallback, this, callback, result));
}
-void MockDiskEntry::RunCallback(
- const net::CompletionCallback& callback, int result) {
+void MockDiskEntry::RunCallback(const CompletionCallback& callback,
+ int result) {
if (busy_) {
// This is kind of hacky, but controlling the behavior of just this entry
// from a test is sort of complicated. What we really want to do is
@@ -313,9 +325,10 @@
// When |store| is true, stores the callback to be delivered later; otherwise
// delivers any callback previously stored.
// Static.
-void MockDiskEntry::StoreAndDeliverCallbacks(
- bool store, MockDiskEntry* entry, const net::CompletionCallback& callback,
- int result) {
+void MockDiskEntry::StoreAndDeliverCallbacks(bool store,
+ MockDiskEntry* entry,
+ const CompletionCallback& callback,
+ int result) {
static std::vector<CallbackInfo> callback_list;
if (store) {
CallbackInfo c = {entry, callback, result};
@@ -345,28 +358,29 @@
ReleaseAll();
}
-net::CacheType MockDiskCache::GetCacheType() const {
- return net::DISK_CACHE;
+CacheType MockDiskCache::GetCacheType() const {
+ return DISK_CACHE;
}
int32 MockDiskCache::GetEntryCount() const {
return static_cast<int32>(entries_.size());
}
-int MockDiskCache::OpenEntry(const std::string& key, disk_cache::Entry** entry,
- const net::CompletionCallback& callback) {
+int MockDiskCache::OpenEntry(const std::string& key,
+ disk_cache::Entry** entry,
+ const CompletionCallback& callback) {
DCHECK(!callback.is_null());
if (fail_requests_)
- return net::ERR_CACHE_OPEN_FAILURE;
+ return ERR_CACHE_OPEN_FAILURE;
EntryMap::iterator it = entries_.find(key);
if (it == entries_.end())
- return net::ERR_CACHE_OPEN_FAILURE;
+ return ERR_CACHE_OPEN_FAILURE;
if (it->second->is_doomed()) {
it->second->Release();
entries_.erase(it);
- return net::ERR_CACHE_OPEN_FAILURE;
+ return ERR_CACHE_OPEN_FAILURE;
}
open_count_++;
@@ -378,18 +392,18 @@
it->second->set_fail_requests();
if (GetTestModeForEntry(key) & TEST_MODE_SYNC_CACHE_START)
- return net::OK;
+ return OK;
- CallbackLater(callback, net::OK);
- return net::ERR_IO_PENDING;
+ CallbackLater(callback, OK);
+ return ERR_IO_PENDING;
}
int MockDiskCache::CreateEntry(const std::string& key,
disk_cache::Entry** entry,
- const net::CompletionCallback& callback) {
+ const CompletionCallback& callback) {
DCHECK(!callback.is_null());
if (fail_requests_)
- return net::ERR_CACHE_CREATE_FAILURE;
+ return ERR_CACHE_CREATE_FAILURE;
EntryMap::iterator it = entries_.find(key);
if (it != entries_.end()) {
@@ -397,7 +411,7 @@
if (double_create_check_)
NOTREACHED();
else
- return net::ERR_CACHE_CREATE_FAILURE;
+ return ERR_CACHE_CREATE_FAILURE;
}
it->second->Release();
entries_.erase(it);
@@ -420,14 +434,14 @@
new_entry->set_fail_sparse_requests();
if (GetTestModeForEntry(key) & TEST_MODE_SYNC_CACHE_START)
- return net::OK;
+ return OK;
- CallbackLater(callback, net::OK);
- return net::ERR_IO_PENDING;
+ CallbackLater(callback, OK);
+ return ERR_IO_PENDING;
}
int MockDiskCache::DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) {
+ const CompletionCallback& callback) {
DCHECK(!callback.is_null());
EntryMap::iterator it = entries_.find(key);
if (it != entries_.end()) {
@@ -436,32 +450,32 @@
}
if (GetTestModeForEntry(key) & TEST_MODE_SYNC_CACHE_START)
- return net::OK;
+ return OK;
- CallbackLater(callback, net::OK);
- return net::ERR_IO_PENDING;
+ CallbackLater(callback, OK);
+ return ERR_IO_PENDING;
}
-int MockDiskCache::DoomAllEntries(const net::CompletionCallback& callback) {
- return net::ERR_NOT_IMPLEMENTED;
+int MockDiskCache::DoomAllEntries(const CompletionCallback& callback) {
+ return ERR_NOT_IMPLEMENTED;
}
int MockDiskCache::DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
- const net::CompletionCallback& callback) {
- return net::ERR_NOT_IMPLEMENTED;
+ const CompletionCallback& callback) {
+ return ERR_NOT_IMPLEMENTED;
}
int MockDiskCache::DoomEntriesSince(const base::Time initial_time,
- const net::CompletionCallback& callback) {
- return net::ERR_NOT_IMPLEMENTED;
+ const CompletionCallback& callback) {
+ return ERR_NOT_IMPLEMENTED;
}
class MockDiskCache::NotImplementedIterator : public Iterator {
public:
int OpenNextEntry(disk_cache::Entry** next_entry,
- const net::CompletionCallback& callback) override {
- return net::ERR_NOT_IMPLEMENTED;
+ const CompletionCallback& callback) override {
+ return ERR_NOT_IMPLEMENTED;
}
};
@@ -483,7 +497,7 @@
entries_.clear();
}
-void MockDiskCache::CallbackLater(const net::CompletionCallback& callback,
+void MockDiskCache::CallbackLater(const CompletionCallback& callback,
int result) {
base::MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(&CallbackForwader, callback, result));
@@ -491,11 +505,11 @@
//-----------------------------------------------------------------------------
-int MockBackendFactory::CreateBackend(net::NetLog* net_log,
+int MockBackendFactory::CreateBackend(NetLog* net_log,
scoped_ptr<disk_cache::Backend>* backend,
- const net::CompletionCallback& callback) {
+ const CompletionCallback& callback) {
backend->reset(new MockDiskCache());
- return net::OK;
+ return OK;
}
//-----------------------------------------------------------------------------
@@ -504,24 +518,24 @@
: http_cache_(new MockNetworkLayer(), NULL, new MockBackendFactory()) {
}
-MockHttpCache::MockHttpCache(net::HttpCache::BackendFactory* disk_cache_factory)
+MockHttpCache::MockHttpCache(HttpCache::BackendFactory* disk_cache_factory)
: http_cache_(new MockNetworkLayer(), NULL, disk_cache_factory) {
}
disk_cache::Backend* MockHttpCache::backend() {
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
disk_cache::Backend* backend;
int rv = http_cache_.GetBackend(&backend, cb.callback());
rv = cb.GetResult(rv);
- return (rv == net::OK) ? backend : NULL;
+ return (rv == OK) ? backend : NULL;
}
MockDiskCache* MockHttpCache::disk_cache() {
return static_cast<MockDiskCache*>(backend());
}
-int MockHttpCache::CreateTransaction(scoped_ptr<net::HttpTransaction>* trans) {
- return http_cache_.CreateTransaction(net::DEFAULT_PRIORITY, trans);
+int MockHttpCache::CreateTransaction(scoped_ptr<HttpTransaction>* trans) {
+ return http_cache_.CreateTransaction(DEFAULT_PRIORITY, trans);
}
void MockHttpCache::BypassCacheLock() {
@@ -533,31 +547,31 @@
}
bool MockHttpCache::ReadResponseInfo(disk_cache::Entry* disk_entry,
- net::HttpResponseInfo* response_info,
+ HttpResponseInfo* response_info,
bool* response_truncated) {
int size = disk_entry->GetDataSize(0);
- net::TestCompletionCallback cb;
- scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(size));
+ TestCompletionCallback cb;
+ scoped_refptr<IOBuffer> buffer(new IOBuffer(size));
int rv = disk_entry->ReadData(0, 0, buffer.get(), size, cb.callback());
rv = cb.GetResult(rv);
EXPECT_EQ(size, rv);
- return net::HttpCache::ParseResponseInfo(buffer->data(), size,
- response_info,
- response_truncated);
+ return HttpCache::ParseResponseInfo(buffer->data(), size, response_info,
+ response_truncated);
}
-bool MockHttpCache::WriteResponseInfo(
- disk_cache::Entry* disk_entry, const net::HttpResponseInfo* response_info,
- bool skip_transient_headers, bool response_truncated) {
+bool MockHttpCache::WriteResponseInfo(disk_cache::Entry* disk_entry,
+ const HttpResponseInfo* response_info,
+ bool skip_transient_headers,
+ bool response_truncated) {
Pickle pickle;
response_info->Persist(
&pickle, skip_transient_headers, response_truncated);
- net::TestCompletionCallback cb;
- scoped_refptr<net::WrappedIOBuffer> data(new net::WrappedIOBuffer(
- reinterpret_cast<const char*>(pickle.data())));
+ TestCompletionCallback cb;
+ scoped_refptr<WrappedIOBuffer> data(
+ new WrappedIOBuffer(reinterpret_cast<const char*>(pickle.data())));
int len = static_cast<int>(pickle.size());
int rv = disk_entry->WriteData(0, 0, data.get(), len, cb.callback(), true);
@@ -567,17 +581,17 @@
bool MockHttpCache::OpenBackendEntry(const std::string& key,
disk_cache::Entry** entry) {
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
int rv = backend()->OpenEntry(key, entry, cb.callback());
- return (cb.GetResult(rv) == net::OK);
+ return (cb.GetResult(rv) == OK);
}
bool MockHttpCache::CreateBackendEntry(const std::string& key,
disk_cache::Entry** entry,
- net::NetLog* net_log) {
- net::TestCompletionCallback cb;
+ NetLog* net_log) {
+ TestCompletionCallback cb;
int rv = backend()->CreateEntry(key, entry, cb.callback());
- return (cb.GetResult(rv) == net::OK);
+ return (cb.GetResult(rv) == OK);
}
// Static.
@@ -597,17 +611,18 @@
int MockDiskCacheNoCB::CreateEntry(const std::string& key,
disk_cache::Entry** entry,
- const net::CompletionCallback& callback) {
- return net::ERR_IO_PENDING;
+ const CompletionCallback& callback) {
+ return ERR_IO_PENDING;
}
//-----------------------------------------------------------------------------
int MockBackendNoCbFactory::CreateBackend(
- net::NetLog* net_log, scoped_ptr<disk_cache::Backend>* backend,
- const net::CompletionCallback& callback) {
+ NetLog* net_log,
+ scoped_ptr<disk_cache::Backend>* backend,
+ const CompletionCallback& callback) {
backend->reset(new MockDiskCacheNoCB());
- return net::OK;
+ return OK;
}
//-----------------------------------------------------------------------------
@@ -622,8 +637,9 @@
}
int MockBlockingBackendFactory::CreateBackend(
- net::NetLog* net_log, scoped_ptr<disk_cache::Backend>* backend,
- const net::CompletionCallback& callback) {
+ NetLog* net_log,
+ scoped_ptr<disk_cache::Backend>* backend,
+ const CompletionCallback& callback) {
if (!block_) {
if (!fail_)
backend->reset(new MockDiskCache());
@@ -632,7 +648,7 @@
backend_ = backend;
callback_ = callback;
- return net::ERR_IO_PENDING;
+ return ERR_IO_PENDING;
}
void MockBlockingBackendFactory::FinishCreation() {
@@ -640,8 +656,10 @@
if (!callback_.is_null()) {
if (!fail_)
backend_->reset(new MockDiskCache());
- net::CompletionCallback cb = callback_;
+ CompletionCallback cb = callback_;
callback_.Reset();
cb.Run(Result()); // This object can be deleted here.
}
}
+
+} // namespace net
diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h
index 36b5656..f77ace4 100644
--- a/net/http/mock_http_cache.h
+++ b/net/http/mock_http_cache.h
@@ -15,6 +15,8 @@
#include "net/http/http_cache.h"
#include "net/http/http_transaction_test_util.h"
+namespace net {
+
//-----------------------------------------------------------------------------
// Mock disk cache (a very basic memory cache implementation).
@@ -33,31 +35,30 @@
int32 GetDataSize(int index) const override;
int ReadData(int index,
int offset,
- net::IOBuffer* buf,
+ IOBuffer* buf,
int buf_len,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
int WriteData(int index,
int offset,
- net::IOBuffer* buf,
+ IOBuffer* buf,
int buf_len,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
bool truncate) override;
int ReadSparseData(int64 offset,
- net::IOBuffer* buf,
+ IOBuffer* buf,
int buf_len,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
int WriteSparseData(int64 offset,
- net::IOBuffer* buf,
+ IOBuffer* buf,
int buf_len,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
int GetAvailableRange(int64 offset,
int len,
int64* start,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
bool CouldBeSparse() const override;
void CancelSparseIO() override;
- int ReadyForSparseIO(
- const net::CompletionCallback& completion_callback) override;
+ int ReadyForSparseIO(const CompletionCallback& completion_callback) override;
// Fail most subsequent requests.
void set_fail_requests() { fail_requests_ = true; }
@@ -78,14 +79,15 @@
// Unlike the callbacks for MockHttpTransaction, we want this one to run even
// if the consumer called Close on the MockDiskEntry. We achieve that by
// leveraging the fact that this class is reference counted.
- void CallbackLater(const net::CompletionCallback& callback, int result);
+ void CallbackLater(const CompletionCallback& callback, int result);
- void RunCallback(const net::CompletionCallback& callback, int result);
+ void RunCallback(const CompletionCallback& callback, int result);
// When |store| is true, stores the callback to be delivered later; otherwise
// delivers any callback previously stored.
- static void StoreAndDeliverCallbacks(bool store, MockDiskEntry* entry,
- const net::CompletionCallback& callback,
+ static void StoreAndDeliverCallbacks(bool store,
+ MockDiskEntry* entry,
+ const CompletionCallback& callback,
int result);
static const int kNumCacheEntryDataIndices = 3;
@@ -108,22 +110,22 @@
MockDiskCache();
~MockDiskCache() override;
- net::CacheType GetCacheType() const override;
+ CacheType GetCacheType() const override;
int32 GetEntryCount() const override;
int OpenEntry(const std::string& key,
disk_cache::Entry** entry,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
int CreateEntry(const std::string& key,
disk_cache::Entry** entry,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
int DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) override;
- int DoomAllEntries(const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
+ int DoomAllEntries(const CompletionCallback& callback) override;
int DoomEntriesBetween(base::Time initial_time,
base::Time end_time,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
int DoomEntriesSince(base::Time initial_time,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
scoped_ptr<Iterator> CreateIterator() override;
void GetStats(
std::vector<std::pair<std::string, std::string>>* stats) override;
@@ -153,7 +155,7 @@
typedef base::hash_map<std::string, MockDiskEntry*> EntryMap;
class NotImplementedIterator;
- void CallbackLater(const net::CompletionCallback& callback, int result);
+ void CallbackLater(const CompletionCallback& callback, int result);
EntryMap entries_;
int open_count_;
@@ -164,19 +166,19 @@
bool fail_sparse_requests_;
};
-class MockBackendFactory : public net::HttpCache::BackendFactory {
+class MockBackendFactory : public HttpCache::BackendFactory {
public:
- int CreateBackend(net::NetLog* net_log,
+ int CreateBackend(NetLog* net_log,
scoped_ptr<disk_cache::Backend>* backend,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
};
class MockHttpCache {
public:
MockHttpCache();
- explicit MockHttpCache(net::HttpCache::BackendFactory* disk_cache_factory);
+ explicit MockHttpCache(HttpCache::BackendFactory* disk_cache_factory);
- net::HttpCache* http_cache() { return &http_cache_; }
+ HttpCache* http_cache() { return &http_cache_; }
MockNetworkLayer* network_layer() {
return static_cast<MockNetworkLayer*>(http_cache_.network_layer());
@@ -184,8 +186,8 @@
disk_cache::Backend* backend();
MockDiskCache* disk_cache();
- // Wrapper around http_cache()->CreateTransaction(net::DEFAULT_PRIORITY...)
- int CreateTransaction(scoped_ptr<net::HttpTransaction>* trans);
+ // Wrapper around http_cache()->CreateTransaction(DEFAULT_PRIORITY...)
+ int CreateTransaction(scoped_ptr<HttpTransaction>* trans);
// Wrapper to bypass the cache lock for new transactions.
void BypassCacheLock();
@@ -195,12 +197,12 @@
// Helper function for reading response info from the disk cache.
static bool ReadResponseInfo(disk_cache::Entry* disk_entry,
- net::HttpResponseInfo* response_info,
+ HttpResponseInfo* response_info,
bool* response_truncated);
// Helper function for writing response info into the disk cache.
static bool WriteResponseInfo(disk_cache::Entry* disk_entry,
- const net::HttpResponseInfo* response_info,
+ const HttpResponseInfo* response_info,
bool skip_transient_headers,
bool response_truncated);
@@ -208,8 +210,9 @@
bool OpenBackendEntry(const std::string& key, disk_cache::Entry** entry);
// Helper function to synchronously create a backend entry.
- bool CreateBackendEntry(const std::string& key, disk_cache::Entry** entry,
- net::NetLog* net_log);
+ bool CreateBackendEntry(const std::string& key,
+ disk_cache::Entry** entry,
+ NetLog* net_log);
// Returns the test mode after considering the global override.
static int GetTestMode(int test_mode);
@@ -219,32 +222,32 @@
static void SetTestMode(int test_mode);
private:
- net::HttpCache http_cache_;
+ HttpCache http_cache_;
};
// This version of the disk cache doesn't invoke CreateEntry callbacks.
class MockDiskCacheNoCB : public MockDiskCache {
int CreateEntry(const std::string& key,
disk_cache::Entry** entry,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
};
-class MockBackendNoCbFactory : public net::HttpCache::BackendFactory {
+class MockBackendNoCbFactory : public HttpCache::BackendFactory {
public:
- int CreateBackend(net::NetLog* net_log,
+ int CreateBackend(NetLog* net_log,
scoped_ptr<disk_cache::Backend>* backend,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
};
// This backend factory allows us to control the backend instantiation.
-class MockBlockingBackendFactory : public net::HttpCache::BackendFactory {
+class MockBlockingBackendFactory : public HttpCache::BackendFactory {
public:
MockBlockingBackendFactory();
~MockBlockingBackendFactory() override;
- int CreateBackend(net::NetLog* net_log,
+ int CreateBackend(NetLog* net_log,
scoped_ptr<disk_cache::Backend>* backend,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
// Completes the backend creation. Any blocked call will be notified via the
// provided callback.
@@ -253,15 +256,17 @@
scoped_ptr<disk_cache::Backend>* backend() { return backend_; }
void set_fail(bool fail) { fail_ = fail; }
- const net::CompletionCallback& callback() { return callback_; }
+ const CompletionCallback& callback() { return callback_; }
private:
- int Result() { return fail_ ? net::ERR_FAILED : net::OK; }
+ int Result() { return fail_ ? ERR_FAILED : OK; }
scoped_ptr<disk_cache::Backend>* backend_;
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
bool block_;
bool fail_;
};
+} // namespace net
+
#endif // NET_HTTP_MOCK_HTTP_CACHE_H_
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index 2dcb015..100eed8 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -80,7 +80,7 @@
int rv = entry->GetAvailableRange(
offset, len, &start_, base::Bind(&PartialData::Core::OnIOComplete,
base::Unretained(this)));
- if (rv != net::ERR_IO_PENDING) {
+ if (rv != ERR_IO_PENDING) {
// The callback will not be invoked. Lets cleanup.
*start = start_;
delete this;
@@ -429,9 +429,10 @@
resource_size_));
}
-int PartialData::CacheRead(
- disk_cache::Entry* entry, IOBuffer* data, int data_len,
- const net::CompletionCallback& callback) {
+int PartialData::CacheRead(disk_cache::Entry* entry,
+ IOBuffer* data,
+ int data_len,
+ const CompletionCallback& callback) {
int read_len = std::min(data_len, cached_min_len_);
if (!read_len)
return 0;
@@ -450,9 +451,10 @@
return rv;
}
-int PartialData::CacheWrite(
- disk_cache::Entry* entry, IOBuffer* data, int data_len,
- const net::CompletionCallback& callback) {
+int PartialData::CacheWrite(disk_cache::Entry* entry,
+ IOBuffer* data,
+ int data_len,
+ const CompletionCallback& callback) {
DVLOG(3) << "To write: " << data_len;
if (sparse_entry_) {
return entry->WriteSparseData(
diff --git a/net/http/partial_data.h b/net/http/partial_data.h
index ea98ff0..8d87da5 100644
--- a/net/http/partial_data.h
+++ b/net/http/partial_data.h
@@ -96,13 +96,17 @@
// cache that provides the right arguments for the current range. When the IO
// operation completes, OnCacheReadCompleted() must be called with the result
// of the operation.
- int CacheRead(disk_cache::Entry* entry, IOBuffer* data, int data_len,
- const net::CompletionCallback& callback);
+ int CacheRead(disk_cache::Entry* entry,
+ IOBuffer* data,
+ int data_len,
+ const CompletionCallback& callback);
// Writes |data_len| bytes to cache. This is basically a wrapper around the
// API of the cache that provides the right arguments for the current range.
- int CacheWrite(disk_cache::Entry* entry, IOBuffer* data, int data_len,
- const net::CompletionCallback& callback);
+ int CacheWrite(disk_cache::Entry* entry,
+ IOBuffer* data,
+ int data_len,
+ const CompletionCallback& callback);
// This method should be called when CacheRead() finishes the read, to update
// the internal state about the current range.
diff --git a/net/http/transport_security_persister.cc b/net/http/transport_security_persister.cc
index 82a4b51..08aa07e 100644
--- a/net/http/transport_security_persister.cc
+++ b/net/http/transport_security_persister.cc
@@ -19,10 +19,7 @@
#include "net/cert/x509_certificate.h"
#include "net/http/transport_security_state.h"
-using net::HashValue;
-using net::HashValueTag;
-using net::HashValueVector;
-using net::TransportSecurityState;
+namespace net {
namespace {
@@ -91,9 +88,6 @@
} // namespace
-
-namespace net {
-
TransportSecurityPersister::TransportSecurityPersister(
TransportSecurityState* state,
const base::FilePath& profile_path,
@@ -108,9 +102,8 @@
transport_security_state_->SetDelegate(this);
base::PostTaskAndReplyWithResult(
- background_runner_.get(),
- FROM_HERE,
- base::Bind(&::LoadState, writer_.path()),
+ background_runner_.get(), FROM_HERE,
+ base::Bind(&LoadState, writer_.path()),
base::Bind(&TransportSecurityPersister::CompleteLoad,
weak_ptr_factory_.GetWeakPtr()));
}
diff --git a/net/http/transport_security_persister_unittest.cc b/net/http/transport_security_persister_unittest.cc
index 7bb2e99..1d547ea 100644
--- a/net/http/transport_security_persister_unittest.cc
+++ b/net/http/transport_security_persister_unittest.cc
@@ -15,8 +15,9 @@
#include "net/http/transport_security_state.h"
#include "testing/gtest/include/gtest/gtest.h"
-using net::TransportSecurityPersister;
-using net::TransportSecurityState;
+namespace net {
+
+namespace {
class TransportSecurityPersisterTest : public testing::Test {
public:
@@ -86,13 +87,13 @@
TEST_F(TransportSecurityPersisterTest, SerializeData3) {
// Add an entry.
- net::HashValue fp1(net::HASH_VALUE_SHA1);
+ HashValue fp1(HASH_VALUE_SHA1);
memset(fp1.data(), 0, fp1.size());
- net::HashValue fp2(net::HASH_VALUE_SHA1);
+ HashValue fp2(HASH_VALUE_SHA1);
memset(fp2.data(), 1, fp2.size());
base::Time expiry =
base::Time::Now() + base::TimeDelta::FromSeconds(1000);
- net::HashValueVector dynamic_spki_hashes;
+ HashValueVector dynamic_spki_hashes;
dynamic_spki_hashes.push_back(fp1);
dynamic_spki_hashes.push_back(fp2);
bool include_subdomains = false;
@@ -168,11 +169,11 @@
TransportSecurityState::DomainState domain_state;
static const char kTestDomain[] = "example.com";
EXPECT_FALSE(state_.GetDynamicDomainState(kTestDomain, &domain_state));
- net::HashValueVector hashes;
+ HashValueVector hashes;
std::string failure_log;
EXPECT_FALSE(domain_state.CheckPublicKeyPins(hashes, &failure_log));
- net::HashValue sha1(net::HASH_VALUE_SHA1);
+ HashValue sha1(HASH_VALUE_SHA1);
memset(sha1.data(), '1', sha1.size());
domain_state.pkp.spki_hashes.push_back(sha1);
@@ -204,3 +205,7 @@
sha1.data(),
sha1.size()));
}
+
+} // namespace
+
+} // namespace net
diff --git a/net/log/capturing_net_log_observer.cc b/net/log/capturing_net_log_observer.cc
index b226b98..3e7b960b 100644
--- a/net/log/capturing_net_log_observer.cc
+++ b/net/log/capturing_net_log_observer.cc
@@ -43,7 +43,7 @@
captured_entries_.clear();
}
-void CapturingNetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) {
+void CapturingNetLogObserver::OnAddEntry(const NetLog::Entry& entry) {
// Using Dictionaries instead of Values makes checking values a little
// simpler.
base::DictionaryValue* param_dict = nullptr;
diff --git a/net/log/net_log.cc b/net/log/net_log.cc
index e112c2c..93749f93 100644
--- a/net/log/net_log.cc
+++ b/net/log/net_log.cc
@@ -207,15 +207,15 @@
}
void NetLog::AddGlobalEntry(EventType type) {
- AddEntry(type, Source(net::NetLog::SOURCE_NONE, NextID()),
- net::NetLog::PHASE_NONE, NULL);
+ AddEntry(type, Source(NetLog::SOURCE_NONE, NextID()), NetLog::PHASE_NONE,
+ NULL);
}
void NetLog::AddGlobalEntry(
EventType type,
const NetLog::ParametersCallback& parameters_callback) {
- AddEntry(type, Source(net::NetLog::SOURCE_NONE, NextID()),
- net::NetLog::PHASE_NONE, ¶meters_callback);
+ AddEntry(type, Source(NetLog::SOURCE_NONE, NextID()), NetLog::PHASE_NONE,
+ ¶meters_callback);
}
uint32 NetLog::NextID() {
@@ -228,7 +228,7 @@
return NetLogCaptureMode::FromInternalValue(capture_mode);
}
-void NetLog::DeprecatedAddObserver(net::NetLog::ThreadSafeObserver* observer,
+void NetLog::DeprecatedAddObserver(NetLog::ThreadSafeObserver* observer,
NetLogCaptureMode capture_mode) {
DCHECK(capture_mode.enabled());
@@ -242,7 +242,7 @@
UpdateCaptureMode();
}
-void NetLog::SetObserverCaptureMode(net::NetLog::ThreadSafeObserver* observer,
+void NetLog::SetObserverCaptureMode(NetLog::ThreadSafeObserver* observer,
NetLogCaptureMode capture_mode) {
DCHECK(capture_mode.enabled());
base::AutoLock lock(lock_);
@@ -254,8 +254,7 @@
UpdateCaptureMode();
}
-void NetLog::DeprecatedRemoveObserver(
- net::NetLog::ThreadSafeObserver* observer) {
+void NetLog::DeprecatedRemoveObserver(NetLog::ThreadSafeObserver* observer) {
base::AutoLock lock(lock_);
DCHECK(observers_.HasObserver(observer));
diff --git a/net/log/net_log_util.cc b/net/log/net_log_util.cc
index d178a32..7172967 100644
--- a/net/log/net_log_util.cc
+++ b/net/log/net_log_util.cc
@@ -67,8 +67,8 @@
};
const StringToConstant kLoadStateTable[] = {
-#define LOAD_STATE(label) \
- { #label, net::LOAD_STATE_##label } \
+#define LOAD_STATE(label) \
+ { #label, LOAD_STATE_##label } \
,
#include "net/base/load_states_list.h"
#undef LOAD_STATE
@@ -103,11 +103,11 @@
// Returns the disk cache backend for |context| if there is one, or NULL.
// Despite the name, can return an in memory "disk cache".
-disk_cache::Backend* GetDiskCacheBackend(net::URLRequestContext* context) {
+disk_cache::Backend* GetDiskCacheBackend(URLRequestContext* context) {
if (!context->http_transaction_factory())
return NULL;
- net::HttpCache* http_cache = context->http_transaction_factory()->GetCache();
+ HttpCache* http_cache = context->http_transaction_factory()->GetCache();
if (!http_cache)
return NULL;
@@ -115,8 +115,8 @@
}
// Returns true if |request1| was created before |request2|.
-bool RequestCreatedBefore(const net::URLRequest* request1,
- const net::URLRequest* request2) {
+bool RequestCreatedBefore(const URLRequest* request1,
+ const URLRequest* request2) {
if (request1->creation_time() < request2->creation_time())
return true;
if (request1->creation_time() > request2->creation_time())
@@ -129,7 +129,7 @@
// Returns a Value representing the state of a pre-existing URLRequest when
// net-internals was opened.
base::Value* GetRequestStateAsValue(const net::URLRequest* request,
- net::NetLogCaptureMode capture_mode) {
+ NetLogCaptureMode capture_mode) {
return request->GetStateAsValue();
}
@@ -143,7 +143,7 @@
// Add a dictionary with information on the relationship between event type
// enums and their symbolic names.
- constants_dict->Set("logEventTypes", net::NetLog::GetEventTypesAsValue());
+ constants_dict->Set("logEventTypes", NetLog::GetEventTypesAsValue());
// Add a dictionary with information about the relationship between CertStatus
// flags and their symbolic names.
@@ -203,10 +203,9 @@
{
base::DictionaryValue* dict = new base::DictionaryValue();
- for (net::QuicErrorCode error = net::QUIC_NO_ERROR;
- error < net::QUIC_LAST_ERROR;
- error = static_cast<net::QuicErrorCode>(error + 1)) {
- dict->SetInteger(net::QuicUtils::ErrorToString(error),
+ for (QuicErrorCode error = QUIC_NO_ERROR; error < QUIC_LAST_ERROR;
+ error = static_cast<QuicErrorCode>(error + 1)) {
+ dict->SetInteger(QuicUtils::ErrorToString(error),
static_cast<int>(error));
}
@@ -218,10 +217,10 @@
{
base::DictionaryValue* dict = new base::DictionaryValue();
- for (net::QuicRstStreamErrorCode error = net::QUIC_STREAM_NO_ERROR;
- error < net::QUIC_STREAM_LAST_ERROR;
- error = static_cast<net::QuicRstStreamErrorCode>(error + 1)) {
- dict->SetInteger(net::QuicUtils::StreamErrorToString(error),
+ for (QuicRstStreamErrorCode error = QUIC_STREAM_NO_ERROR;
+ error < QUIC_STREAM_LAST_ERROR;
+ error = static_cast<QuicRstStreamErrorCode>(error + 1)) {
+ dict->SetInteger(QuicUtils::StreamErrorToString(error),
static_cast<int>(error));
}
@@ -244,16 +243,16 @@
{
base::DictionaryValue* dict = new base::DictionaryValue();
- dict->SetInteger("PHASE_BEGIN", net::NetLog::PHASE_BEGIN);
- dict->SetInteger("PHASE_END", net::NetLog::PHASE_END);
- dict->SetInteger("PHASE_NONE", net::NetLog::PHASE_NONE);
+ dict->SetInteger("PHASE_BEGIN", NetLog::PHASE_BEGIN);
+ dict->SetInteger("PHASE_END", NetLog::PHASE_END);
+ dict->SetInteger("PHASE_NONE", NetLog::PHASE_NONE);
constants_dict->Set("logEventPhase", dict);
}
// Information about the relationship between source type enums and
// their symbolic names.
- constants_dict->Set("logSourceType", net::NetLog::GetSourceTypesAsValue());
+ constants_dict->Set("logSourceType", NetLog::GetSourceTypesAsValue());
// TODO(eroman): This is here for compatibility in loading new log files with
// older builds of Chrome. Safe to remove this once M45 is on the stable
@@ -265,10 +264,9 @@
{
base::DictionaryValue* dict = new base::DictionaryValue();
- dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED",
- net::ADDRESS_FAMILY_UNSPECIFIED);
- dict->SetInteger("ADDRESS_FAMILY_IPV4", net::ADDRESS_FAMILY_IPV4);
- dict->SetInteger("ADDRESS_FAMILY_IPV6", net::ADDRESS_FAMILY_IPV6);
+ dict->SetInteger("ADDRESS_FAMILY_UNSPECIFIED", ADDRESS_FAMILY_UNSPECIFIED);
+ dict->SetInteger("ADDRESS_FAMILY_IPV4", ADDRESS_FAMILY_IPV4);
+ dict->SetInteger("ADDRESS_FAMILY_IPV6", ADDRESS_FAMILY_IPV6);
constants_dict->Set("addressFamily", dict);
}
@@ -328,7 +326,7 @@
// TODO(mmenke): The code for most of these sources should probably be moved
// into the sources themselves.
if (info_sources & NET_INFO_PROXY_SETTINGS) {
- net::ProxyService* proxy_service = context->proxy_service();
+ ProxyService* proxy_service = context->proxy_service();
base::DictionaryValue* dict = new base::DictionaryValue();
if (proxy_service->fetched_config().is_valid())
@@ -340,20 +338,20 @@
}
if (info_sources & NET_INFO_BAD_PROXIES) {
- const net::ProxyRetryInfoMap& bad_proxies_map =
+ const ProxyRetryInfoMap& bad_proxies_map =
context->proxy_service()->proxy_retry_info();
base::ListValue* list = new base::ListValue();
- for (net::ProxyRetryInfoMap::const_iterator it = bad_proxies_map.begin();
+ for (ProxyRetryInfoMap::const_iterator it = bad_proxies_map.begin();
it != bad_proxies_map.end(); ++it) {
const std::string& proxy_uri = it->first;
- const net::ProxyRetryInfo& retry_info = it->second;
+ const ProxyRetryInfo& retry_info = it->second;
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetString("proxy_uri", proxy_uri);
dict->SetString("bad_until",
- net::NetLog::TickCountToString(retry_info.bad_until));
+ NetLog::TickCountToString(retry_info.bad_until));
list->Append(dict);
}
@@ -362,9 +360,9 @@
}
if (info_sources & NET_INFO_HOST_RESOLVER) {
- net::HostResolver* host_resolver = context->host_resolver();
+ HostResolver* host_resolver = context->host_resolver();
DCHECK(host_resolver);
- net::HostCache* cache = host_resolver->GetHostCache();
+ HostCache* cache = host_resolver->GetHostCache();
if (cache) {
base::DictionaryValue* dict = new base::DictionaryValue();
base::Value* dns_config = host_resolver->GetDnsConfigAsValue();
@@ -382,10 +380,10 @@
base::ListValue* entry_list = new base::ListValue();
- net::HostCache::EntryMap::Iterator it(cache->entries());
+ HostCache::EntryMap::Iterator it(cache->entries());
for (; it.HasNext(); it.Advance()) {
- const net::HostCache::Key& key = it.key();
- const net::HostCache::Entry& entry = it.value();
+ const HostCache::Key& key = it.key();
+ const HostCache::Entry& entry = it.value();
base::DictionaryValue* entry_dict = new base::DictionaryValue();
@@ -393,9 +391,9 @@
entry_dict->SetInteger("address_family",
static_cast<int>(key.address_family));
entry_dict->SetString("expiration",
- net::NetLog::TickCountToString(it.expiration()));
+ NetLog::TickCountToString(it.expiration()));
- if (entry.error != net::OK) {
+ if (entry.error != OK) {
entry_dict->SetInteger("error", entry.error);
} else {
// Append all of the resolved addresses.
@@ -415,7 +413,7 @@
}
}
- net::HttpNetworkSession* http_network_session =
+ HttpNetworkSession* http_network_session =
context->http_transaction_factory()->GetSession();
if (info_sources & NET_INFO_SOCKET_POOL) {
@@ -431,8 +429,7 @@
if (info_sources & NET_INFO_SPDY_STATUS) {
base::DictionaryValue* status_dict = new base::DictionaryValue();
- status_dict->SetBoolean("spdy_enabled",
- net::HttpStreamFactory::spdy_enabled());
+ status_dict->SetBoolean("spdy_enabled", HttpStreamFactory::spdy_enabled());
status_dict->SetBoolean(
"use_alternate_protocols",
http_network_session->params().use_alternate_protocols);
@@ -454,7 +451,7 @@
}
if (info_sources & NET_INFO_SPDY_ALT_SVC_MAPPINGS) {
- const net::HttpServerProperties& http_server_properties =
+ const HttpServerProperties& http_server_properties =
*context->http_server_properties();
net_info_dict->Set(
NetInfoSourceToString(NET_INFO_SPDY_ALT_SVC_MAPPINGS),
@@ -524,12 +521,12 @@
// Create fake events.
ScopedVector<NetLog::Entry> entries;
for (const auto& request : requests) {
- net::NetLog::ParametersCallback callback =
+ NetLog::ParametersCallback callback =
base::Bind(&GetRequestStateAsValue, base::Unretained(request));
- net::NetLog::EntryData entry_data(
- net::NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(),
- net::NetLog::PHASE_BEGIN, request->creation_time(), &callback);
+ NetLog::EntryData entry_data(
+ NetLog::TYPE_REQUEST_ALIVE, request->net_log().source(),
+ NetLog::PHASE_BEGIN, request->creation_time(), &callback);
NetLog::Entry entry(&entry_data, request->net_log().GetCaptureMode());
observer->OnAddEntry(entry);
}
diff --git a/net/log/net_log_util_unittest.cc b/net/log/net_log_util_unittest.cc
index 2befc17..27b2967 100644
--- a/net/log/net_log_util_unittest.cc
+++ b/net/log/net_log_util_unittest.cc
@@ -31,7 +31,7 @@
// caches, and they have the same number of elements.
TEST(NetLogUtil, GetNetInfo) {
TestURLRequestContext context;
- net::HttpCache* http_cache = context.http_transaction_factory()->GetCache();
+ HttpCache* http_cache = context.http_transaction_factory()->GetCache();
// Get NetInfo when there's no cache backend (It's only created on first use).
EXPECT_FALSE(http_cache->GetCurrentBackend());
diff --git a/net/log/test_net_log.cc b/net/log/test_net_log.cc
index d98ffc3a..a25d05d 100644
--- a/net/log/test_net_log.cc
+++ b/net/log/test_net_log.cc
@@ -37,8 +37,7 @@
}
BoundTestNetLog::BoundTestNetLog()
- : net_log_(
- BoundNetLog::Make(&capturing_net_log_, net::NetLog::SOURCE_NONE)) {
+ : net_log_(BoundNetLog::Make(&capturing_net_log_, NetLog::SOURCE_NONE)) {
}
BoundTestNetLog::~BoundTestNetLog() {
diff --git a/net/log/write_to_file_net_log_observer.cc b/net/log/write_to_file_net_log_observer.cc
index 9df765eb..8ef5a71 100644
--- a/net/log/write_to_file_net_log_observer.cc
+++ b/net/log/write_to_file_net_log_observer.cc
@@ -25,16 +25,16 @@
}
void WriteToFileNetLogObserver::set_capture_mode(
- net::NetLogCaptureMode capture_mode) {
+ NetLogCaptureMode capture_mode) {
DCHECK(!net_log());
capture_mode_ = capture_mode;
}
void WriteToFileNetLogObserver::StartObserving(
- net::NetLog* net_log,
+ NetLog* net_log,
base::ScopedFILE file,
base::Value* constants,
- net::URLRequestContext* url_request_context) {
+ URLRequestContext* url_request_context) {
DCHECK(file.get());
file_ = file.Pass();
added_events_ = false;
@@ -67,7 +67,7 @@
}
void WriteToFileNetLogObserver::StopObserving(
- net::URLRequestContext* url_request_context) {
+ URLRequestContext* url_request_context) {
net_log()->DeprecatedRemoveObserver(this);
// End events array.
@@ -88,7 +88,7 @@
file_.reset();
}
-void WriteToFileNetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) {
+void WriteToFileNetLogObserver::OnAddEntry(const NetLog::Entry& entry) {
// Add a comma and newline for every event but the first. Newlines are needed
// so can load partial log files by just ignoring the last line. For this to
// work, lines cannot be pretty printed.
diff --git a/net/log/write_to_file_net_log_observer.h b/net/log/write_to_file_net_log_observer.h
index 8ef0115..9789272 100644
--- a/net/log/write_to_file_net_log_observer.h
+++ b/net/log/write_to_file_net_log_observer.h
@@ -49,7 +49,7 @@
void StartObserving(NetLog* net_log,
base::ScopedFILE file,
base::Value* constants,
- net::URLRequestContext* url_request_context);
+ URLRequestContext* url_request_context);
// Stops observing net_log(). Must already be watching. Must be called
// before destruction of the WriteToFileNetLogObserver and the NetLog.
@@ -57,7 +57,7 @@
// |url_request_context| is an optional argument used to added additional
// network stack state to the log. If the context is non-NULL, this must be
// called on the context's thread.
- void StopObserving(net::URLRequestContext* url_request_context);
+ void StopObserving(URLRequestContext* url_request_context);
// net::NetLog::ThreadSafeObserver implementation:
void OnAddEntry(const NetLog::Entry& entry) override;
diff --git a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h
index c89192c..70bc8e2d 100644
--- a/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h
+++ b/net/proxy/dhcp_proxy_script_adapter_fetcher_win.h
@@ -47,7 +47,7 @@
// You may only call Fetch() once on a given instance of
// DhcpProxyScriptAdapterFetcher.
virtual void Fetch(const std::string& adapter_name,
- const net::CompletionCallback& callback);
+ const CompletionCallback& callback);
// Cancels the fetch on this adapter.
virtual void Cancel();
@@ -170,7 +170,7 @@
// Callback to let our client know we're done. Invalid in states
// START, FINISH and CANCEL.
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
// Fetcher to retrieve PAC files once URL is known.
scoped_ptr<ProxyScriptFetcher> script_fetcher_;
diff --git a/net/proxy/dhcp_proxy_script_fetcher_win.h b/net/proxy/dhcp_proxy_script_fetcher_win.h
index aa60a13a..d490805 100644
--- a/net/proxy/dhcp_proxy_script_fetcher_win.h
+++ b/net/proxy/dhcp_proxy_script_fetcher_win.h
@@ -39,7 +39,7 @@
// DhcpProxyScriptFetcher implementation.
int Fetch(base::string16* utf16_text,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
void Cancel() override;
const GURL& GetPacURL() const override;
std::string GetFetcherName() const override;
@@ -148,7 +148,7 @@
int num_pending_fetchers_;
// Lets our client know we're done. Not valid in states START or DONE.
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
// Pointer to string we will write results to. Not valid in states
// START and DONE.
diff --git a/net/proxy/mock_proxy_resolver.h b/net/proxy/mock_proxy_resolver.h
index 024a083..ee24da4 100644
--- a/net/proxy/mock_proxy_resolver.h
+++ b/net/proxy/mock_proxy_resolver.h
@@ -28,11 +28,11 @@
Request(MockAsyncProxyResolverBase* resolver,
const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback);
+ const CompletionCallback& callback);
const GURL& url() const { return url_; }
ProxyInfo* results() const { return results_; }
- const net::CompletionCallback& callback() const { return callback_; }
+ const CompletionCallback& callback() const { return callback_; }
void CompleteNow(int rv);
@@ -44,7 +44,7 @@
MockAsyncProxyResolverBase* resolver_;
const GURL url_;
ProxyInfo* results_;
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
base::MessageLoop* origin_loop_;
};
@@ -53,7 +53,7 @@
SetPacScriptRequest(
MockAsyncProxyResolverBase* resolver,
const scoped_refptr<ProxyResolverScriptData>& script_data,
- const net::CompletionCallback& callback);
+ const CompletionCallback& callback);
~SetPacScriptRequest();
const ProxyResolverScriptData* script_data() const {
@@ -65,7 +65,7 @@
private:
MockAsyncProxyResolverBase* resolver_;
const scoped_refptr<ProxyResolverScriptData> script_data_;
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
base::MessageLoop* origin_loop_;
};
@@ -76,13 +76,13 @@
// ProxyResolver implementation.
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
RequestHandle* request_handle,
const BoundNetLog& /*net_log*/) override;
void CancelRequest(RequestHandle request_handle) override;
LoadState GetLoadState(RequestHandle request_handle) const override;
int SetPacScript(const scoped_refptr<ProxyResolverScriptData>& script_data,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
void CancelSetPacScript() override;
const RequestsList& pending_requests() const {
diff --git a/net/proxy/mojo_proxy_resolver_impl_unittest.cc b/net/proxy/mojo_proxy_resolver_impl_unittest.cc
index 8f2f4ab2..53ad02c5 100644
--- a/net/proxy/mojo_proxy_resolver_impl_unittest.cc
+++ b/net/proxy/mojo_proxy_resolver_impl_unittest.cc
@@ -120,12 +120,12 @@
// MockAsyncProxyResolverExpectsBytes overrides.
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
RequestHandle* request_handle,
const BoundNetLog& net_log) override;
void CancelRequest(RequestHandle request_handle) override;
int SetPacScript(const scoped_refptr<ProxyResolverScriptData>& script_data,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
// Wait until the mock resolver has received a CancelRequest call.
void WaitForCancel();
@@ -149,7 +149,7 @@
int CallbackMockProxyResolver::GetProxyForURL(
const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
RequestHandle* request_handle,
const BoundNetLog& net_log) {
if (sync_result_) {
@@ -171,7 +171,7 @@
int CallbackMockProxyResolver::SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& script_data,
- const net::CompletionCallback& callback) {
+ const CompletionCallback& callback) {
if (set_pac_script_sync_) {
set_pac_script_sync_ = false;
return OK;
@@ -244,9 +244,9 @@
request->CompleteNow(OK);
client.WaitForResult();
- EXPECT_EQ(net::OK, client.error());
- std::vector<net::ProxyServer> servers =
- client.results().To<std::vector<net::ProxyServer>>();
+ EXPECT_EQ(OK, client.error());
+ std::vector<ProxyServer> servers =
+ client.results().To<std::vector<ProxyServer>>();
ASSERT_EQ(6u, servers.size());
EXPECT_EQ(ProxyServer::SCHEME_HTTP, servers[0].scheme());
EXPECT_EQ("proxy.example.com", servers[0].host_port_pair().host());
@@ -282,11 +282,11 @@
ASSERT_EQ(0u, mock_proxy_resolver_->pending_requests().size());
client.WaitForResult();
- EXPECT_EQ(net::OK, client.error());
- std::vector<net::ProxyServer> proxy_servers =
- client.results().To<std::vector<net::ProxyServer>>();
+ EXPECT_EQ(OK, client.error());
+ std::vector<ProxyServer> proxy_servers =
+ client.results().To<std::vector<ProxyServer>>();
ASSERT_EQ(1u, proxy_servers.size());
- net::ProxyServer& server = proxy_servers[0];
+ ProxyServer& server = proxy_servers[0];
EXPECT_TRUE(server.is_direct());
}
@@ -303,8 +303,8 @@
client.WaitForResult();
EXPECT_EQ(ERR_FAILED, client.error());
- std::vector<net::ProxyServer> proxy_servers =
- client.results().To<std::vector<net::ProxyServer>>();
+ std::vector<ProxyServer> proxy_servers =
+ client.results().To<std::vector<ProxyServer>>();
EXPECT_TRUE(proxy_servers.empty());
}
@@ -330,20 +330,20 @@
client1.WaitForResult();
client2.WaitForResult();
- EXPECT_EQ(net::OK, client1.error());
- std::vector<net::ProxyServer> proxy_servers1 =
- client1.results().To<std::vector<net::ProxyServer>>();
+ EXPECT_EQ(OK, client1.error());
+ std::vector<ProxyServer> proxy_servers1 =
+ client1.results().To<std::vector<ProxyServer>>();
ASSERT_EQ(1u, proxy_servers1.size());
- net::ProxyServer& server1 = proxy_servers1[0];
+ ProxyServer& server1 = proxy_servers1[0];
EXPECT_EQ(ProxyServer::SCHEME_HTTPS, server1.scheme());
EXPECT_EQ("proxy.example.com", server1.host_port_pair().host());
EXPECT_EQ(12345, server1.host_port_pair().port());
- EXPECT_EQ(net::OK, client2.error());
- std::vector<net::ProxyServer> proxy_servers2 =
- client2.results().To<std::vector<net::ProxyServer>>();
+ EXPECT_EQ(OK, client2.error());
+ std::vector<ProxyServer> proxy_servers2 =
+ client2.results().To<std::vector<ProxyServer>>();
ASSERT_EQ(1u, proxy_servers1.size());
- net::ProxyServer& server2 = proxy_servers2[0];
+ ProxyServer& server2 = proxy_servers2[0];
EXPECT_EQ(ProxyServer::SCHEME_SOCKS5, server2.scheme());
EXPECT_EQ("another-proxy.example.com", server2.host_port_pair().host());
EXPECT_EQ(6789, server2.host_port_pair().port());
diff --git a/net/proxy/network_delegate_error_observer_unittest.cc b/net/proxy/network_delegate_error_observer_unittest.cc
index 0a2e01a..7d9bc6c06 100644
--- a/net/proxy/network_delegate_error_observer_unittest.cc
+++ b/net/proxy/network_delegate_error_observer_unittest.cc
@@ -16,7 +16,7 @@
namespace {
-class TestNetworkDelegate : public net::NetworkDelegateImpl {
+class TestNetworkDelegate : public NetworkDelegateImpl {
public:
TestNetworkDelegate() : got_pac_error_(false) {}
~TestNetworkDelegate() override {}
@@ -24,7 +24,7 @@
bool got_pac_error() const { return got_pac_error_; }
private:
- // net::NetworkDelegate implementation.
+ // NetworkDelegate implementation.
int OnBeforeURLRequest(URLRequest* request,
const CompletionCallback& callback,
GURL* new_url) override {
@@ -43,7 +43,7 @@
const HttpResponseHeaders* original_response_headers,
scoped_refptr<HttpResponseHeaders>* override_response_headers,
GURL* allowed_unsafe_redirect_url) override {
- return net::OK;
+ return OK;
}
void OnBeforeRedirect(URLRequest* request,
const GURL& new_location) override {}
@@ -70,7 +70,7 @@
CookieOptions* options) override {
return true;
}
- bool OnCanAccessFile(const net::URLRequest& request,
+ bool OnCanAccessFile(const URLRequest& request,
const base::FilePath& path) const override {
return true;
}
@@ -81,8 +81,6 @@
bool got_pac_error_;
};
-} // namespace
-
// Check that the OnPACScriptError method can be called from an arbitrary
// thread.
TEST(NetworkDelegateErrorObserverTest, CallOnThread) {
@@ -119,4 +117,6 @@
// Shouldn't have crashed until here...
}
+} // namespace
+
} // namespace net
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index 2c1995c..d48a762d 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -250,16 +250,13 @@
std::vector<std::string> > string_lists_table;
};
-} // namespace
-} // namespace net
-
// This helper class runs ProxyConfigServiceLinux::GetLatestProxyConfig() on
// the IO thread and synchronously waits for the result.
// Some code duplicated from proxy_script_fetcher_unittest.cc.
class SynchConfigGetter {
public:
// Takes ownership of |config_service|.
- explicit SynchConfigGetter(net::ProxyConfigServiceLinux* config_service)
+ explicit SynchConfigGetter(ProxyConfigServiceLinux* config_service)
: event_(false, false),
io_thread_("IO_Thread"),
config_service_(config_service) {
@@ -295,8 +292,8 @@
io_thread_.message_loop_proxy());
}
// Synchronously gets the proxy config.
- net::ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig(
- net::ProxyConfig* config) {
+ ProxyConfigService::ConfigAvailability SyncGetLatestProxyConfig(
+ ProxyConfig* config) {
io_thread_.message_loop()->PostTask(FROM_HERE,
base::Bind(&SynchConfigGetter::GetLatestConfigOnIOThread,
base::Unretained(this)));
@@ -333,18 +330,16 @@
base::WaitableEvent event_;
base::Thread io_thread_;
- net::ProxyConfigServiceLinux* config_service_;
+ ProxyConfigServiceLinux* config_service_;
// The config obtained by |io_thread_| and read back by the main
// thread.
- net::ProxyConfig proxy_config_;
+ ProxyConfig proxy_config_;
// Return value from GetLatestProxyConfig().
- net::ProxyConfigService::ConfigAvailability get_latest_config_result_;
+ ProxyConfigService::ConfigAvailability get_latest_config_result_;
};
-namespace net {
-
// This test fixture is only really needed for the KDEConfigParser test case,
// but all the test cases with the same prefix ("ProxyConfigServiceLinuxTest")
// must use the same test fixture class (also "ProxyConfigServiceLinuxTest").
@@ -1612,4 +1607,6 @@
}
}
+} // namespace
+
} // namespace net
diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc
index 6d192538..1483dbc 100644
--- a/net/proxy/proxy_config_service_mac.cc
+++ b/net/proxy/proxy_config_service_mac.cc
@@ -225,8 +225,8 @@
observers_.RemoveObserver(observer);
}
-net::ProxyConfigService::ConfigAvailability
- ProxyConfigServiceMac::GetLatestProxyConfig(ProxyConfig* config) {
+ProxyConfigService::ConfigAvailability
+ProxyConfigServiceMac::GetLatestProxyConfig(ProxyConfig* config) {
DCHECK(io_thread_task_runner_->BelongsToCurrentThread());
// Lazy-initialize by fetching the proxy setting from this thread.
diff --git a/net/proxy/proxy_resolver.h b/net/proxy/proxy_resolver.h
index 355c368..ced97b8 100644
--- a/net/proxy/proxy_resolver.h
+++ b/net/proxy/proxy_resolver.h
@@ -46,7 +46,7 @@
// |*request| is written to, and can be passed to CancelRequest().
virtual int GetProxyForURL(const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
RequestHandle* request,
const BoundNetLog& net_log) = 0;
@@ -69,7 +69,7 @@
// the result through |callback|.
virtual int SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& pac_script,
- const net::CompletionCallback& callback) = 0;
+ const CompletionCallback& callback) = 0;
private:
const bool expects_pac_bytes_;
diff --git a/net/proxy/proxy_resolver_mac.cc b/net/proxy/proxy_resolver_mac.cc
index 6d592bb..6d69080 100644
--- a/net/proxy/proxy_resolver_mac.cc
+++ b/net/proxy/proxy_resolver_mac.cc
@@ -21,26 +21,28 @@
#include <CoreServices/CoreServices.h>
#endif
+namespace net {
+
namespace {
// Utility function to map a CFProxyType to a ProxyServer::Scheme.
// If the type is unknown, returns ProxyServer::SCHEME_INVALID.
-net::ProxyServer::Scheme GetProxyServerScheme(CFStringRef proxy_type) {
+ProxyServer::Scheme GetProxyServerScheme(CFStringRef proxy_type) {
if (CFEqual(proxy_type, kCFProxyTypeNone))
- return net::ProxyServer::SCHEME_DIRECT;
+ return ProxyServer::SCHEME_DIRECT;
if (CFEqual(proxy_type, kCFProxyTypeHTTP))
- return net::ProxyServer::SCHEME_HTTP;
+ return ProxyServer::SCHEME_HTTP;
if (CFEqual(proxy_type, kCFProxyTypeHTTPS)) {
// The "HTTPS" on the Mac side here means "proxy applies to https://" URLs;
// the proxy itself is still expected to be an HTTP proxy.
- return net::ProxyServer::SCHEME_HTTP;
+ return ProxyServer::SCHEME_HTTP;
}
if (CFEqual(proxy_type, kCFProxyTypeSOCKS)) {
// We can't tell whether this was v4 or v5. We will assume it is
// v5 since that is the only version OS X supports.
- return net::ProxyServer::SCHEME_SOCKS5;
+ return ProxyServer::SCHEME_SOCKS5;
}
- return net::ProxyServer::SCHEME_INVALID;
+ return ProxyServer::SCHEME_INVALID;
}
// Callback for CFNetworkExecuteProxyAutoConfigurationURL. |client| is a pointer
@@ -62,8 +64,6 @@
} // namespace
-namespace net {
-
ProxyResolverMac::ProxyResolverMac()
: ProxyResolver(false /*expects_pac_bytes*/) {
}
diff --git a/net/proxy/proxy_resolver_mac.h b/net/proxy/proxy_resolver_mac.h
index ef10b5cb..3db83f6 100644
--- a/net/proxy/proxy_resolver_mac.h
+++ b/net/proxy/proxy_resolver_mac.h
@@ -23,7 +23,7 @@
// ProxyResolver methods:
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
RequestHandle* request,
const BoundNetLog& net_log) override;
@@ -34,7 +34,7 @@
void CancelSetPacScript() override;
int SetPacScript(const scoped_refptr<ProxyResolverScriptData>& script_data,
- const net::CompletionCallback& /*callback*/) override;
+ const CompletionCallback& /*callback*/) override;
private:
scoped_refptr<ProxyResolverScriptData> script_data_;
diff --git a/net/proxy/proxy_resolver_mojo.cc b/net/proxy/proxy_resolver_mojo.cc
index 3801d41a..89a0374 100644
--- a/net/proxy/proxy_resolver_mojo.cc
+++ b/net/proxy/proxy_resolver_mojo.cc
@@ -25,7 +25,7 @@
Job(ProxyResolverMojo* resolver,
const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback);
+ const CompletionCallback& callback);
~Job() override;
// Cancels the job and prevents the callback from being run.
@@ -47,7 +47,7 @@
ProxyResolverMojo* resolver_;
const GURL url_;
ProxyInfo* results_;
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
LoadState load_state_ = LOAD_STATE_RESOLVING_PROXY_FOR_URL;
base::ThreadChecker thread_checker_;
@@ -57,7 +57,7 @@
ProxyResolverMojo::Job::Job(ProxyResolverMojo* resolver,
const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback)
+ const CompletionCallback& callback)
: resolver_(resolver),
url_(url),
results_(results),
@@ -131,7 +131,7 @@
int ProxyResolverMojo::SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& pac_script,
- const net::CompletionCallback& callback) {
+ const CompletionCallback& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(set_pac_script_callback_.IsCancelled());
DCHECK(!callback.is_null());
@@ -157,7 +157,7 @@
void ProxyResolverMojo::OnSetPacScriptDone(
const scoped_refptr<ProxyResolverScriptData>& pac_script,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
int32_t result) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(!set_pac_script_callback_.IsCancelled());
@@ -225,7 +225,7 @@
int ProxyResolverMojo::GetProxyForURL(const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
RequestHandle* request,
const BoundNetLog& net_log) {
DCHECK(thread_checker_.CalledOnValidThread());
diff --git a/net/proxy/proxy_resolver_perftest.cc b/net/proxy/proxy_resolver_perftest.cc
index c4fbd73bd..480908e3 100644
--- a/net/proxy/proxy_resolver_perftest.cc
+++ b/net/proxy/proxy_resolver_perftest.cc
@@ -21,6 +21,10 @@
#include "net/proxy/proxy_resolver_mac.h"
#endif
+namespace net {
+
+namespace {
+
// This class holds the URL to use for resolving, and the expected result.
// We track the expected result in order to make sure the performance
// test is actually resolving URLs properly, otherwise the perf numbers
@@ -81,16 +85,13 @@
class PacPerfSuiteRunner {
public:
// |resolver_name| is the label used when logging the results.
- PacPerfSuiteRunner(net::ProxyResolver* resolver,
- const std::string& resolver_name)
+ PacPerfSuiteRunner(ProxyResolver* resolver, const std::string& resolver_name)
: resolver_(resolver),
resolver_name_(resolver_name),
- test_server_(
- net::SpawnedTestServer::TYPE_HTTP,
- net::SpawnedTestServer::kLocalhost,
- base::FilePath(
- FILE_PATH_LITERAL("net/data/proxy_resolver_perftest"))) {
- }
+ test_server_(SpawnedTestServer::TYPE_HTTP,
+ SpawnedTestServer::kLocalhost,
+ base::FilePath(FILE_PATH_LITERAL(
+ "net/data/proxy_resolver_perftest"))) {}
void RunAllTests() {
ASSERT_TRUE(test_server_.Start());
@@ -110,9 +111,8 @@
GURL pac_url =
test_server_.GetURL(std::string("files/") + script_name);
int rv = resolver_->SetPacScript(
- net::ProxyResolverScriptData::FromURL(pac_url),
- net::CompletionCallback());
- EXPECT_EQ(net::OK, rv);
+ ProxyResolverScriptData::FromURL(pac_url), CompletionCallback());
+ EXPECT_EQ(OK, rv);
} else {
LoadPacScriptIntoResolver(script_name);
}
@@ -121,11 +121,11 @@
// resolvers, the first resolve will be slow since it has to download
// the PAC script.
{
- net::ProxyInfo proxy_info;
- int result = resolver_->GetProxyForURL(
- GURL("http://www.warmup.com"), &proxy_info, net::CompletionCallback(),
- NULL, net::BoundNetLog());
- ASSERT_EQ(net::OK, result);
+ ProxyInfo proxy_info;
+ int result =
+ resolver_->GetProxyForURL(GURL("http://www.warmup.com"), &proxy_info,
+ CompletionCallback(), NULL, BoundNetLog());
+ ASSERT_EQ(OK, result);
}
// Start the perf timer.
@@ -137,14 +137,14 @@
const PacQuery& query = queries[i % queries_len];
// Resolve.
- net::ProxyInfo proxy_info;
- int result = resolver_->GetProxyForURL(
- GURL(query.query_url), &proxy_info, net::CompletionCallback(), NULL,
- net::BoundNetLog());
+ ProxyInfo proxy_info;
+ int result =
+ resolver_->GetProxyForURL(GURL(query.query_url), &proxy_info,
+ CompletionCallback(), NULL, BoundNetLog());
// Check that the result was correct. Note that ToPacString() and
// ASSERT_EQ() are fast, so they won't skew the results.
- ASSERT_EQ(net::OK, result);
+ ASSERT_EQ(OK, result);
ASSERT_EQ(query.expected_result, proxy_info.ToPacString());
}
@@ -171,31 +171,30 @@
// Load the PAC script into the ProxyResolver.
int rv = resolver_->SetPacScript(
- net::ProxyResolverScriptData::FromUTF8(file_contents),
- net::CompletionCallback());
- EXPECT_EQ(net::OK, rv);
+ ProxyResolverScriptData::FromUTF8(file_contents), CompletionCallback());
+ EXPECT_EQ(OK, rv);
}
- net::ProxyResolver* resolver_;
+ ProxyResolver* resolver_;
std::string resolver_name_;
- net::SpawnedTestServer test_server_;
+ SpawnedTestServer test_server_;
};
#if defined(OS_WIN)
TEST(ProxyResolverPerfTest, ProxyResolverWinHttp) {
- net::ProxyResolverWinHttp resolver;
+ ProxyResolverWinHttp resolver;
PacPerfSuiteRunner runner(&resolver, "ProxyResolverWinHttp");
runner.RunAllTests();
}
#elif defined(OS_MACOSX)
TEST(ProxyResolverPerfTest, ProxyResolverMac) {
- net::ProxyResolverMac resolver;
+ ProxyResolverMac resolver;
PacPerfSuiteRunner runner(&resolver, "ProxyResolverMac");
runner.RunAllTests();
}
#endif
-class MockJSBindings : public net::ProxyResolverV8::JSBindings {
+class MockJSBindings : public ProxyResolverV8::JSBindings {
public:
MockJSBindings() {}
@@ -216,8 +215,12 @@
TEST(ProxyResolverPerfTest, ProxyResolverV8) {
MockJSBindings js_bindings;
- net::ProxyResolverV8 resolver;
+ ProxyResolverV8 resolver;
resolver.set_js_bindings(&js_bindings);
PacPerfSuiteRunner runner(&resolver, "ProxyResolverV8");
runner.RunAllTests();
}
+
+} // namespace
+
+} // namespace net
diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h
index 446800c..229d4466 100644
--- a/net/proxy/proxy_resolver_v8.h
+++ b/net/proxy/proxy_resolver_v8.h
@@ -58,14 +58,14 @@
// ProxyResolver implementation:
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& /*callback*/,
+ const CompletionCallback& /*callback*/,
RequestHandle* /*request*/,
const BoundNetLog& net_log) override;
void CancelRequest(RequestHandle request) override;
LoadState GetLoadState(RequestHandle request) const override;
void CancelSetPacScript() override;
int SetPacScript(const scoped_refptr<ProxyResolverScriptData>& script_data,
- const net::CompletionCallback& /*callback*/) override;
+ const CompletionCallback& /*callback*/) override;
// Get total/ued heap memory usage of all v8 instances used by the proxy
// resolver.
diff --git a/net/proxy/proxy_resolver_v8_tracing.cc b/net/proxy/proxy_resolver_v8_tracing.cc
index 3970589..ce5cb5f 100644
--- a/net/proxy/proxy_resolver_v8_tracing.cc
+++ b/net/proxy/proxy_resolver_v8_tracing.cc
@@ -174,8 +174,10 @@
bool GetDnsFromLocalCache(const std::string& host, ResolveDnsOperation op,
std::string* output, bool* return_value);
- void SaveDnsToLocalCache(const std::string& host, ResolveDnsOperation op,
- int net_error, const net::AddressList& addresses);
+ void SaveDnsToLocalCache(const std::string& host,
+ ResolveDnsOperation op,
+ int net_error,
+ const AddressList& addresses);
// Builds a RequestInfo to service the specified PAC DNS operation.
static HostResolver::RequestInfo MakeDnsRequestInfo(const std::string& host,
@@ -782,7 +784,7 @@
const std::string& host,
ResolveDnsOperation op,
int net_error,
- const net::AddressList& addresses) {
+ const AddressList& addresses) {
CheckIsOnOriginThread();
// Serialize the result into a string to save to the cache.
diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc
index 1f33e18..a7696f3 100644
--- a/net/proxy/proxy_resolver_v8_unittest.cc
+++ b/net/proxy/proxy_resolver_v8_unittest.cc
@@ -155,7 +155,7 @@
EXPECT_EQ(0U, resolver.mock_js_bindings()->alerts.size());
EXPECT_EQ(0U, resolver.mock_js_bindings()->errors.size());
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
// No bindings were called, so no log entries.
EXPECT_EQ(0u, entries.size());
diff --git a/net/proxy/proxy_resolver_winhttp.h b/net/proxy/proxy_resolver_winhttp.h
index c3f7ede..3c2004a 100644
--- a/net/proxy/proxy_resolver_winhttp.h
+++ b/net/proxy/proxy_resolver_winhttp.h
@@ -23,7 +23,7 @@
// ProxyResolver implementation:
int GetProxyForURL(const GURL& url,
ProxyInfo* results,
- const net::CompletionCallback& /*callback*/,
+ const CompletionCallback& /*callback*/,
RequestHandle* /*request*/,
const BoundNetLog& /*net_log*/) override;
void CancelRequest(RequestHandle request) override;
@@ -33,7 +33,7 @@
void CancelSetPacScript() override;
int SetPacScript(const scoped_refptr<ProxyResolverScriptData>& script_data,
- const net::CompletionCallback& /*callback*/) override;
+ const CompletionCallback& /*callback*/) override;
private:
bool OpenWinHttpSession();
diff --git a/net/proxy/proxy_script_decider.h b/net/proxy/proxy_script_decider.h
index aa37c88..9b1d4a8 100644
--- a/net/proxy/proxy_script_decider.h
+++ b/net/proxy/proxy_script_decider.h
@@ -72,7 +72,7 @@
int Start(const ProxyConfig& config,
const base::TimeDelta wait_delay,
bool fetch_pac_bytes,
- const net::CompletionCallback& callback);
+ const CompletionCallback& callback);
const ProxyConfig& effective_config() const;
@@ -163,7 +163,7 @@
ProxyScriptFetcher* proxy_script_fetcher_;
DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher_;
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
size_t current_pac_source_index_;
diff --git a/net/proxy/proxy_script_fetcher.h b/net/proxy/proxy_script_fetcher.h
index 02f3195..ed89268 100644
--- a/net/proxy/proxy_script_fetcher.h
+++ b/net/proxy/proxy_script_fetcher.h
@@ -44,8 +44,9 @@
// deleting |this|), then no callback is invoked.
//
// Only one fetch is allowed to be outstanding at a time.
- virtual int Fetch(const GURL& url, base::string16* utf16_text,
- const net::CompletionCallback& callback) = 0;
+ virtual int Fetch(const GURL& url,
+ base::string16* utf16_text,
+ const CompletionCallback& callback) = 0;
// Aborts the in-progress fetch (if any).
virtual void Cancel() = 0;
diff --git a/net/proxy/proxy_script_fetcher_impl.h b/net/proxy/proxy_script_fetcher_impl.h
index 54afa4c..2afb116 100644
--- a/net/proxy/proxy_script_fetcher_impl.h
+++ b/net/proxy/proxy_script_fetcher_impl.h
@@ -47,7 +47,7 @@
// ProxyScriptFetcher methods:
int Fetch(const GURL& url,
base::string16* text,
- const net::CompletionCallback& callback) override;
+ const CompletionCallback& callback) override;
void Cancel() override;
URLRequestContext* GetRequestContext() const override;
@@ -98,7 +98,7 @@
int cur_request_id_;
// Callback to invoke on completion of the fetch.
- net::CompletionCallback callback_;
+ CompletionCallback callback_;
// Holds the error condition that was hit on the current request, or OK.
int result_code_;
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc
index 52c248f7..5046db3 100644
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -36,12 +36,12 @@
using base::ASCIIToUTF16;
-namespace net {
-
// TODO(eroman):
// - Test canceling an outstanding request.
// - Test deleting ProxyScriptFetcher while a request is in progress.
+namespace net {
+
namespace {
const base::FilePath::CharType kDocRoot[] =
@@ -172,7 +172,7 @@
return true;
}
- bool OnCanAccessFile(const net::URLRequest& request,
+ bool OnCanAccessFile(const URLRequest& request,
const base::FilePath& path) const override {
return true;
}
@@ -183,13 +183,11 @@
DISALLOW_COPY_AND_ASSIGN(BasicNetworkDelegate);
};
-} // namespace
-
class ProxyScriptFetcherImplTest : public PlatformTest {
public:
ProxyScriptFetcherImplTest()
: test_server_(SpawnedTestServer::TYPE_HTTP,
- net::SpawnedTestServer::kLocalhost,
+ SpawnedTestServer::kLocalhost,
base::FilePath(kDocRoot)) {
context_.set_network_delegate(&network_delegate_);
}
@@ -482,4 +480,6 @@
}
}
+} // namespace
+
} // namespace net
diff --git a/net/proxy/proxy_server.cc b/net/proxy/proxy_server.cc
index 78d5c3e3..1e8bba9 100644
--- a/net/proxy/proxy_server.cc
+++ b/net/proxy/proxy_server.cc
@@ -231,7 +231,7 @@
std::string host;
int port = -1;
// If the scheme has a host/port, parse it.
- bool ok = net::ParseHostAndPort(begin, end, &host, &port);
+ bool ok = ParseHostAndPort(begin, end, &host, &port);
if (!ok)
return ProxyServer(); // Invalid -- failed parsing <host>[":"<port>]
diff --git a/net/proxy/proxy_server_unittest.cc b/net/proxy/proxy_server_unittest.cc
index 0a596e47..25ad434 100644
--- a/net/proxy/proxy_server_unittest.cc
+++ b/net/proxy/proxy_server_unittest.cc
@@ -6,6 +6,10 @@
#include "net/proxy/proxy_server.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
+namespace {
+
// Test the creation of ProxyServer using ProxyServer::FromURI, which parses
// inputs of the form [<scheme>"://"]<host>[":"<port>]. Verify that each part
// was labelled correctly, and the accessors all give the right data.
@@ -13,156 +17,123 @@
const struct {
const char* const input_uri;
const char* const expected_uri;
- net::ProxyServer::Scheme expected_scheme;
+ ProxyServer::Scheme expected_scheme;
const char* const expected_host;
int expected_port;
const char* const expected_pac_string;
} tests[] = {
- // HTTP proxy URIs:
- {
- "foopy:10", // No scheme.
+ // HTTP proxy URIs:
+ {"foopy:10", // No scheme.
"foopy:10",
- net::ProxyServer::SCHEME_HTTP,
+ ProxyServer::SCHEME_HTTP,
"foopy",
10,
- "PROXY foopy:10"
- },
- {
- "http://foopy", // No port.
+ "PROXY foopy:10"},
+ {"http://foopy", // No port.
"foopy:80",
- net::ProxyServer::SCHEME_HTTP,
+ ProxyServer::SCHEME_HTTP,
"foopy",
80,
- "PROXY foopy:80"
- },
- {
- "http://foopy:10",
+ "PROXY foopy:80"},
+ {"http://foopy:10",
"foopy:10",
- net::ProxyServer::SCHEME_HTTP,
+ ProxyServer::SCHEME_HTTP,
"foopy",
10,
- "PROXY foopy:10"
- },
+ "PROXY foopy:10"},
- // IPv6 HTTP proxy URIs:
- {
- "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10", // No scheme.
+ // IPv6 HTTP proxy URIs:
+ {"[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10", // No scheme.
"[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10",
- net::ProxyServer::SCHEME_HTTP,
+ ProxyServer::SCHEME_HTTP,
"FEDC:BA98:7654:3210:FEDC:BA98:7654:3210",
10,
- "PROXY [FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10"
- },
- {
- "http://[3ffe:2a00:100:7031::1]", // No port.
+ "PROXY [FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:10"},
+ {"http://[3ffe:2a00:100:7031::1]", // No port.
"[3ffe:2a00:100:7031::1]:80",
- net::ProxyServer::SCHEME_HTTP,
+ ProxyServer::SCHEME_HTTP,
"3ffe:2a00:100:7031::1",
80,
- "PROXY [3ffe:2a00:100:7031::1]:80"
- },
- {
- "http://[::192.9.5.5]",
+ "PROXY [3ffe:2a00:100:7031::1]:80"},
+ {"http://[::192.9.5.5]",
"[::192.9.5.5]:80",
- net::ProxyServer::SCHEME_HTTP,
+ ProxyServer::SCHEME_HTTP,
"::192.9.5.5",
80,
- "PROXY [::192.9.5.5]:80"
- },
- {
- "http://[::FFFF:129.144.52.38]:80",
+ "PROXY [::192.9.5.5]:80"},
+ {"http://[::FFFF:129.144.52.38]:80",
"[::FFFF:129.144.52.38]:80",
- net::ProxyServer::SCHEME_HTTP,
+ ProxyServer::SCHEME_HTTP,
"::FFFF:129.144.52.38",
80,
- "PROXY [::FFFF:129.144.52.38]:80"
- },
+ "PROXY [::FFFF:129.144.52.38]:80"},
- // SOCKS4 proxy URIs:
- {
- "socks4://foopy", // No port.
+ // SOCKS4 proxy URIs:
+ {"socks4://foopy", // No port.
"socks4://foopy:1080",
- net::ProxyServer::SCHEME_SOCKS4,
+ ProxyServer::SCHEME_SOCKS4,
"foopy",
1080,
- "SOCKS foopy:1080"
- },
- {
+ "SOCKS foopy:1080"},
+ {"socks4://foopy:10",
"socks4://foopy:10",
- "socks4://foopy:10",
- net::ProxyServer::SCHEME_SOCKS4,
+ ProxyServer::SCHEME_SOCKS4,
"foopy",
10,
- "SOCKS foopy:10"
- },
+ "SOCKS foopy:10"},
- // SOCKS5 proxy URIs
- {
- "socks5://foopy", // No port.
+ // SOCKS5 proxy URIs
+ {"socks5://foopy", // No port.
"socks5://foopy:1080",
- net::ProxyServer::SCHEME_SOCKS5,
+ ProxyServer::SCHEME_SOCKS5,
"foopy",
1080,
- "SOCKS5 foopy:1080"
- },
- {
+ "SOCKS5 foopy:1080"},
+ {"socks5://foopy:10",
"socks5://foopy:10",
- "socks5://foopy:10",
- net::ProxyServer::SCHEME_SOCKS5,
+ ProxyServer::SCHEME_SOCKS5,
"foopy",
10,
- "SOCKS5 foopy:10"
- },
+ "SOCKS5 foopy:10"},
- // SOCKS proxy URIs (should default to SOCKS5)
- {
- "socks://foopy", // No port.
+ // SOCKS proxy URIs (should default to SOCKS5)
+ {"socks://foopy", // No port.
"socks5://foopy:1080",
- net::ProxyServer::SCHEME_SOCKS5,
+ ProxyServer::SCHEME_SOCKS5,
"foopy",
1080,
- "SOCKS5 foopy:1080"
- },
- {
- "socks://foopy:10",
+ "SOCKS5 foopy:1080"},
+ {"socks://foopy:10",
"socks5://foopy:10",
- net::ProxyServer::SCHEME_SOCKS5,
+ ProxyServer::SCHEME_SOCKS5,
"foopy",
10,
- "SOCKS5 foopy:10"
- },
+ "SOCKS5 foopy:10"},
- // HTTPS proxy URIs:
- {
- "https://foopy", // No port
+ // HTTPS proxy URIs:
+ {"https://foopy", // No port
"https://foopy:443",
- net::ProxyServer::SCHEME_HTTPS,
+ ProxyServer::SCHEME_HTTPS,
"foopy",
443,
- "HTTPS foopy:443"
- },
- {
- "https://foopy:10", // Non-standard port
+ "HTTPS foopy:443"},
+ {"https://foopy:10", // Non-standard port
"https://foopy:10",
- net::ProxyServer::SCHEME_HTTPS,
+ ProxyServer::SCHEME_HTTPS,
"foopy",
10,
- "HTTPS foopy:10"
- },
- {
- "https://1.2.3.4:10", // IP Address
+ "HTTPS foopy:10"},
+ {"https://1.2.3.4:10", // IP Address
"https://1.2.3.4:10",
- net::ProxyServer::SCHEME_HTTPS,
+ ProxyServer::SCHEME_HTTPS,
"1.2.3.4",
10,
- "HTTPS 1.2.3.4:10"
- },
+ "HTTPS 1.2.3.4:10"},
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- net::ProxyServer uri =
- net::ProxyServer::FromURI(tests[i].input_uri,
- net::ProxyServer::SCHEME_HTTP);
+ ProxyServer uri =
+ ProxyServer::FromURI(tests[i].input_uri, ProxyServer::SCHEME_HTTP);
EXPECT_TRUE(uri.is_valid());
EXPECT_FALSE(uri.is_direct());
EXPECT_EQ(tests[i].expected_uri, uri.ToURI());
@@ -174,15 +145,14 @@
}
TEST(ProxyServerTest, DefaultConstructor) {
- net::ProxyServer proxy_server;
+ ProxyServer proxy_server;
EXPECT_FALSE(proxy_server.is_valid());
}
// Test parsing of the special URI form "direct://". Analagous to the "DIRECT"
// entry in a PAC result.
TEST(ProxyServerTest, Direct) {
- net::ProxyServer uri =
- net::ProxyServer::FromURI("direct://", net::ProxyServer::SCHEME_HTTP);
+ ProxyServer uri = ProxyServer::FromURI("direct://", ProxyServer::SCHEME_HTTP);
EXPECT_TRUE(uri.is_valid());
EXPECT_TRUE(uri.is_direct());
EXPECT_EQ("direct://", uri.ToURI());
@@ -203,8 +173,7 @@
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- net::ProxyServer uri =
- net::ProxyServer::FromURI(tests[i], net::ProxyServer::SCHEME_HTTP);
+ ProxyServer uri = ProxyServer::FromURI(tests[i], ProxyServer::SCHEME_HTTP);
EXPECT_FALSE(uri.is_valid());
EXPECT_FALSE(uri.is_direct());
EXPECT_FALSE(uri.is_http());
@@ -221,8 +190,7 @@
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- net::ProxyServer uri =
- net::ProxyServer::FromURI(tests[i], net::ProxyServer::SCHEME_HTTP);
+ ProxyServer uri = ProxyServer::FromURI(tests[i], ProxyServer::SCHEME_HTTP);
EXPECT_EQ("foopy:80", uri.ToURI());
}
}
@@ -280,7 +248,7 @@
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- net::ProxyServer uri = net::ProxyServer::FromPacString(tests[i].input_pac);
+ ProxyServer uri = ProxyServer::FromPacString(tests[i].input_pac);
EXPECT_TRUE(uri.is_valid());
EXPECT_EQ(tests[i].expected_uri, uri.ToURI());
}
@@ -296,7 +264,7 @@
};
for (size_t i = 0; i < arraysize(tests); ++i) {
- net::ProxyServer uri = net::ProxyServer::FromPacString(tests[i]);
+ ProxyServer uri = ProxyServer::FromPacString(tests[i]);
EXPECT_FALSE(uri.is_valid());
}
}
@@ -337,13 +305,11 @@
for (size_t i = 0; i < arraysize(tests); ++i) {
// Parse the expected inputs to ProxyServer instances.
- const net::ProxyServer server1 =
- net::ProxyServer::FromURI(
- tests[i].server1, net::ProxyServer::SCHEME_HTTP);
+ const ProxyServer server1 =
+ ProxyServer::FromURI(tests[i].server1, ProxyServer::SCHEME_HTTP);
- const net::ProxyServer server2 =
- net::ProxyServer::FromURI(
- tests[i].server2, net::ProxyServer::SCHEME_HTTP);
+ const ProxyServer server2 =
+ ProxyServer::FromURI(tests[i].server2, ProxyServer::SCHEME_HTTP);
switch (tests[i].expected_comparison) {
case -1:
@@ -366,3 +332,7 @@
}
}
}
+
+} // namespace
+
+} // namespace net
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index 7de5449..79a21c9 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -785,13 +785,13 @@
class ProxyService::PacRequest
: public base::RefCounted<ProxyService::PacRequest> {
public:
- PacRequest(ProxyService* service,
- const GURL& url,
- int load_flags,
- NetworkDelegate* network_delegate,
- ProxyInfo* results,
- const net::CompletionCallback& user_callback,
- const BoundNetLog& net_log)
+ PacRequest(ProxyService* service,
+ const GURL& url,
+ int load_flags,
+ NetworkDelegate* network_delegate,
+ ProxyInfo* results,
+ const CompletionCallback& user_callback,
+ const BoundNetLog& net_log)
: service_(service),
user_callback_(user_callback),
results_(results),
@@ -909,7 +909,7 @@
// Remove this completed PacRequest from the service's pending list.
/// (which will probably cause deletion of |this|).
if (!user_callback_.is_null()) {
- net::CompletionCallback callback = user_callback_;
+ CompletionCallback callback = user_callback_;
service_->RemovePendingRequest(this);
callback.Run(result_code);
}
@@ -921,7 +921,7 @@
// requests are cancelled during ~ProxyService, so this is guaranteed
// to be valid throughout our lifetime.
ProxyService* service_;
- net::CompletionCallback user_callback_;
+ CompletionCallback user_callback_;
ProxyInfo* results_;
GURL url_;
int load_flags_;
@@ -992,7 +992,7 @@
// static
ProxyService* ProxyService::CreateFixed(const std::string& proxy) {
- net::ProxyConfig proxy_config;
+ ProxyConfig proxy_config;
proxy_config.proxy_rules().ParseFromString(proxy);
return ProxyService::CreateFixed(proxy_config);
}
@@ -1026,7 +1026,7 @@
int ProxyService::ResolveProxy(const GURL& raw_url,
int load_flags,
ProxyInfo* result,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
PacRequest** pac_request,
NetworkDelegate* network_delegate,
const BoundNetLog& net_log) {
@@ -1043,7 +1043,7 @@
int ProxyService::ResolveProxyHelper(const GURL& raw_url,
int load_flags,
ProxyInfo* result,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
PacRequest** pac_request,
NetworkDelegate* network_delegate,
const BoundNetLog& net_log) {
@@ -1105,7 +1105,7 @@
ProxyInfo* result,
NetworkDelegate* network_delegate,
const BoundNetLog& net_log) {
- net::CompletionCallback null_callback;
+ CompletionCallback null_callback;
return ResolveProxyHelper(raw_url,
load_flags,
result,
@@ -1557,10 +1557,9 @@
// Emit the proxy settings change to the NetLog stream.
if (net_log_) {
- net_log_->AddGlobalEntry(
- net::NetLog::TYPE_PROXY_CONFIG_CHANGED,
- base::Bind(&NetLogProxyConfigChangedCallback,
- &fetched_config_, &effective_config));
+ net_log_->AddGlobalEntry(NetLog::TYPE_PROXY_CONFIG_CHANGED,
+ base::Bind(&NetLogProxyConfigChangedCallback,
+ &fetched_config_, &effective_config));
}
// Set the new configuration as the most recently fetched one.
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index f5437d5..232a944 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -126,7 +126,7 @@
int ResolveProxy(const GURL& url,
int load_flags,
ProxyInfo* results,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
PacRequest** pac_request,
NetworkDelegate* network_delegate,
const BoundNetLog& net_log);
@@ -336,7 +336,7 @@
int ResolveProxyHelper(const GURL& url,
int load_flags,
ProxyInfo* results,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
PacRequest** pac_request,
NetworkDelegate* network_delegate,
const BoundNetLog& net_log);
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
index db4151db..4f15690 100644
--- a/net/proxy/proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -250,9 +250,8 @@
ProxyInfo info;
TestCompletionCallback callback;
BoundTestNetLog log;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, NULL,
- log.bound());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, log.bound());
EXPECT_EQ(OK, rv);
EXPECT_TRUE(resolver.pending_requests().empty());
@@ -290,16 +289,14 @@
BoundTestNetLog log;
// First, warm up the ProxyService.
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, NULL,
- log.bound());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, log.bound());
EXPECT_EQ(OK, rv);
// Verify that network delegate is invoked.
TestResolveProxyNetworkDelegate delegate;
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, &delegate,
- log.bound());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(), NULL,
+ &delegate, log.bound());
EXPECT_TRUE(delegate.on_resolve_proxy_called());
EXPECT_EQ(&service, delegate.proxy_service());
@@ -309,24 +306,21 @@
delegate.set_add_proxy(true);
// Callback should interpose:
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, &delegate,
- log.bound());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(), NULL,
+ &delegate, log.bound());
EXPECT_FALSE(info.is_direct());
EXPECT_EQ(info.proxy_server().host_port_pair().host(), "delegate_proxy.com");
delegate.set_add_proxy(false);
// Check non-bypassed URL:
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, &delegate,
- log.bound());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(), NULL,
+ &delegate, log.bound());
EXPECT_FALSE(info.is_direct());
EXPECT_EQ(info.proxy_server().host_port_pair().host(), "foopy1");
// Check bypassed URL:
- rv = service.ResolveProxy(
- bypass_url, net::LOAD_NORMAL, &info, callback.callback(), NULL,
- &delegate, log.bound());
+ rv = service.ResolveProxy(bypass_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, &delegate, log.bound());
EXPECT_TRUE(info.is_direct());
}
@@ -349,32 +343,28 @@
BoundTestNetLog log;
// First, warm up the ProxyService.
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, NULL,
- log.bound());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, log.bound());
EXPECT_EQ(OK, rv);
TestResolveProxyNetworkDelegate delegate;
delegate.set_remove_proxy(true);
// Callback should interpose:
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, &delegate,
- log.bound());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(), NULL,
+ &delegate, log.bound());
EXPECT_TRUE(info.is_direct());
delegate.set_remove_proxy(false);
// Check non-bypassed URL:
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, &delegate,
- log.bound());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(), NULL,
+ &delegate, log.bound());
EXPECT_FALSE(info.is_direct());
EXPECT_EQ(info.proxy_server().host_port_pair().host(), "foopy1");
// Check bypassed URL:
- rv = service.ResolveProxy(
- bypass_url, net::LOAD_NORMAL, &info, callback.callback(), NULL,
- &delegate, log.bound());
+ rv = service.ResolveProxy(bypass_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, &delegate, log.bound());
EXPECT_TRUE(info.is_direct());
}
@@ -395,9 +385,8 @@
ProxyService::PacRequest* request;
BoundTestNetLog log;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), &request, NULL,
- log.bound());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(),
+ &request, NULL, log.bound());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(LOAD_STATE_RESOLVING_PROXY_FOR_URL, service.GetLoadState(request));
@@ -453,9 +442,8 @@
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -484,9 +472,8 @@
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -516,8 +503,8 @@
TestCompletionCallback callback2;
ProxyServer expected_proxy_server = info.proxy_server();
rv = service.ReconsiderProxyAfterError(
- url, net::LOAD_NORMAL, net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback2.callback(), NULL, &network_delegate, BoundNetLog());
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback2.callback(), NULL, &network_delegate, BoundNetLog());
// ReconsiderProxyAfterError returns error indicating nothing left.
EXPECT_EQ(ERR_FAILED, rv);
EXPECT_TRUE(info.is_empty());
@@ -538,9 +525,8 @@
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -596,9 +582,8 @@
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -618,10 +603,9 @@
// Fallback 1.
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback2.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foobar:10", info.proxy_server().ToURI());
@@ -630,20 +614,18 @@
NetworkDelegateImpl network_delegate;
ProxyServer expected_proxy_server3 = info.proxy_server();
TestCompletionCallback callback3;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback3.callback(), NULL,
- &network_delegate, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback3.callback(), NULL, &network_delegate, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
// Fallback 3.
ProxyServer expected_proxy_server4 = info.proxy_server();
TestCompletionCallback callback4;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback4.callback(), NULL,
- &network_delegate, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback4.callback(), NULL, &network_delegate, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foobar:20", info.proxy_server().ToURI());
@@ -651,10 +633,9 @@
// Fallback 4 -- Nothing to fall back to!
ProxyServer expected_proxy_server5 = info.proxy_server();
TestCompletionCallback callback5;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback5.callback(), NULL,
- &network_delegate, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback5.callback(), NULL, &network_delegate, BoundNetLog());
EXPECT_EQ(ERR_FAILED, rv);
EXPECT_TRUE(info.is_empty());
}
@@ -676,9 +657,8 @@
GURL url("http://www.google.com/");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
ASSERT_EQ(ERR_IO_PENDING, rv);
resolver.pending_set_pac_script_request()->CompleteNow(OK);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -714,9 +694,8 @@
GURL url("http://www.google.com/");
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -742,9 +721,8 @@
// The second resolve request will try to run through the proxy resolver,
// regardless of whether the first request failed in it.
TestCompletionCallback callback2;
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback2.callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback2.callback(), NULL,
+ NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -780,9 +758,8 @@
GURL url("http://www.google.com/");
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -799,9 +776,8 @@
// As the proxy resolver failed the request and is configured for a mandatory
// PAC script, ProxyService must not implicitly fall-back to DIRECT.
TestCompletionCallback callback2;
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback2.callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback2.callback(), NULL,
+ NULL, BoundNetLog());
EXPECT_EQ(ERR_MANDATORY_PROXY_CONFIGURATION_FAILED, rv);
EXPECT_FALSE(info.is_direct());
}
@@ -831,9 +807,8 @@
GURL url("http://www.google.com/");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -877,9 +852,8 @@
GURL url("http://www.google.com/");
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -901,9 +875,8 @@
// The second resolve request will try to run through the proxy resolver,
// regardless of whether the first request failed in it.
TestCompletionCallback callback2;
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback2.callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback2.callback(), NULL,
+ NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -937,9 +910,8 @@
// Get the proxy information.
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -967,10 +939,9 @@
// Fake an error on the proxy.
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback2.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
// Proxy times should not have been modified by fallback.
@@ -984,13 +955,12 @@
TestProxyFallbackNetworkDelegate test_delegate;
service.ReportSuccess(info, &test_delegate);
EXPECT_EQ("foopy1:8080", test_delegate.proxy_server().ToURI());
- EXPECT_EQ(net::ERR_PROXY_CONNECTION_FAILED,
+ EXPECT_EQ(ERR_PROXY_CONNECTION_FAILED,
test_delegate.proxy_fallback_net_error());
TestCompletionCallback callback3;
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback3.callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback3.callback(), NULL,
+ NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -1016,10 +986,9 @@
// We fake another error. It should now try the third one.
TestCompletionCallback callback4;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback4.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback4.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI());
@@ -1027,20 +996,18 @@
// proxy servers we thought were valid; next we try the proxy server
// that was in our bad proxies map (foopy1:8080).
TestCompletionCallback callback5;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback5.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback5.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
// Fake another error, the last proxy is gone, the list should now be empty,
// so there is nothing left to try.
TestCompletionCallback callback6;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback6.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback6.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_FAILED, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_TRUE(info.is_empty());
@@ -1051,8 +1018,8 @@
// Look up proxies again
TestCompletionCallback callback7;
- rv = service.ResolveProxy(url, net::LOAD_NORMAL, &info, callback7.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback7.callback(), NULL,
+ NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -1092,9 +1059,8 @@
// Get the proxy information.
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -1116,10 +1082,9 @@
// Fake an error on the proxy.
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback2.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
// Now we get back the second proxy.
@@ -1127,10 +1092,9 @@
// Fake an error on this proxy as well.
TestCompletionCallback callback3;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback3.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback3.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
// Finally, we get back DIRECT.
@@ -1142,10 +1106,9 @@
// Now we tell the proxy service that even DIRECT failed.
TestCompletionCallback callback4;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback4.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback4.callback(), NULL, NULL, BoundNetLog());
// There was nothing left to try after DIRECT, so we are out of
// choices.
EXPECT_EQ(ERR_FAILED, rv);
@@ -1168,9 +1131,8 @@
// Get the proxy information.
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -1195,10 +1157,9 @@
ProxyConfig::CreateFromCustomPacURL(GURL("http://foopy-new/proxy.pac")));
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback2.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy-new/proxy.pac"),
@@ -1218,10 +1179,9 @@
// We fake another error. It should now ignore the first one.
TestCompletionCallback callback3;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback3.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback3.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy2:9090", info.proxy_server().ToURI());
@@ -1232,10 +1192,9 @@
// We fake another error. It should go back to the first proxy.
TestCompletionCallback callback4;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback4.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback4.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy-new2/proxy.pac"),
@@ -1274,9 +1233,8 @@
// Get the proxy information.
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -1296,10 +1254,9 @@
// Fake a proxy error.
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback2.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
// The first proxy is ignored, and the second one is selected.
@@ -1309,9 +1266,8 @@
// Fake a PAC failure.
ProxyInfo info2;
TestCompletionCallback callback3;
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info2, callback3.callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info2, callback3.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -1331,10 +1287,9 @@
// "just work" the next time we call it.
ProxyInfo info3;
TestCompletionCallback callback4;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info3, callback4.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info3,
+ callback4.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -1375,9 +1330,8 @@
// Get the proxy information.
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback1.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -1397,10 +1351,9 @@
// Fake a proxy error.
TestCompletionCallback callback2;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info, callback2.callback(), NULL,
- NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
// The first proxy is ignored, and the second one is selected.
@@ -1410,9 +1363,8 @@
// Fake a PAC failure.
ProxyInfo info2;
TestCompletionCallback callback3;
- rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info2, callback3.callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(url, LOAD_NORMAL, &info2, callback3.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -1433,10 +1385,9 @@
// "just work" the next time we call it.
ProxyInfo info3;
TestCompletionCallback callback4;
- rv = service.ReconsiderProxyAfterError(url, net::LOAD_NORMAL,
- net::ERR_PROXY_CONNECTION_FAILED,
- &info3, callback4.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ReconsiderProxyAfterError(
+ url, LOAD_NORMAL, ERR_PROXY_CONNECTION_FAILED, &info3,
+ callback4.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -1470,16 +1421,14 @@
GURL url2("http://www.webkit.com");
// Request for a .org domain should bypass proxy.
- rv = service.ResolveProxy(
- url1, net::LOAD_NORMAL, &info[0], callback[0].callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(url1, LOAD_NORMAL, &info[0], callback[0].callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info[0].is_direct());
// Request for a .com domain hits the proxy.
- rv = service.ResolveProxy(
- url2, net::LOAD_NORMAL, &info[1], callback[1].callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(url2, LOAD_NORMAL, &info[1], callback[1].callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy1:8080", info[1].proxy_server().ToURI());
}
@@ -1494,9 +1443,9 @@
GURL test_url("http://www.msn.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
@@ -1506,9 +1455,9 @@
GURL test_url("ftp://ftp.google.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info.is_direct());
EXPECT_EQ("direct://", info.proxy_server().ToURI());
@@ -1518,9 +1467,9 @@
GURL test_url("https://webbranch.techcu.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy2:8080", info.proxy_server().ToURI());
@@ -1531,9 +1480,9 @@
GURL test_url("http://www.microsoft.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
@@ -1552,9 +1501,9 @@
GURL test_url("http://www.google.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
ASSERT_EQ(OK, rv);
// Should be SOURCE_TEST, even if there are no HTTP proxies configured.
EXPECT_EQ(PROXY_CONFIG_SOURCE_TEST, info.config_source());
@@ -1567,9 +1516,9 @@
GURL test_url("https://www.google.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
ASSERT_EQ(OK, rv);
// Used the HTTPS proxy. So source should be TEST.
EXPECT_EQ(PROXY_CONFIG_SOURCE_TEST, info.config_source());
@@ -1581,9 +1530,9 @@
GURL test_url("http://www.google.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
ASSERT_EQ(OK, rv);
// ProxyConfig is empty. Source should still be TEST.
EXPECT_EQ(PROXY_CONFIG_SOURCE_TEST, info.config_source());
@@ -1604,9 +1553,9 @@
GURL test_url("http://www.msn.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
@@ -1616,9 +1565,9 @@
GURL test_url("ftp://ftp.google.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI());
@@ -1628,9 +1577,9 @@
GURL test_url("https://webbranch.techcu.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI());
@@ -1640,9 +1589,9 @@
GURL test_url("unknown://www.microsoft.com");
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(test_url, net::LOAD_NORMAL, &info,
- callback.callback(), NULL,
- NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(test_url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("socks4://foopy2:1080", info.proxy_server().ToURI());
@@ -1664,9 +1613,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info1, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// Nothing has been sent to the proxy resolver yet, since the proxy
@@ -1684,7 +1633,7 @@
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info2,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
callback2.callback(), &request2, NULL,
BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -1693,7 +1642,7 @@
ProxyInfo info3;
TestCompletionCallback callback3;
- rv = service.ResolveProxy(GURL("http://request3"), net::LOAD_NORMAL, &info3,
+ rv = service.ResolveProxy(GURL("http://request3"), LOAD_NORMAL, &info3,
callback3.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(3u, resolver.pending_requests().size());
@@ -1746,8 +1695,8 @@
ProxyInfo info1;
TestCompletionCallback callback1;
ProxyService::PacRequest* request1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info1, callback1.callback(), &request1, NULL,
+ int rv = service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), &request1, NULL,
BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -1758,7 +1707,7 @@
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info2,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
callback2.callback(), &request2, NULL,
BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -1766,7 +1715,7 @@
ProxyInfo info3;
TestCompletionCallback callback3;
ProxyService::PacRequest* request3;
- rv = service.ResolveProxy(GURL("http://request3"), net::LOAD_NORMAL, &info3,
+ rv = service.ResolveProxy(GURL("http://request3"), LOAD_NORMAL, &info3,
callback3.callback(), &request3, NULL,
BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -1852,9 +1801,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info1, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered download of PAC script.
@@ -1863,7 +1812,7 @@
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info2,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -1914,9 +1863,9 @@
TestCompletionCallback callback1;
ProxyService::PacRequest* request1;
BoundTestNetLog log1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info1, callback1.callback(), &request1, NULL,
- log1.bound());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), &request1, NULL, log1.bound());
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered download of PAC script.
@@ -1926,14 +1875,14 @@
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info2,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
callback2.callback(), &request2, NULL,
BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info3;
TestCompletionCallback callback3;
- rv = service.ResolveProxy(GURL("http://request3"), net::LOAD_NORMAL, &info3,
+ rv = service.ResolveProxy(GURL("http://request3"), LOAD_NORMAL, &info3,
callback3.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -2008,15 +1957,15 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info1, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info2,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
callback2.callback(), &request2, NULL,
BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -2088,15 +2037,15 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info1, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info2,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
callback2.callback(), &request2, NULL,
BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -2164,15 +2113,15 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info1, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ProxyInfo info2;
TestCompletionCallback callback2;
ProxyService::PacRequest* request2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info2,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
callback2.callback(), &request2, NULL,
BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -2225,9 +2174,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- GURL("http://www.google.com"), net::LOAD_NORMAL, &info1,
- callback1.callback(), NULL, NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://www.google.com"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -2257,9 +2206,8 @@
// Start another request, it should pickup the bypass item.
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(GURL("http://www.google.com"), net::LOAD_NORMAL,
- &info2, callback2.callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(GURL("http://www.google.com"), LOAD_NORMAL, &info2,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
ASSERT_EQ(1u, resolver.pending_requests().size());
@@ -2296,9 +2244,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://www.google.com"), net::LOAD_NORMAL,
- &info1, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://www.google.com"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -2328,9 +2276,8 @@
ProxyInfo info;
TestCompletionCallback callback;
- int rv = service.ResolveProxy(
- url, net::LOAD_NORMAL, &info, callback.callback(), NULL, NULL,
- BoundNetLog());
+ int rv = service.ResolveProxy(url, LOAD_NORMAL, &info, callback.callback(),
+ NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
EXPECT_EQ(GURL("http://foopy/proxy.pac"),
@@ -2345,9 +2292,9 @@
ProxyInfo info;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy1:8080", info.proxy_server().ToURI());
@@ -2356,7 +2303,7 @@
config2.set_auto_detect(false);
service.ResetConfigService(new MockProxyConfigService(config2));
TestCompletionCallback callback2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info,
callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_EQ("foopy2:8080", info.proxy_server().ToURI());
@@ -2377,9 +2324,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://www.google.com"), net::LOAD_NORMAL,
- &info1, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://www.google.com"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that nothing has been sent to the proxy resolver yet.
@@ -2409,9 +2356,8 @@
// Start another request -- the effective configuration has changed.
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(GURL("http://www.google.com"), net::LOAD_NORMAL,
- &info2, callback2.callback(), NULL, NULL,
- BoundNetLog());
+ rv = service.ResolveProxy(GURL("http://www.google.com"), LOAD_NORMAL, &info2,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info2.is_direct());
@@ -2441,9 +2387,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(GURL("http://request1"), net::LOAD_NORMAL,
- &info1, callback1.callback(), NULL, NULL,
- BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered initial download of PAC script.
@@ -2484,7 +2430,7 @@
// Start a second request.
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(GURL("http://request2"), net::LOAD_NORMAL, &info2,
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
@@ -2557,9 +2503,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- GURL("http://request1"), net::LOAD_NORMAL, &info1, callback1.callback(),
- NULL, NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered initial download of PAC script.
@@ -2618,9 +2564,8 @@
// Start a second request.
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(
- GURL("http://request2"), net::LOAD_NORMAL, &info2, callback2.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that it was sent to the resolver.
@@ -2663,9 +2608,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- GURL("http://request1"), net::LOAD_NORMAL, &info1, callback1.callback(),
- NULL, NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered initial download of PAC script.
@@ -2729,9 +2674,8 @@
// Start a second request.
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(
- GURL("http://request2"), net::LOAD_NORMAL, &info2, callback2.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that it was sent to the resolver.
@@ -2774,9 +2718,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- GURL("http://request1"), net::LOAD_NORMAL, &info1, callback1.callback(),
- NULL, NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered initial download of PAC script.
@@ -2836,9 +2780,8 @@
// Start a second request.
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(
- GURL("http://request2"), net::LOAD_NORMAL, &info2, callback2.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// Check that it was sent to the resolver.
@@ -2881,9 +2824,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- GURL("http://request1"), net::LOAD_NORMAL, &info1, callback1.callback(),
- NULL, NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered initial download of PAC script.
@@ -2941,9 +2884,8 @@
// Start a second request.
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(
- GURL("http://request2"), net::LOAD_NORMAL, &info2, callback2.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info2.is_direct());
}
@@ -3034,9 +2976,9 @@
ProxyInfo info1;
TestCompletionCallback callback1;
- int rv = service.ResolveProxy(
- GURL("http://request1"), net::LOAD_NORMAL, &info1, callback1.callback(),
- NULL, NULL, BoundNetLog());
+ int rv =
+ service.ResolveProxy(GURL("http://request1"), LOAD_NORMAL, &info1,
+ callback1.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// The first request should have triggered initial download of PAC script.
@@ -3078,9 +3020,8 @@
// Start a second request.
ProxyInfo info2;
TestCompletionCallback callback2;
- rv = service.ResolveProxy(
- GURL("http://request2"), net::LOAD_NORMAL, &info2, callback2.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ResolveProxy(GURL("http://request2"), LOAD_NORMAL, &info2,
+ callback2.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
// This request should have sent work to the resolver; complete it.
@@ -3109,9 +3050,8 @@
// since the PAC script poller experienced a failure.
ProxyInfo info3;
TestCompletionCallback callback3;
- rv = service.ResolveProxy(
- GURL("http://request3"), net::LOAD_NORMAL, &info3, callback3.callback(),
- NULL, NULL, BoundNetLog());
+ rv = service.ResolveProxy(GURL("http://request3"), LOAD_NORMAL, &info3,
+ callback3.callback(), NULL, NULL, BoundNetLog());
EXPECT_EQ(OK, rv);
EXPECT_TRUE(info3.is_direct());
}
@@ -3134,7 +3074,7 @@
BoundTestNetLog log;
bool synchronous_success = service.TryResolveProxySynchronously(
- url, net::LOAD_NORMAL, &info, NULL, log.bound());
+ url, LOAD_NORMAL, &info, NULL, log.bound());
EXPECT_FALSE(synchronous_success);
// No request should have been queued.
@@ -3163,7 +3103,7 @@
BoundTestNetLog log;
bool synchronous_success = service.TryResolveProxySynchronously(
- url, net::LOAD_NORMAL, &info, NULL, log.bound());
+ url, LOAD_NORMAL, &info, NULL, log.bound());
EXPECT_TRUE(synchronous_success);
EXPECT_FALSE(info.is_direct());
EXPECT_EQ("foopy1", info.proxy_server().host_port_pair().host());
diff --git a/net/quic/crypto/crypto_framer_test.cc b/net/quic/crypto/crypto_framer_test.cc
index ce815a8..23846a6 100644
--- a/net/quic/crypto/crypto_framer_test.cc
+++ b/net/quic/crypto/crypto_framer_test.cc
@@ -29,7 +29,7 @@
namespace test {
-class TestCryptoVisitor : public ::net::CryptoFramerVisitorInterface {
+class TestCryptoVisitor : public CryptoFramerVisitorInterface {
public:
TestCryptoVisitor() : error_count_(0) {}
diff --git a/net/quic/crypto/local_strike_register_client_test.cc b/net/quic/crypto/local_strike_register_client_test.cc
index b713c10..5665cb6 100644
--- a/net/quic/crypto/local_strike_register_client_test.cc
+++ b/net/quic/crypto/local_strike_register_client_test.cc
@@ -63,7 +63,7 @@
void SetUp() override {
strike_register_.reset(new LocalStrikeRegisterClient(
kMaxEntries, kCurrentTimeExternalSecs, kWindowSecs, kOrbit,
- net::StrikeRegister::NO_STARTUP_PERIOD_NEEDED));
+ StrikeRegister::NO_STARTUP_PERIOD_NEEDED));
}
scoped_ptr<LocalStrikeRegisterClient> strike_register_;
diff --git a/net/quic/crypto/strike_register_test.cc b/net/quic/crypto/strike_register_test.cc
index 73a6b2f..b2a73c8 100644
--- a/net/quic/crypto/strike_register_test.cc
+++ b/net/quic/crypto/strike_register_test.cc
@@ -11,10 +11,10 @@
#include "base/rand_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace net {
+
namespace {
-using net::InsertStatus;
-using net::StrikeRegister;
using std::min;
using std::pair;
using std::set;
@@ -40,9 +40,9 @@
StrikeRegister::DENY_REQUESTS_AT_STARTUP);
uint8 nonce[32];
SetNonce(nonce, 999, kOrbit);
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1000));
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1000));
SetNonce(nonce, 1000, kOrbit);
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1000));
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1000));
EXPECT_EQ(0u, set.GetCurrentValidWindowSecs(1000 /* current time */));
EXPECT_EQ(0u, set.GetCurrentValidWindowSecs(1100 /* current time */));
@@ -60,8 +60,8 @@
StrikeRegister::NO_STARTUP_PERIOD_NEEDED);
uint8 nonce[32];
SetNonce(nonce, 1000, kOrbit);
- EXPECT_EQ(net::NONCE_OK, set.Insert(nonce, 1000));
- EXPECT_EQ(net::NONCE_NOT_UNIQUE_FAILURE, set.Insert(nonce, 1000));
+ EXPECT_EQ(NONCE_OK, set.Insert(nonce, 1000));
+ EXPECT_EQ(NONCE_NOT_UNIQUE_FAILURE, set.Insert(nonce, 1000));
EXPECT_EQ(101u, set.GetCurrentValidWindowSecs(1000 /* current time */));
EXPECT_EQ(101u, set.GetCurrentValidWindowSecs(1050 /* current time */));
@@ -77,9 +77,9 @@
StrikeRegister::DENY_REQUESTS_AT_STARTUP);
uint8 nonce[32];
SetNonce(nonce, 1101, kOrbit);
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1000));
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1000));
SetNonce(nonce, 999, kOrbit);
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1100));
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1100));
}
TEST(StrikeRegisterTest, BadOrbit) {
@@ -90,7 +90,7 @@
uint8 nonce[32];
static const uint8 kBadOrbit[8] = { 0, 0, 0, 0, 1, 1, 1, 1 };
SetNonce(nonce, 1101, kBadOrbit);
- EXPECT_EQ(net::NONCE_INVALID_ORBIT_FAILURE, set.Insert(nonce, 1100));
+ EXPECT_EQ(NONCE_INVALID_ORBIT_FAILURE, set.Insert(nonce, 1100));
}
TEST(StrikeRegisterTest, OneValue) {
@@ -99,7 +99,7 @@
StrikeRegister::DENY_REQUESTS_AT_STARTUP);
uint8 nonce[32];
SetNonce(nonce, 1101, kOrbit);
- EXPECT_EQ(net::NONCE_OK, set.Insert(nonce, 1101));
+ EXPECT_EQ(NONCE_OK, set.Insert(nonce, 1101));
}
TEST(StrikeRegisterTest, RejectDuplicate) {
@@ -109,8 +109,8 @@
StrikeRegister::DENY_REQUESTS_AT_STARTUP);
uint8 nonce[32];
SetNonce(nonce, 1101, kOrbit);
- EXPECT_EQ(net::NONCE_OK, set.Insert(nonce, 1101));
- EXPECT_EQ(net::NONCE_NOT_UNIQUE_FAILURE, set.Insert(nonce, 1101));
+ EXPECT_EQ(NONCE_OK, set.Insert(nonce, 1101));
+ EXPECT_EQ(NONCE_NOT_UNIQUE_FAILURE, set.Insert(nonce, 1101));
}
TEST(StrikeRegisterTest, HorizonUpdating) {
@@ -127,7 +127,7 @@
for (unsigned i = 0; i < 5; i++) {
SetNonce(nonce[i], 1101 + i, kOrbit);
nonce[i][31] = i;
- EXPECT_EQ(net::NONCE_OK, set.Insert(nonce[i], 1100));
+ EXPECT_EQ(NONCE_OK, set.Insert(nonce[i], 1100));
}
// Valid window is still equal to |window_secs + 1|.
@@ -136,34 +136,34 @@
// This should push the oldest value out and force the horizon to
// be updated.
SetNonce(nonce[5], 1110, kOrbit);
- EXPECT_EQ(net::NONCE_OK, set.Insert(nonce[5], 1110));
+ EXPECT_EQ(NONCE_OK, set.Insert(nonce[5], 1110));
// Effective horizon is computed based on the timestamp of the
// value that was pushed out.
EXPECT_EQ(9u, set.GetCurrentValidWindowSecs(1110));
SetNonce(nonce[5], 1111, kOrbit);
- EXPECT_EQ(net::NONCE_OK, set.Insert(nonce[5], 1110));
+ EXPECT_EQ(NONCE_OK, set.Insert(nonce[5], 1110));
EXPECT_EQ(8u, set.GetCurrentValidWindowSecs(1110));
// This should be behind the horizon now:
SetNonce(nonce[5], 1101, kOrbit);
nonce[5][31] = 10;
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, set.Insert(nonce[5], 1110));
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce[5], 1110));
// Insert beyond the valid range.
SetNonce(nonce[5], 1117, kOrbit);
nonce[5][31] = 2;
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, set.Insert(nonce[5], 1110));
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce[5], 1110));
// Insert at the upper valid range.
SetNonce(nonce[5], 1116, kOrbit);
nonce[5][31] = 1;
- EXPECT_EQ(net::NONCE_OK, set.Insert(nonce[5], 1110));
+ EXPECT_EQ(NONCE_OK, set.Insert(nonce[5], 1110));
// This should be beyond the upper valid range now:
SetNonce(nonce[5], 1116, kOrbit);
nonce[5][31] = 2;
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, set.Insert(nonce[5], 1110));
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce[5], 1110));
}
}
@@ -177,7 +177,7 @@
for (unsigned i = 0; i < 100000; i++) {
SetNonce(nonce, 1101 + i/500, kOrbit);
memcpy(nonce + 12, &i, sizeof(i));
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1100));
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, set.Insert(nonce, 1100));
}
}
@@ -212,7 +212,7 @@
// Check to see if the orbit is correct.
if (memcmp(nonce_bytes + 4, orbit_, sizeof(orbit_))) {
- return net::NONCE_INVALID_ORBIT_FAILURE;
+ return NONCE_INVALID_ORBIT_FAILURE;
}
const uint32 nonce_time =
ExternalTimeToInternal(TimeFromBytes(nonce_bytes));
@@ -221,14 +221,14 @@
// so we have to reject anything with a timestamp less than or
// equal to that.
if (nonce_time < horizon_) {
- return net::NONCE_INVALID_TIME_FAILURE;
+ return NONCE_INVALID_TIME_FAILURE;
}
// Check that the timestamp is in the current window.
if ((current_time > window_secs_ &&
nonce_time < (current_time - window_secs_)) ||
nonce_time > (current_time + window_secs_)) {
- return net::NONCE_INVALID_TIME_FAILURE;
+ return NONCE_INVALID_TIME_FAILURE;
}
pair<uint32, string> nonce = std::make_pair(
@@ -236,11 +236,11 @@
set<pair<uint32, string> >::const_iterator it = nonces_.find(nonce);
if (it != nonces_.end()) {
- return net::NONCE_NOT_UNIQUE_FAILURE;
+ return NONCE_NOT_UNIQUE_FAILURE;
}
nonces_.insert(nonce);
- return net::NONCE_OK;
+ return NONCE_OK;
}
uint32 GetCurrentValidWindowSecs(const uint32 current_time_external) const {
@@ -319,9 +319,9 @@
// Inserts succeed after the startup period.
if (time > current_time + window) {
- EXPECT_EQ(net::NONCE_OK, nonce_error1);
+ EXPECT_EQ(NONCE_OK, nonce_error1);
} else {
- EXPECT_EQ(net::NONCE_INVALID_TIME_FAILURE, nonce_error1);
+ EXPECT_EQ(NONCE_INVALID_TIME_FAILURE, nonce_error1);
}
EXPECT_EQ(s1->GetCurrentValidWindowSecs(time),
s2->GetCurrentValidWindowSecs(time));
@@ -403,4 +403,6 @@
}
}
-} // anonymous namespace
+} // namespace
+
+} // namespace net
diff --git a/net/quic/quic_default_packet_writer.cc b/net/quic/quic_default_packet_writer.cc
index 177d292..aea9e9b 100644
--- a/net/quic/quic_default_packet_writer.cc
+++ b/net/quic/quic_default_packet_writer.cc
@@ -27,8 +27,8 @@
WriteResult QuicDefaultPacketWriter::WritePacket(
const char* buffer,
size_t buf_len,
- const net::IPAddressNumber& self_address,
- const net::IPEndPoint& peer_address) {
+ const IPAddressNumber& self_address,
+ const IPEndPoint& peer_address) {
scoped_refptr<StringIOBuffer> buf(
new StringIOBuffer(std::string(buffer, buf_len)));
DCHECK(!IsWriteBlocked());
diff --git a/net/quic/quic_end_to_end_unittest.cc b/net/quic/quic_end_to_end_unittest.cc
index 1e948b8a..a07d32d 100644
--- a/net/quic/quic_end_to_end_unittest.cc
+++ b/net/quic/quic_end_to_end_unittest.cc
@@ -31,12 +31,14 @@
#include "testing/platform_test.h"
using base::StringPiece;
-using net::tools::QuicInMemoryCache;
-using net::tools::QuicServer;
-using net::tools::test::QuicInMemoryCachePeer;
-using net::tools::test::ServerThread;
namespace net {
+
+using tools::QuicInMemoryCache;
+using tools::QuicServer;
+using tools::test::QuicInMemoryCachePeer;
+using tools::test::ServerThread;
+
namespace test {
namespace {
@@ -127,8 +129,8 @@
// Starts the QUIC server listening on a random port.
void StartServer() {
- net::IPAddressNumber ip;
- CHECK(net::ParseIPLiteralToNumber("127.0.0.1", &ip));
+ IPAddressNumber ip;
+ CHECK(ParseIPLiteralToNumber("127.0.0.1", &ip));
server_address_ = IPEndPoint(ip, 0);
server_config_.SetInitialStreamFlowControlWindowToSend(
kInitialStreamFlowControlWindowForTest);
diff --git a/net/quic/quic_framer_test.cc b/net/quic/quic_framer_test.cc
index 4c46574..ee588cb 100644
--- a/net/quic/quic_framer_test.cc
+++ b/net/quic/quic_framer_test.cc
@@ -166,7 +166,7 @@
string ciphertext_;
};
-class TestQuicVisitor : public ::net::QuicFramerVisitorInterface {
+class TestQuicVisitor : public QuicFramerVisitorInterface {
public:
TestQuicVisitor()
: error_count_(0),
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc
index 67428f7..c312993c 100644
--- a/net/quic/quic_network_transaction_unittest.cc
+++ b/net/quic/quic_network_transaction_unittest.cc
@@ -412,22 +412,20 @@
SendRequestAndExpectQuicResponse("hello!");
// Check that the NetLog was filled reasonably.
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
net_log_.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
// Check that we logged a QUIC_SESSION_PACKET_RECEIVED.
- int pos = net::ExpectLogContainsSomewhere(
- entries, 0,
- net::NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED,
- net::NetLog::PHASE_NONE);
+ int pos = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED,
+ NetLog::PHASE_NONE);
EXPECT_LT(0, pos);
// ... and also a TYPE_QUIC_SESSION_PACKET_HEADER_RECEIVED.
- pos = net::ExpectLogContainsSomewhere(
- entries, 0,
- net::NetLog::TYPE_QUIC_SESSION_PACKET_HEADER_RECEIVED,
- net::NetLog::PHASE_NONE);
+ pos = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_QUIC_SESSION_PACKET_HEADER_RECEIVED,
+ NetLog::PHASE_NONE);
EXPECT_LT(0, pos);
std::string packet_sequence_number;
@@ -436,10 +434,9 @@
EXPECT_EQ("1", packet_sequence_number);
// ... and also a QUIC_SESSION_STREAM_FRAME_RECEIVED.
- pos = net::ExpectLogContainsSomewhere(
- entries, 0,
- net::NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_RECEIVED,
- net::NetLog::PHASE_NONE);
+ pos = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_QUIC_SESSION_STREAM_FRAME_RECEIVED,
+ NetLog::PHASE_NONE);
EXPECT_LT(0, pos);
int log_stream_id;
diff --git a/net/quic/quic_utils_test.cc b/net/quic/quic_utils_test.cc
index d2f2631..d741abb 100644
--- a/net/quic/quic_utils_test.cc
+++ b/net/quic/quic_utils_test.cc
@@ -91,10 +91,10 @@
QuicTagVector parsed_options = QuicUtils::ParseQuicConnectionOptions(
"PACE,TIMER,TBBR,REJ");
QuicTagVector expected_options;
- expected_options.push_back(net::kPACE);
- expected_options.push_back(net::kTIME);
- expected_options.push_back(net::kTBBR);
- expected_options.push_back(net::kREJ);
+ expected_options.push_back(kPACE);
+ expected_options.push_back(kTIME);
+ expected_options.push_back(kTBBR);
+ expected_options.push_back(kREJ);
EXPECT_EQ(expected_options, parsed_options);
}
diff --git a/net/sdch/sdch_owner.cc b/net/sdch/sdch_owner.cc
index 948ee1f0..ac69f3d 100644
--- a/net/sdch/sdch_owner.cc
+++ b/net/sdch/sdch_owner.cc
@@ -345,7 +345,7 @@
int use_count,
const std::string& dictionary_text,
const GURL& dictionary_url,
- const net::BoundNetLog& net_log,
+ const BoundNetLog& net_log,
bool was_from_cache) {
struct DictionaryItem {
base::Time last_used;
@@ -411,9 +411,9 @@
if (total_dictionary_bytes_ + dictionary_text.size() - recoverable_bytes >
max_total_dictionary_size_) {
RecordDictionaryFate(DICTIONARY_FATE_FETCH_IGNORED_NO_SPACE);
- net::SdchManager::SdchErrorRecovery(SDCH_DICTIONARY_NO_ROOM);
- net_log.AddEvent(net::NetLog::TYPE_SDCH_DICTIONARY_ERROR,
- base::Bind(&net::NetLogSdchDictionaryFetchProblemCallback,
+ SdchManager::SdchErrorRecovery(SDCH_DICTIONARY_NO_ROOM);
+ net_log.AddEvent(NetLog::TYPE_SDCH_DICTIONARY_ERROR,
+ base::Bind(&NetLogSdchDictionaryFetchProblemCallback,
SDCH_DICTIONARY_NO_ROOM, dictionary_url, true));
return;
}
@@ -422,14 +422,14 @@
// dictionaries so that no state change will occur if dictionary addition
// fails.
std::string server_hash;
- net::SdchProblemCode rv = manager_->AddSdchDictionary(
+ SdchProblemCode rv = manager_->AddSdchDictionary(
dictionary_text, dictionary_url, &server_hash);
- if (rv != net::SDCH_OK) {
+ if (rv != SDCH_OK) {
RecordDictionaryFate(DICTIONARY_FATE_FETCH_MANAGER_REFUSED);
- net::SdchManager::SdchErrorRecovery(rv);
- net_log.AddEvent(net::NetLog::TYPE_SDCH_DICTIONARY_ERROR,
- base::Bind(&net::NetLogSdchDictionaryFetchProblemCallback,
- rv, dictionary_url, true));
+ SdchManager::SdchErrorRecovery(rv);
+ net_log.AddEvent(NetLog::TYPE_SDCH_DICTIONARY_ERROR,
+ base::Bind(&NetLogSdchDictionaryFetchProblemCallback, rv,
+ dictionary_url, true));
return;
}
@@ -547,7 +547,7 @@
specific_dictionary_map->SetInteger(kDictionaryUseCountKey, use_count + 1);
}
-void SdchOwner::OnGetDictionary(net::SdchManager* manager,
+void SdchOwner::OnGetDictionary(SdchManager* manager,
const GURL& request_url,
const GURL& dictionary_url) {
#if defined(OS_CHROMEOS)
@@ -590,7 +590,7 @@
base::Unretained(this), base::Time(), 0));
}
-void SdchOwner::OnClearDictionaries(net::SdchManager* manager) {
+void SdchOwner::OnClearDictionaries(SdchManager* manager) {
total_dictionary_bytes_ = 0;
fetcher_->Cancel();
diff --git a/net/sdch/sdch_owner.h b/net/sdch/sdch_owner.h
index 053eecd..a600ac8 100644
--- a/net/sdch/sdch_owner.h
+++ b/net/sdch/sdch_owner.h
@@ -32,15 +32,14 @@
// exposes interface for setting SDCH policy. It should be instantiated by
// the net/ embedder.
// TODO(rdsmith): Implement dictionary prioritization.
-class NET_EXPORT SdchOwner : public net::SdchObserver,
- public PrefStore::Observer {
+class NET_EXPORT SdchOwner : public SdchObserver, public PrefStore::Observer {
public:
static const size_t kMaxTotalDictionarySize;
static const size_t kMinSpaceForDictionaryFetch;
// Consumer must guarantee that |sdch_manager| and |context| outlive
// this object.
- SdchOwner(net::SdchManager* sdch_manager, net::URLRequestContext* context);
+ SdchOwner(SdchManager* sdch_manager, URLRequestContext* context);
~SdchOwner() override;
// Enables use of pref persistence. Note that |pref_store| is owned
@@ -59,10 +58,10 @@
// SdchObserver implementation.
void OnDictionaryUsed(SdchManager* manager,
const std::string& server_hash) override;
- void OnGetDictionary(net::SdchManager* manager,
+ void OnGetDictionary(SdchManager* manager,
const GURL& request_url,
const GURL& dictionary_url) override;
- void OnClearDictionaries(net::SdchManager* manager) override;
+ void OnClearDictionaries(SdchManager* manager) override;
// PrefStore::Observer implementation.
void OnPrefValueChanged(const std::string& key) override;
@@ -76,7 +75,7 @@
int use_count,
const std::string& dictionary_text,
const GURL& dictionary_url,
- const net::BoundNetLog& net_log,
+ const BoundNetLog& net_log,
bool was_from_cache);
void SetClockForTesting(scoped_ptr<base::Clock> clock);
@@ -117,8 +116,8 @@
bool IsPersistingDictionaries() const;
// For investigation of http://crbug.com/454198; remove when resolved.
- base::WeakPtr<net::SdchManager> manager_;
- scoped_ptr<net::SdchDictionaryFetcher> fetcher_;
+ base::WeakPtr<SdchManager> manager_;
+ scoped_ptr<SdchDictionaryFetcher> fetcher_;
size_t total_dictionary_bytes_;
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc
index 54af2a8..de0af80a 100644
--- a/net/server/http_server_unittest.cc
+++ b/net/server/http_server_unittest.cc
@@ -99,7 +99,7 @@
int total_bytes_received = 0;
message->clear();
while (total_bytes_received < expected_bytes) {
- net::TestCompletionCallback callback;
+ TestCompletionCallback callback;
ReadInternal(callback.callback());
int bytes_received = callback.WaitForResult();
if (bytes_received <= 0)
@@ -145,7 +145,7 @@
Write();
}
- void ReadInternal(const net::CompletionCallback& callback) {
+ void ReadInternal(const CompletionCallback& callback) {
read_buffer_ = new IOBufferWithSize(kMaxExpectedResponseLength);
int result =
socket_->Read(read_buffer_.get(), kMaxExpectedResponseLength, callback);
@@ -183,7 +183,7 @@
void SetUp() override {
scoped_ptr<ServerSocket> server_socket(
- new TCPServerSocket(NULL, net::NetLog::Source()));
+ new TCPServerSocket(NULL, NetLog::Source()));
server_socket->ListenWithAddressAndPort("127.0.0.1", 0, 1);
server_.reset(new HttpServer(server_socket.Pass(), this));
ASSERT_EQ(OK, server_->GetLocalAddress(&server_address_));
diff --git a/net/server/web_socket.cc b/net/server/web_socket.cc
index e5d1cb7..2ddb03c 100644
--- a/net/server/web_socket.cc
+++ b/net/server/web_socket.cc
@@ -40,12 +40,12 @@
return base::HostToNet32(static_cast<uint32>(number / spaces));
}
-class WebSocketHixie76 : public net::WebSocket {
+class WebSocketHixie76 : public WebSocket {
public:
- static net::WebSocket* Create(HttpServer* server,
- HttpConnection* connection,
- const HttpServerRequestInfo& request,
- size_t* pos) {
+ static WebSocket* Create(HttpServer* server,
+ HttpConnection* connection,
+ const HttpServerRequestInfo& request,
+ size_t* pos) {
if (connection->read_buf()->GetSize() <
static_cast<int>(*pos + kWebSocketHandshakeBodyLen))
return NULL;
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index 2de67bd..2c50266 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -116,9 +116,8 @@
explicit MockClientSocket(net::NetLog* net_log)
: connected_(false),
has_unread_data_(false),
- net_log_(BoundNetLog::Make(net_log, net::NetLog::SOURCE_SOCKET)),
- was_used_to_convey_data_(false) {
- }
+ net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_SOCKET)),
+ was_used_to_convey_data_(false) {}
// Sets whether the socket has unread data. If true, the next call to Read()
// will return 1 byte and IsConnectedAndIdle() will return false.
@@ -295,8 +294,8 @@
int ConnectInternal() override {
AddressList ignored;
- client_socket_factory_->CreateTransportClientSocket(
- ignored, NULL, net::NetLog::Source());
+ client_socket_factory_->CreateTransportClientSocket(ignored, NULL,
+ NetLog::Source());
SetSocket(
scoped_ptr<StreamSocket>(new MockClientSocket(net_log().net_log())));
switch (job_type_) {
@@ -495,7 +494,7 @@
int RequestSocket(const std::string& group_name,
const void* params,
- net::RequestPriority priority,
+ RequestPriority priority,
ClientSocketHandle* handle,
const CompletionCallback& callback,
const BoundNetLog& net_log) override {
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index b3f5040e..79b7a34 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -908,8 +908,8 @@
MockClientSocketFactory::CreateDatagramClientSocket(
DatagramSocket::BindType bind_type,
const RandIntCallback& rand_int_cb,
- net::NetLog* net_log,
- const net::NetLog::Source& source) {
+ NetLog* net_log,
+ const NetLog::Source& source) {
SocketDataProvider* data_provider = mock_data_.GetNext();
scoped_ptr<MockUDPClientSocket> socket(
new MockUDPClientSocket(data_provider, net_log));
@@ -921,8 +921,8 @@
scoped_ptr<StreamSocket> MockClientSocketFactory::CreateTransportClientSocket(
const AddressList& addresses,
- net::NetLog* net_log,
- const net::NetLog::Source& source) {
+ NetLog* net_log,
+ const NetLog::Source& source) {
SocketDataProvider* data_provider = mock_data_.GetNext();
scoped_ptr<MockTCPClientSocket> socket(
new MockTCPClientSocket(addresses, net_log, data_provider));
@@ -1048,7 +1048,7 @@
result));
}
-void MockClientSocket::RunCallback(const net::CompletionCallback& callback,
+void MockClientSocket::RunCallback(const CompletionCallback& callback,
int result) {
if (!callback.is_null())
callback.Run(result);
@@ -1057,7 +1057,7 @@
MockTCPClientSocket::MockTCPClientSocket(const AddressList& addresses,
net::NetLog* net_log,
SocketDataProvider* data)
- : MockClientSocket(BoundNetLog::Make(net_log, net::NetLog::SOURCE_NONE)),
+ : MockClientSocket(BoundNetLog::Make(net_log, NetLog::SOURCE_NONE)),
addresses_(addresses),
data_(data),
read_offset_(0),
@@ -1267,7 +1267,7 @@
}
DeterministicSocketHelper::DeterministicSocketHelper(
- net::NetLog* net_log,
+ NetLog* net_log,
DeterministicSocketData* data)
: write_pending_(false),
write_result_(0),
@@ -1278,7 +1278,7 @@
data_(data),
was_used_to_convey_data_(false),
peer_closed_connection_(false),
- net_log_(BoundNetLog::Make(net_log, net::NetLog::SOURCE_NONE)) {
+ net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_NONE)) {
}
DeterministicSocketHelper::~DeterministicSocketHelper() {}
@@ -1469,7 +1469,7 @@
DeterministicMockTCPClientSocket::DeterministicMockTCPClientSocket(
net::NetLog* net_log,
DeterministicSocketData* data)
- : MockClientSocket(BoundNetLog::Make(net_log, net::NetLog::SOURCE_NONE)),
+ : MockClientSocket(BoundNetLog::Make(net_log, NetLog::SOURCE_NONE)),
helper_(net_log, data) {
peer_addr_ = data->connect_data().peer_addr;
}
@@ -1725,7 +1725,7 @@
source_port_(123),
pending_read_buf_(NULL),
pending_read_buf_len_(0),
- net_log_(BoundNetLog::Make(net_log, net::NetLog::SOURCE_NONE)),
+ net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_NONE)),
weak_factory_(this) {
DCHECK(data_);
data_->Reset();
@@ -1837,7 +1837,7 @@
// let CompleteRead() schedule a callback.
read_data_.mode = SYNCHRONOUS;
- net::CompletionCallback callback = pending_read_callback_;
+ CompletionCallback callback = pending_read_callback_;
int rv = CompleteRead();
RunCallback(callback, rv);
}
@@ -2050,7 +2050,7 @@
last_request_priority_ = priority;
scoped_ptr<StreamSocket> socket =
client_socket_factory_->CreateTransportClientSocket(
- AddressList(), net_log.net_log(), net::NetLog::Source());
+ AddressList(), net_log.net_log(), NetLog::Source());
MockConnectJob* job = new MockConnectJob(socket.Pass(), handle, callback);
job_list_.push_back(job);
handle->set_pool_id(1);
@@ -2105,7 +2105,7 @@
DeterministicMockClientSocketFactory::CreateDatagramClientSocket(
DatagramSocket::BindType bind_type,
const RandIntCallback& rand_int_cb,
- net::NetLog* net_log,
+ NetLog* net_log,
const NetLog::Source& source) {
DeterministicSocketData* data_provider = mock_data().GetNext();
scoped_ptr<DeterministicMockUDPClientSocket> socket(
@@ -2120,8 +2120,8 @@
scoped_ptr<StreamSocket>
DeterministicMockClientSocketFactory::CreateTransportClientSocket(
const AddressList& addresses,
- net::NetLog* net_log,
- const net::NetLog::Source& source) {
+ NetLog* net_log,
+ const NetLog::Source& source) {
DeterministicSocketData* data_provider = mock_data().GetNext();
scoped_ptr<DeterministicMockTCPClientSocket> socket(
new DeterministicMockTCPClientSocket(net_log, data_provider));
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index 4dad762..1baefb7 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -875,15 +875,14 @@
};
// DeterministicSocketHelper is a helper class that can be used
-// to simulate net::Socket::Read() and net::Socket::Write()
+// to simulate Socket::Read() and Socket::Write()
// using deterministic |data|.
// Note: This is provided as a common helper class because
// of the inheritance hierarchy of DeterministicMock[UDP,TCP]ClientSocket and a
// desire not to introduce an additional common base class.
class DeterministicSocketHelper {
public:
- DeterministicSocketHelper(net::NetLog* net_log,
- DeterministicSocketData* data);
+ DeterministicSocketHelper(NetLog* net_log, DeterministicSocketData* data);
virtual ~DeterministicSocketHelper();
bool write_pending() const { return write_pending_; }
@@ -1143,7 +1142,7 @@
ClientSocketHandle* handle() { return &handle_; }
- const net::CompletionCallback& callback() const { return callback_; }
+ const CompletionCallback& callback() const { return callback_; }
private:
void OnComplete(int result);
diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc
index e481b4fa..0073a1b3 100644
--- a/net/socket/transport_client_socket_unittest.cc
+++ b/net/socket/transport_client_socket_unittest.cc
@@ -185,12 +185,12 @@
int rv = sock_->Connect(callback.callback());
- net::TestNetLog::CapturedEntryList net_log_entries;
+ TestNetLog::CapturedEntryList net_log_entries;
net_log_.GetEntries(&net_log_entries);
- EXPECT_TRUE(net::LogContainsBeginEvent(
- net_log_entries, 0, net::NetLog::TYPE_SOCKET_ALIVE));
- EXPECT_TRUE(net::LogContainsBeginEvent(
- net_log_entries, 1, net::NetLog::TYPE_TCP_CONNECT));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(net_log_entries, 0, NetLog::TYPE_SOCKET_ALIVE));
+ EXPECT_TRUE(
+ LogContainsBeginEvent(net_log_entries, 1, NetLog::TYPE_TCP_CONNECT));
if (rv != OK) {
ASSERT_EQ(rv, ERR_IO_PENDING);
rv = callback.WaitForResult();
@@ -199,8 +199,8 @@
EXPECT_TRUE(sock_->IsConnected());
net_log_.GetEntries(&net_log_entries);
- EXPECT_TRUE(net::LogContainsEndEvent(
- net_log_entries, -1, net::NetLog::TYPE_TCP_CONNECT));
+ EXPECT_TRUE(
+ LogContainsEndEvent(net_log_entries, -1, NetLog::TYPE_TCP_CONNECT));
sock_->Disconnect();
EXPECT_FALSE(sock_->IsConnected());
diff --git a/net/spdy/hpack_huffman_table_test.cc b/net/spdy/hpack_huffman_table_test.cc
index 6a91149..a8dc196 100644
--- a/net/spdy/hpack_huffman_table_test.cc
+++ b/net/spdy/hpack_huffman_table_test.cc
@@ -16,7 +16,6 @@
#include "testing/gtest/include/gtest/gtest.h"
using base::StringPiece;
-using net::test::a2b_hex;
using std::string;
using testing::ElementsAreArray;
using testing::Pointwise;
diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc
index b87748b..fe7d4b8 100644
--- a/net/spdy/spdy_framer_test.cc
+++ b/net/spdy/spdy_framer_test.cc
@@ -608,16 +608,12 @@
} // namespace test
-} // namespace net
-
-using net::test::SetFrameLength;
-using net::test::SetFrameFlags;
-using net::test::CompareCharArraysWithHexError;
-using net::test::SpdyFramerTestUtil;
-using net::test::TestSpdyVisitor;
-using net::test::GetSerializedHeaders;
-
-namespace net {
+using test::SetFrameLength;
+using test::SetFrameFlags;
+using test::CompareCharArraysWithHexError;
+using test::SpdyFramerTestUtil;
+using test::TestSpdyVisitor;
+using test::GetSerializedHeaders;
class SpdyFramerTest : public ::testing::TestWithParam<SpdyMajorVersion> {
protected:
@@ -5380,8 +5376,8 @@
do {
SCOPED_TRACE(testing::Message() << "Flags " << flags);
- testing::StrictMock<net::test::MockSpdyFramerVisitor> visitor;
- testing::StrictMock<net::test::MockDebugVisitor> debug_visitor;
+ testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
+ testing::StrictMock<test::MockDebugVisitor> debug_visitor;
SpdyFramer framer(spdy_version_);
framer.set_visitor(&visitor);
framer.set_debug_visitor(&debug_visitor);
@@ -5430,7 +5426,7 @@
SCOPED_TRACE(testing::Message() << "Flags " << flags);
testing::StrictMock<test::MockSpdyFramerVisitor> visitor;
- testing::StrictMock<net::test::MockDebugVisitor> debug_visitor;
+ testing::StrictMock<test::MockDebugVisitor> debug_visitor;
SpdyFramer framer(spdy_version_);
framer.set_visitor(&visitor);
framer.set_debug_visitor(&debug_visitor);
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index e5a17141..c84ba5c 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -373,7 +373,7 @@
}
stream_.reset();
bool invoked_callback = false;
- if (status == net::OK) {
+ if (status == OK) {
// We need to complete any pending buffered read now.
invoked_callback = DoBufferedReadCallback();
}
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc
index 14d98dc..2e6d614 100644
--- a/net/spdy/spdy_proxy_client_socket_unittest.cc
+++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -110,7 +110,7 @@
data_->Run();
}
- void CloseSpdySession(net::Error error, const std::string& description) {
+ void CloseSpdySession(Error error, const std::string& description) {
spdy_session_->CloseSessionOnError(error, description);
}
@@ -539,7 +539,7 @@
Initialize(reads, arraysize(reads), writes, arraysize(writes));
- net::IPEndPoint addr;
+ IPEndPoint addr;
EXPECT_EQ(ERR_SOCKET_NOT_CONNECTED, sock_->GetPeerAddress(&addr));
AssertConnectSucceeds();
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index e25a88c..44858e97 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -59,7 +59,7 @@
scoped_ptr<base::ListValue> SpdyHeaderBlockToListValue(
const SpdyHeaderBlock& headers,
- net::NetLogCaptureMode capture_mode) {
+ NetLogCaptureMode capture_mode) {
scoped_ptr<base::ListValue> headers_list(new base::ListValue());
for (SpdyHeaderBlock::const_iterator it = headers.begin();
it != headers.end(); ++it) {
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index c6a44e2..d41ef551 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -144,7 +144,7 @@
}
// Look up the key's from the resolver's cache.
- net::HostResolver::RequestInfo resolve_info(key.host_port_pair());
+ HostResolver::RequestInfo resolve_info(key.host_port_pair());
AddressList addresses;
int rv = resolver_->ResolveFromCache(resolve_info, &addresses, net_log);
DCHECK_NE(rv, ERR_IO_PENDING);
@@ -234,7 +234,7 @@
// handlers, it doesn't suffice to simply increment the iterator
// before closing.
-void SpdySessionPool::CloseCurrentSessions(net::Error error) {
+void SpdySessionPool::CloseCurrentSessions(Error error) {
CloseCurrentSessionsHelper(error, "Closing current sessions.",
false /* idle_only */);
}
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 6ee0c4df..aca0c62 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -109,7 +109,7 @@
// Close only the currently existing SpdySessions with |error|.
// Let any new ones created while this method is running continue to
// live.
- void CloseCurrentSessions(net::Error error);
+ void CloseCurrentSessions(Error error);
// Close only the currently existing SpdySessions that are idle.
// Let any new ones created while this method is running continue to
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc
index f9fba93..4a0841b 100644
--- a/net/spdy/spdy_session_pool_unittest.cc
+++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -131,7 +131,7 @@
spdy_stream->SetDelegate(&delegate);
// Close the current session.
- spdy_session_pool_->CloseCurrentSessions(net::ERR_ABORTED);
+ spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED);
EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key));
}
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index b00f887..8e943ca 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -1632,14 +1632,13 @@
// Flush the read completion task.
base::MessageLoop::current()->RunUntilIdle();
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
// Check that we logged TYPE_HTTP2_SESSION_INITIALIZED correctly.
- int pos = net::ExpectLogContainsSomewhere(
- entries, 0, net::NetLog::TYPE_HTTP2_SESSION_INITIALIZED,
- net::NetLog::PHASE_NONE);
+ int pos = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_HTTP2_SESSION_INITIALIZED, NetLog::PHASE_NONE);
EXPECT_LT(0, pos);
TestNetLog::CapturedEntry entry = entries[pos];
@@ -1678,14 +1677,13 @@
EXPECT_TRUE(session == NULL);
// Check that the NetLog was filled reasonably.
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
// Check that we logged SPDY_SESSION_CLOSE correctly.
- int pos = net::ExpectLogContainsSomewhere(
- entries, 0, net::NetLog::TYPE_HTTP2_SESSION_CLOSE,
- net::NetLog::PHASE_NONE);
+ int pos = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_HTTP2_SESSION_CLOSE, NetLog::PHASE_NONE);
if (pos < static_cast<int>(entries.size())) {
TestNetLog::CapturedEntry entry = entries[pos];
@@ -1723,14 +1721,13 @@
EXPECT_TRUE(session == NULL);
// Check that the NetLog was filled reasonably.
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
// Check that we logged SPDY_SESSION_CLOSE correctly.
- int pos = net::ExpectLogContainsSomewhere(
- entries, 0, net::NetLog::TYPE_HTTP2_SESSION_CLOSE,
- net::NetLog::PHASE_NONE);
+ int pos = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_HTTP2_SESSION_CLOSE, NetLog::PHASE_NONE);
if (pos < static_cast<int>(entries.size())) {
TestNetLog::CapturedEntry entry = entries[pos];
@@ -2702,7 +2699,7 @@
const int kPayloadSize =
kMaxReadBytesWithoutYielding / 4 - framer.GetControlFrameHeaderSize();
TestDataStream test_stream;
- scoped_refptr<net::IOBuffer> payload(new net::IOBuffer(kPayloadSize));
+ scoped_refptr<IOBuffer> payload(new IOBuffer(kPayloadSize));
char* payload_data = payload->data();
test_stream.GetBytes(payload_data, kPayloadSize);
@@ -2793,7 +2790,7 @@
const int kPayloadSize =
kMaxReadBytesWithoutYielding / 4 - framer.GetControlFrameHeaderSize();
TestDataStream test_stream;
- scoped_refptr<net::IOBuffer> payload(new net::IOBuffer(kPayloadSize));
+ scoped_refptr<IOBuffer> payload(new IOBuffer(kPayloadSize));
char* payload_data = payload->data();
test_stream.GetBytes(payload_data, kPayloadSize);
@@ -2891,16 +2888,14 @@
TestDataStream test_stream;
const int kEightKPayloadSize =
kMaxReadBytesWithoutYielding / 4 - framer.GetControlFrameHeaderSize();
- scoped_refptr<net::IOBuffer> eightk_payload(
- new net::IOBuffer(kEightKPayloadSize));
+ scoped_refptr<IOBuffer> eightk_payload(new IOBuffer(kEightKPayloadSize));
char* eightk_payload_data = eightk_payload->data();
test_stream.GetBytes(eightk_payload_data, kEightKPayloadSize);
// Build buffer of 2k size.
TestDataStream test_stream2;
const int kTwoKPayloadSize = kEightKPayloadSize - 6 * 1024;
- scoped_refptr<net::IOBuffer> twok_payload(
- new net::IOBuffer(kTwoKPayloadSize));
+ scoped_refptr<IOBuffer> twok_payload(new IOBuffer(kTwoKPayloadSize));
char* twok_payload_data = twok_payload->data();
test_stream2.GetBytes(twok_payload_data, kTwoKPayloadSize);
diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc
index 15f67301..3dbe0b1 100644
--- a/net/spdy/spdy_stream_unittest.cc
+++ b/net/spdy/spdy_stream_unittest.cc
@@ -293,14 +293,13 @@
EXPECT_TRUE(data.at_write_eof());
// Check that the NetLog was filled reasonably.
- net::TestNetLog::CapturedEntryList entries;
+ TestNetLog::CapturedEntryList entries;
log.GetEntries(&entries);
EXPECT_LT(0u, entries.size());
// Check that we logged SPDY_STREAM_ERROR correctly.
- int pos = net::ExpectLogContainsSomewhere(
- entries, 0, net::NetLog::TYPE_HTTP2_STREAM_ERROR,
- net::NetLog::PHASE_NONE);
+ int pos = ExpectLogContainsSomewhere(
+ entries, 0, NetLog::TYPE_HTTP2_STREAM_ERROR, NetLog::PHASE_NONE);
int stream_id2;
ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &stream_id2));
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc
index 654aedb2..b675374 100644
--- a/net/spdy/spdy_test_util_common.cc
+++ b/net/spdy/spdy_test_util_common.cc
@@ -417,7 +417,7 @@
// static
HttpNetworkSession* SpdySessionDependencies::SpdyCreateSession(
SpdySessionDependencies* session_deps) {
- net::HttpNetworkSession::Params params = CreateSessionParams(session_deps);
+ HttpNetworkSession::Params params = CreateSessionParams(session_deps);
params.client_socket_factory = session_deps->socket_factory.get();
HttpNetworkSession* http_session = new HttpNetworkSession(params);
SpdySessionPoolPeer pool_peer(http_session->spdy_session_pool());
@@ -428,7 +428,7 @@
// static
HttpNetworkSession* SpdySessionDependencies::SpdyCreateSessionDeterministic(
SpdySessionDependencies* session_deps) {
- net::HttpNetworkSession::Params params = CreateSessionParams(session_deps);
+ HttpNetworkSession::Params params = CreateSessionParams(session_deps);
params.client_socket_factory =
session_deps->deterministic_socket_factory.get();
HttpNetworkSession* http_session = new HttpNetworkSession(params);
@@ -438,12 +438,12 @@
}
// static
-net::HttpNetworkSession::Params SpdySessionDependencies::CreateSessionParams(
+HttpNetworkSession::Params SpdySessionDependencies::CreateSessionParams(
SpdySessionDependencies* session_deps) {
DCHECK(next_proto_is_spdy(session_deps->protocol)) <<
"Invalid protocol: " << session_deps->protocol;
- net::HttpNetworkSession::Params params;
+ HttpNetworkSession::Params params;
params.host_resolver = session_deps->host_resolver.get();
params.cert_verifier = session_deps->cert_verifier.get();
params.transport_security_state =
@@ -485,7 +485,7 @@
storage_.set_http_server_properties(
scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
storage_.set_job_factory(new URLRequestJobFactoryImpl());
- net::HttpNetworkSession::Params params;
+ HttpNetworkSession::Params params;
params.client_socket_factory = &socket_factory_;
params.host_resolver = host_resolver();
params.cert_verifier = cert_verifier();
diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h
index 781dbb2..74bf694 100644
--- a/net/spdy/spdy_test_util_common.h
+++ b/net/spdy/spdy_test_util_common.h
@@ -233,7 +233,7 @@
private:
MockClientSocketFactory socket_factory_;
- net::URLRequestContextStorage storage_;
+ URLRequestContextStorage storage_;
};
// Equivalent to pool->GetIfExists(spdy_session_key, BoundNetLog()) != NULL.
diff --git a/net/spdy/write_blocked_list.h b/net/spdy/write_blocked_list.h
index 654c21e63..c6d60b3 100644
--- a/net/spdy/write_blocked_list.h
+++ b/net/spdy/write_blocked_list.h
@@ -12,12 +12,12 @@
#include "base/logging.h"
#include "net/spdy/spdy_protocol.h"
-namespace {
-class WriteBlockedListPeer;
-}
-
namespace net {
+namespace test {
+class WriteBlockedListPeer;
+} // namespace test
+
const int kHighestPriority = 0;
const int kLowestPriority = 7;
@@ -164,7 +164,7 @@
bool avoids_inserting_duplicates() const { return use_stream_to_priority_; }
private:
- friend WriteBlockedListPeer;
+ friend class net::test::WriteBlockedListPeer;
typedef base::hash_map<IdType, SpdyPriority> StreamToPriorityMap;
diff --git a/net/spdy/write_blocked_list_test.cc b/net/spdy/write_blocked_list_test.cc
index ef5ea50..50c3f35 100644
--- a/net/spdy/write_blocked_list_test.cc
+++ b/net/spdy/write_blocked_list_test.cc
@@ -8,22 +8,19 @@
#include "testing/gtest/include/gtest/gtest.h"
-namespace {
+namespace net {
+namespace test {
class WriteBlockedListPeer {
public:
- static std::deque<int>* GetWriteBlockedList(
- int i,
- net::WriteBlockedList<int>* list) {
+ static std::deque<int>* GetWriteBlockedList(int i,
+ WriteBlockedList<int>* list) {
return &list->write_blocked_lists_[i];
}
};
-} // namespace
-
-namespace net {
-namespace test {
namespace {
+
typedef WriteBlockedList<int> IntWriteBlockedList;
class WriteBlockedListTest : public ::testing::TestWithParam<bool> {
@@ -166,5 +163,6 @@
}
} // namespace
+
} // namespace test
} // namespace net
diff --git a/net/ssl/client_cert_store_chromeos_unittest.cc b/net/ssl/client_cert_store_chromeos_unittest.cc
index ca2c0494..94acac6 100644
--- a/net/ssl/client_cert_store_chromeos_unittest.cc
+++ b/net/ssl/client_cert_store_chromeos_unittest.cc
@@ -20,7 +20,7 @@
namespace {
-class TestCertFilter : public net::ClientCertStoreChromeOS::CertFilter {
+class TestCertFilter : public ClientCertStoreChromeOS::CertFilter {
public:
explicit TestCertFilter(bool init_finished)
: init_finished_(init_finished), init_called_(false) {}
@@ -36,7 +36,7 @@
}
bool IsCertAllowed(
- const scoped_refptr<net::X509Certificate>& cert) const override {
+ const scoped_refptr<X509Certificate>& cert) const override {
if (not_allowed_cert_.get() && cert->Equals(not_allowed_cert_.get()))
return false;
return true;
diff --git a/net/test/embedded_test_server/http_request.h b/net/test/embedded_test_server/http_request.h
index 3cd1ac77..c299378 100644
--- a/net/test/embedded_test_server/http_request.h
+++ b/net/test/embedded_test_server/http_request.h
@@ -111,7 +111,7 @@
// Content length of the request currently being parsed.
size_t declared_content_length_;
- scoped_ptr<net::HttpChunkedDecoder> chunked_decoder_;
+ scoped_ptr<HttpChunkedDecoder> chunked_decoder_;
DISALLOW_COPY_AND_ASSIGN(HttpRequestParser);
};
diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc
index b8ded1f..c5a9b6f4 100644
--- a/net/test/spawned_test_server/base_test_server.cc
+++ b/net/test/spawned_test_server/base_test_server.cc
@@ -245,7 +245,7 @@
BoundNetLog());
if (rv == ERR_IO_PENDING)
rv = callback.WaitForResult();
- if (rv != net::OK) {
+ if (rv != OK) {
LOG(ERROR) << "Failed to resolve hostname: " << host_port_pair_.host();
return false;
}
diff --git a/net/test/spawned_test_server/spawner_communicator.h b/net/test/spawned_test_server/spawner_communicator.h
index ba8bfca..15ae0c5e 100644
--- a/net/test/spawned_test_server/spawner_communicator.h
+++ b/net/test/spawned_test_server/spawner_communicator.h
@@ -29,7 +29,7 @@
// themselves continue running on the device. To control the test server on the
// host machine, a second HTTP server is started, the spawner server, which
// controls the life cycle of remote test servers. Calls to start/kill the
-// net::SpawnedTestServer are then redirected to the spawner server via
+// SpawnedTestServer are then redirected to the spawner server via
// this spawner communicator.
//
// Currently only three commands are supported by spawner.
@@ -58,7 +58,7 @@
// The internal I/O thread is required by net stack to perform net I/O.
// The Start/StopServer methods block the caller thread until result is
// fetched from spawner server or timed-out.
-class SpawnerCommunicator : public net::URLRequest::Delegate {
+class SpawnerCommunicator : public URLRequest::Delegate {
public:
explicit SpawnerCommunicator(uint16 port);
~SpawnerCommunicator() override;
diff --git a/net/test/url_request/url_request_failed_job.cc b/net/test/url_request/url_request_failed_job.cc
index c13c3c8c..b0e2536f 100644
--- a/net/test/url_request/url_request_failed_job.cc
+++ b/net/test/url_request/url_request_failed_job.cc
@@ -19,35 +19,36 @@
// Gets the numeric net error code from URL of the form:
// scheme://kMockHostname/error_code. The error code must be a valid
-// net error code, and not net::OK or net::ERR_IO_PENDING.
-int GetErrorCode(net::URLRequest* request) {
+// net error code, and not OK or ERR_IO_PENDING.
+int GetErrorCode(URLRequest* request) {
int net_error;
std::string path = request->url().path();
if (path[0] == '/' && base::StringToInt(path.c_str() + 1, &net_error)) {
CHECK_LT(net_error, 0);
- CHECK_NE(net_error, net::ERR_IO_PENDING);
+ CHECK_NE(net_error, ERR_IO_PENDING);
return net_error;
}
NOTREACHED();
- return net::ERR_UNEXPECTED;
+ return ERR_UNEXPECTED;
}
GURL GetMockUrl(const std::string& scheme,
const std::string& hostname,
int net_error) {
CHECK_LT(net_error, 0);
- CHECK_NE(net_error, net::ERR_IO_PENDING);
+ CHECK_NE(net_error, ERR_IO_PENDING);
return GURL(scheme + "://" + hostname + "/" + base::IntToString(net_error));
}
} // namespace
-URLRequestFailedJob::URLRequestFailedJob(net::URLRequest* request,
- net::NetworkDelegate* network_delegate,
+URLRequestFailedJob::URLRequestFailedJob(URLRequest* request,
+ NetworkDelegate* network_delegate,
int net_error)
- : net::URLRequestJob(request, network_delegate),
+ : URLRequestJob(request, network_delegate),
net_error_(net_error),
- weak_factory_(this) {}
+ weak_factory_(this) {
+}
void URLRequestFailedJob::Start() {
base::MessageLoop::current()->PostTask(
@@ -63,8 +64,8 @@
// static
void URLRequestFailedJob::AddUrlHandlerForHostname(
const std::string& hostname) {
- // Add |hostname| to net::URLRequestFilter for HTTP and HTTPS.
- net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
+ // Add |hostname| to URLRequestFilter for HTTP and HTTPS.
+ URLRequestFilter* filter = URLRequestFilter::GetInstance();
filter->AddHostnameHandler("http", hostname, URLRequestFailedJob::Factory);
filter->AddHostnameHandler("https", hostname, URLRequestFailedJob::Factory);
}
@@ -94,17 +95,15 @@
URLRequestFailedJob::~URLRequestFailedJob() {}
// static
-net::URLRequestJob* URLRequestFailedJob::Factory(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate,
- const std::string& scheme) {
+URLRequestJob* URLRequestFailedJob::Factory(URLRequest* request,
+ NetworkDelegate* network_delegate,
+ const std::string& scheme) {
return new URLRequestFailedJob(
request, network_delegate, GetErrorCode(request));
}
void URLRequestFailedJob::StartAsync() {
- NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
- net_error_));
+ NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, net_error_));
}
} // namespace net
diff --git a/net/test/url_request/url_request_mock_data_job.cc b/net/test/url_request/url_request_mock_data_job.cc
index 1333495..5425816 100644
--- a/net/test/url_request/url_request_mock_data_job.cc
+++ b/net/test/url_request/url_request_mock_data_job.cc
@@ -22,7 +22,7 @@
// Gets the data from URL of the form:
// scheme://kMockHostname/?data=abc&repeat_count=nnn.
-std::string GetDataFromRequest(const net::URLRequest& request) {
+std::string GetDataFromRequest(const URLRequest& request) {
std::string value;
if (!GetValueForKeyInQuery(request.url(), "data", &value))
return "default_data";
@@ -31,7 +31,7 @@
// Gets the numeric repeat count from URL of the form:
// scheme://kMockHostname/?data=abc&repeat_count=nnn.
-int GetRepeatCountFromRequest(const net::URLRequest& request) {
+int GetRepeatCountFromRequest(const URLRequest& request) {
std::string value;
if (!GetValueForKeyInQuery(request.url(), "repeat", &value))
return 1;
@@ -58,15 +58,15 @@
return GURL(url);
}
-class MockJobInterceptor : public net::URLRequestInterceptor {
+class MockJobInterceptor : public URLRequestInterceptor {
public:
MockJobInterceptor() {}
~MockJobInterceptor() override {}
- // net::URLRequestInterceptor implementation
- net::URLRequestJob* MaybeInterceptRequest(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const override {
+ // URLRequestInterceptor implementation
+ URLRequestJob* MaybeInterceptRequest(
+ URLRequest* request,
+ NetworkDelegate* network_delegate) const override {
return new URLRequestMockDataJob(request, network_delegate,
GetDataFromRequest(*request),
GetRepeatCountFromRequest(*request));
@@ -114,7 +114,7 @@
}
int URLRequestMockDataJob::GetResponseCode() const {
- net::HttpResponseInfo info;
+ HttpResponseInfo info;
GetResponseInfoConst(&info);
return info.headers->response_code();
}
@@ -134,7 +134,7 @@
"Content-type: text/plain\n");
raw_headers.append(base::StringPrintf("Content-Length: %1d\n",
static_cast<int>(data_.length())));
- info->headers = new HttpResponseHeaders(net::HttpUtil::AssembleRawHeaders(
+ info->headers = new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(
raw_headers.c_str(), static_cast<int>(raw_headers.length())));
}
@@ -154,8 +154,8 @@
// static
void URLRequestMockDataJob::AddUrlHandlerForHostname(
const std::string& hostname) {
- // Add |hostname| to net::URLRequestFilter for HTTP and HTTPS.
- net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
+ // Add |hostname| to URLRequestFilter for HTTP and HTTPS.
+ URLRequestFilter* filter = URLRequestFilter::GetInstance();
filter->AddHostnameInterceptor("http", hostname,
make_scoped_ptr(new MockJobInterceptor()));
filter->AddHostnameInterceptor("https", hostname,
diff --git a/net/test/url_request/url_request_mock_http_job.cc b/net/test/url_request/url_request_mock_http_job.cc
index e0905f2..012a335 100644
--- a/net/test/url_request/url_request_mock_http_job.cc
+++ b/net/test/url_request/url_request_mock_http_job.cc
@@ -35,7 +35,7 @@
"readsync", // READ_SYNC
};
-class MockJobInterceptor : public net::URLRequestInterceptor {
+class MockJobInterceptor : public URLRequestInterceptor {
public:
// When |map_all_requests_to_base_path| is true, all request should return the
// contents of the file at |base_path|. When |map_all_requests_to_base_path|
@@ -50,10 +50,10 @@
worker_pool_(worker_pool) {}
~MockJobInterceptor() override {}
- // net::URLRequestJobFactory::ProtocolHandler implementation
- net::URLRequestJob* MaybeInterceptRequest(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const override {
+ // URLRequestJobFactory::ProtocolHandler implementation
+ URLRequestJob* MaybeInterceptRequest(
+ URLRequest* request,
+ NetworkDelegate* network_delegate) const override {
return new URLRequestMockHTTPJob(
request,
network_delegate,
@@ -63,15 +63,15 @@
}
private:
- base::FilePath GetOnDiskPath(net::URLRequest* request) const {
+ base::FilePath GetOnDiskPath(URLRequest* request) const {
// Conceptually we just want to "return base_path_ + request->url().path()".
// But path in the request URL is in URL space (i.e. %-encoded spaces).
// So first we convert base FilePath to a URL, then append the URL
// path to that, and convert the final URL back to a FilePath.
- GURL file_url(net::FilePathToFileURL(base_path_));
+ GURL file_url(FilePathToFileURL(base_path_));
std::string url = file_url.spec() + request->url().path();
base::FilePath file_path;
- net::FileURLToFilePath(GURL(url), &file_path);
+ FileURLToFilePath(GURL(url), &file_path);
return file_path;
}
@@ -113,8 +113,8 @@
void URLRequestMockHTTPJob::AddUrlHandlers(
const base::FilePath& base_path,
const scoped_refptr<base::SequencedWorkerPool>& worker_pool) {
- // Add kMockHostname to net::URLRequestFilter, for both HTTP and HTTPS.
- net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
+ // Add kMockHostname to URLRequestFilter, for both HTTP and HTTPS.
+ URLRequestFilter* filter = URLRequestFilter::GetInstance();
filter->AddHostnameInterceptor(
"http", kMockHostname, CreateInterceptor(base_path, worker_pool));
filter->AddHostnameInterceptor("https", kMockHostname,
@@ -148,28 +148,28 @@
}
// static
-scoped_ptr<net::URLRequestInterceptor> URLRequestMockHTTPJob::CreateInterceptor(
+scoped_ptr<URLRequestInterceptor> URLRequestMockHTTPJob::CreateInterceptor(
const base::FilePath& base_path,
const scoped_refptr<base::SequencedWorkerPool>& worker_pool) {
- return scoped_ptr<net::URLRequestInterceptor>(
+ return scoped_ptr<URLRequestInterceptor>(
new MockJobInterceptor(base_path, false, worker_pool));
}
// static
-scoped_ptr<net::URLRequestInterceptor>
+scoped_ptr<URLRequestInterceptor>
URLRequestMockHTTPJob::CreateInterceptorForSingleFile(
const base::FilePath& file,
const scoped_refptr<base::SequencedWorkerPool>& worker_pool) {
- return scoped_ptr<net::URLRequestInterceptor>(
+ return scoped_ptr<URLRequestInterceptor>(
new MockJobInterceptor(file, true, worker_pool));
}
URLRequestMockHTTPJob::URLRequestMockHTTPJob(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate,
+ URLRequest* request,
+ NetworkDelegate* network_delegate,
const base::FilePath& file_path,
const scoped_refptr<base::TaskRunner>& task_runner)
- : net::URLRequestFileJob(request, network_delegate, file_path, task_runner),
+ : URLRequestFileJob(request, network_delegate, file_path, task_runner),
task_runner_(task_runner),
weak_ptr_factory_(this) {
}
@@ -178,16 +178,16 @@
}
// Public virtual version.
-void URLRequestMockHTTPJob::GetResponseInfo(net::HttpResponseInfo* info) {
+void URLRequestMockHTTPJob::GetResponseInfo(HttpResponseInfo* info) {
// Forward to private const version.
GetResponseInfoConst(info);
}
bool URLRequestMockHTTPJob::IsRedirectResponse(GURL* location,
int* http_status_code) {
- // Override the net::URLRequestFileJob implementation to invoke the default
+ // Override the URLRequestFileJob implementation to invoke the default
// one based on HttpResponseInfo.
- return net::URLRequestJob::IsRedirectResponse(location, http_status_code);
+ return URLRequestJob::IsRedirectResponse(location, http_status_code);
}
// Public virtual version.
@@ -237,50 +237,48 @@
if (!base::StringToInt(phase_error_string, &net_error))
return false;
- if (net_error != net::ERR_IO_PENDING &&
+ if (net_error != ERR_IO_PENDING &&
(current_phase == START || current_phase == READ_SYNC)) {
- NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, net_error));
+ NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, net_error));
return true;
}
- SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
+ SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
if (current_phase != READ_ASYNC)
return true;
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
- base::Bind(
- &URLRequestMockHTTPJob::NotifyDone,
- weak_ptr_factory_.GetWeakPtr(),
- net::URLRequestStatus(net::URLRequestStatus::FAILED, net_error)));
+ base::Bind(&URLRequestMockHTTPJob::NotifyDone,
+ weak_ptr_factory_.GetWeakPtr(),
+ URLRequestStatus(URLRequestStatus::FAILED, net_error)));
return true;
}
// Private const version.
-void URLRequestMockHTTPJob::GetResponseInfoConst(
- net::HttpResponseInfo* info) const {
- info->headers = new net::HttpResponseHeaders(raw_headers_);
+void URLRequestMockHTTPJob::GetResponseInfoConst(HttpResponseInfo* info) const {
+ info->headers = new HttpResponseHeaders(raw_headers_);
}
bool URLRequestMockHTTPJob::GetMimeType(std::string* mime_type) const {
- net::HttpResponseInfo info;
+ HttpResponseInfo info;
GetResponseInfoConst(&info);
return info.headers.get() && info.headers->GetMimeType(mime_type);
}
int URLRequestMockHTTPJob::GetResponseCode() const {
- net::HttpResponseInfo info;
+ HttpResponseInfo info;
GetResponseInfoConst(&info);
// If we have headers, get the response code from them.
if (info.headers.get())
return info.headers->response_code();
- return net::URLRequestJob::GetResponseCode();
+ return URLRequestJob::GetResponseCode();
}
bool URLRequestMockHTTPJob::GetCharset(std::string* charset) {
- net::HttpResponseInfo info;
+ HttpResponseInfo info;
GetResponseInfo(&info);
return info.headers.get() && info.headers->GetCharset(charset);
}
diff --git a/net/udp/udp_socket_perftest.cc b/net/udp/udp_socket_perftest.cc
index df36c46..8d237b8 100644
--- a/net/udp/udp_socket_perftest.cc
+++ b/net/udp/udp_socket_perftest.cc
@@ -21,14 +21,16 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
+namespace net {
+
namespace {
class UDPSocketPerfTest : public PlatformTest {
public:
UDPSocketPerfTest()
- : buffer_(new net::IOBufferWithSize(kPacketSize)), weak_factory_(this) {}
+ : buffer_(new IOBufferWithSize(kPacketSize)), weak_factory_(this) {}
- void DoneWritePacketsToSocket(net::UDPClientSocket* socket,
+ void DoneWritePacketsToSocket(UDPClientSocket* socket,
int num_of_packets,
base::Closure done_callback,
int error) {
@@ -36,7 +38,7 @@
}
// Send |num_of_packets| to |socket|. Invoke |done_callback| when done.
- void WritePacketsToSocket(net::UDPClientSocket* socket,
+ void WritePacketsToSocket(UDPClientSocket* socket,
int num_of_packets,
base::Closure done_callback);
@@ -46,26 +48,23 @@
protected:
static const int kPacketSize = 1024;
- scoped_refptr<net::IOBufferWithSize> buffer_;
+ scoped_refptr<IOBufferWithSize> buffer_;
base::WeakPtrFactory<UDPSocketPerfTest> weak_factory_;
};
// Creates and address from an ip/port and returns it in |address|.
-void CreateUDPAddress(std::string ip_str,
- uint16 port,
- net::IPEndPoint* address) {
- net::IPAddressNumber ip_number;
- bool rv = net::ParseIPLiteralToNumber(ip_str, &ip_number);
+void CreateUDPAddress(std::string ip_str, uint16 port, IPEndPoint* address) {
+ IPAddressNumber ip_number;
+ bool rv = ParseIPLiteralToNumber(ip_str, &ip_number);
if (!rv)
return;
- *address = net::IPEndPoint(ip_number, port);
+ *address = IPEndPoint(ip_number, port);
}
-void UDPSocketPerfTest::WritePacketsToSocket(net::UDPClientSocket* socket,
+void UDPSocketPerfTest::WritePacketsToSocket(UDPClientSocket* socket,
int num_of_packets,
base::Closure done_callback) {
- scoped_refptr<net::IOBufferWithSize> io_buffer(
- new net::IOBufferWithSize(kPacketSize));
+ scoped_refptr<IOBufferWithSize> io_buffer(new IOBufferWithSize(kPacketSize));
memset(io_buffer->data(), 'G', kPacketSize);
while (num_of_packets) {
@@ -74,7 +73,7 @@
base::Bind(&UDPSocketPerfTest::DoneWritePacketsToSocket,
weak_factory_.GetWeakPtr(), socket,
num_of_packets - 1, done_callback));
- if (rv == net::ERR_IO_PENDING)
+ if (rv == ERR_IO_PENDING)
break;
--num_of_packets;
}
@@ -89,31 +88,31 @@
const uint16 kPort = 9999;
// Setup the server to listen.
- net::IPEndPoint bind_address;
+ IPEndPoint bind_address;
CreateUDPAddress("127.0.0.1", kPort, &bind_address);
- net::TestNetLog server_log;
- scoped_ptr<net::UDPServerSocket> server(
- new net::UDPServerSocket(&server_log, net::NetLog::Source()));
+ TestNetLog server_log;
+ scoped_ptr<UDPServerSocket> server(
+ new UDPServerSocket(&server_log, NetLog::Source()));
#if defined(OS_WIN)
if (use_nonblocking_io)
server->UseNonBlockingIO();
#endif
int rv = server->Listen(bind_address);
- ASSERT_EQ(net::OK, rv);
+ ASSERT_EQ(OK, rv);
// Setup the client.
- net::IPEndPoint server_address;
+ IPEndPoint server_address;
CreateUDPAddress("127.0.0.1", kPort, &server_address);
- net::TestNetLog client_log;
- scoped_ptr<net::UDPClientSocket> client(new net::UDPClientSocket(
- net::DatagramSocket::DEFAULT_BIND, net::RandIntCallback(), &client_log,
- net::NetLog::Source()));
+ TestNetLog client_log;
+ scoped_ptr<UDPClientSocket> client(
+ new UDPClientSocket(DatagramSocket::DEFAULT_BIND, RandIntCallback(),
+ &client_log, NetLog::Source()));
#if defined(OS_WIN)
if (use_nonblocking_io)
client->UseNonBlockingIO();
#endif
rv = client->Connect(server_address);
- EXPECT_EQ(net::OK, rv);
+ EXPECT_EQ(OK, rv);
base::RunLoop run_loop;
base::TimeTicks start_ticks = base::TimeTicks::Now();
@@ -139,3 +138,5 @@
#endif
} // namespace
+
+} // namespace net
diff --git a/net/url_request/sdch_dictionary_fetcher_unittest.cc b/net/url_request/sdch_dictionary_fetcher_unittest.cc
index f6db83f..98eecaa 100644
--- a/net/url_request/sdch_dictionary_fetcher_unittest.cc
+++ b/net/url_request/sdch_dictionary_fetcher_unittest.cc
@@ -124,13 +124,12 @@
new SpecifiedResponseJobInterceptor(http_response_info,
lifecycle_callback));
- net::URLRequestFilter::GetInstance()->AddHostnameInterceptor(
- "http", kTestDomain, interceptor.Pass());
+ URLRequestFilter::GetInstance()->AddHostnameInterceptor("http", kTestDomain,
+ interceptor.Pass());
}
static void Unregister() {
- net::URLRequestFilter::GetInstance()->RemoveHostnameHandler("http",
- kTestDomain);
+ URLRequestFilter::GetInstance()->RemoveHostnameHandler("http", kTestDomain);
}
private:
diff --git a/net/url_request/test_url_request_interceptor.cc b/net/url_request/test_url_request_interceptor.cc
index b0fd315..72aeea26 100644
--- a/net/url_request/test_url_request_interceptor.cc
+++ b/net/url_request/test_url_request_interceptor.cc
@@ -17,18 +17,18 @@
namespace {
-// This class is needed because net::URLRequestFileJob always returns a -1
+// This class is needed because URLRequestFileJob always returns a -1
// HTTP response status code.
-class TestURLRequestJob : public net::URLRequestFileJob {
+class TestURLRequestJob : public URLRequestFileJob {
public:
- TestURLRequestJob(net::URLRequest* request,
- net::NetworkDelegate* network_delegate,
+ TestURLRequestJob(URLRequest* request,
+ NetworkDelegate* network_delegate,
const base::FilePath& file_path,
const scoped_refptr<base::TaskRunner>& worker_task_runner)
- : net::URLRequestFileJob(request,
- network_delegate,
- file_path,
- worker_task_runner) {}
+ : URLRequestFileJob(request,
+ network_delegate,
+ file_path,
+ worker_task_runner) {}
int GetResponseCode() const override { return 200; }
@@ -42,8 +42,8 @@
// This class handles the actual URL request interception. It may be constructed
// on any thread, but all other methods are called on the |network_task_runner|
-// thread. It is destroyed by the net::URLRequestFilter singleton.
-class TestURLRequestInterceptor::Delegate : public net::URLRequestInterceptor {
+// thread. It is destroyed by the URLRequestFilter singleton.
+class TestURLRequestInterceptor::Delegate : public URLRequestInterceptor {
public:
Delegate(const std::string& scheme,
const std::string& hostname,
@@ -57,14 +57,13 @@
~Delegate() override {}
void Register() {
- net::URLRequestFilter::GetInstance()->AddHostnameInterceptor(
- scheme_, hostname_, scoped_ptr<net::URLRequestInterceptor>(this));
+ URLRequestFilter::GetInstance()->AddHostnameInterceptor(
+ scheme_, hostname_, scoped_ptr<URLRequestInterceptor>(this));
}
static void Unregister(const std::string& scheme,
const std::string& hostname) {
- net::URLRequestFilter::GetInstance()->RemoveHostnameHandler(scheme,
- hostname);
+ URLRequestFilter::GetInstance()->RemoveHostnameHandler(scheme, hostname);
}
// When requests for |url| arrive, respond with the contents of |path|. The
@@ -91,9 +90,9 @@
typedef std::map<GURL, base::FilePath> ResponseMap;
// When computing matches, this ignores the query parameters of the url.
- net::URLRequestJob* MaybeInterceptRequest(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const override {
+ URLRequestJob* MaybeInterceptRequest(
+ URLRequest* request,
+ NetworkDelegate* network_delegate) const override {
DCHECK(network_task_runner_->RunsTasksOnCurrentThread());
if (request->url().scheme() != scheme_ ||
request->url().host() != hostname_) {
diff --git a/net/url_request/url_fetcher.cc b/net/url_request/url_fetcher.cc
index ddad12d..faf70175 100644
--- a/net/url_request/url_fetcher.cc
+++ b/net/url_request/url_fetcher.cc
@@ -12,31 +12,29 @@
URLFetcher::~URLFetcher() {}
// static
-URLFetcher* net::URLFetcher::Create(
- const GURL& url,
- URLFetcher::RequestType request_type,
- URLFetcherDelegate* d) {
+URLFetcher* URLFetcher::Create(const GURL& url,
+ URLFetcher::RequestType request_type,
+ URLFetcherDelegate* d) {
return URLFetcher::Create(0, url, request_type, d);
}
// static
-URLFetcher* net::URLFetcher::Create(
- int id,
- const GURL& url,
- URLFetcher::RequestType request_type,
- URLFetcherDelegate* d) {
+URLFetcher* URLFetcher::Create(int id,
+ const GURL& url,
+ URLFetcher::RequestType request_type,
+ URLFetcherDelegate* d) {
URLFetcherFactory* factory = URLFetcherImpl::factory();
return factory ? factory->CreateURLFetcher(id, url, request_type, d)
: new URLFetcherImpl(url, request_type, d);
}
// static
-void net::URLFetcher::CancelAll() {
+void URLFetcher::CancelAll() {
URLFetcherImpl::CancelAll();
}
// static
-void net::URLFetcher::SetIgnoreCertificateRequests(bool ignored) {
+void URLFetcher::SetIgnoreCertificateRequests(bool ignored) {
URLFetcherImpl::SetIgnoreCertificateRequests(ignored);
}
diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc
index 36aeb5e..b3d6336 100644
--- a/net/url_request/url_fetcher_impl_unittest.cc
+++ b/net/url_request/url_fetcher_impl_unittest.cc
@@ -76,16 +76,15 @@
// Creates a URLFetcher that runs network tasks on the current message loop.
void CreateFetcherWithContext(const GURL& url,
URLFetcher::RequestType request_type,
- net::URLRequestContext* context) {
+ URLRequestContext* context) {
CreateFetcherWithContextGetter(
url, request_type, new TrivialURLRequestContextGetter(
context, base::MessageLoopProxy::current()));
}
- void CreateFetcherWithContextGetter(
- const GURL& url,
- URLFetcher::RequestType request_type,
- net::URLRequestContextGetter* context_getter) {
+ void CreateFetcherWithContextGetter(const GURL& url,
+ URLFetcher::RequestType request_type,
+ URLRequestContextGetter* context_getter) {
fetcher_.reset(new URLFetcherImpl(url, request_type, this));
fetcher_->SetRequestContext(context_getter);
}
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index 213307c..d78412a 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -94,8 +94,7 @@
// completed.
//
// This functions fixes both those cases.
-void ConvertRealLoadTimesToBlockingTimes(
- net::LoadTimingInfo* load_timing_info) {
+void ConvertRealLoadTimesToBlockingTimes(LoadTimingInfo* load_timing_info) {
DCHECK(!load_timing_info->request_start.is_null());
// Earliest time possible for the request to be blocking on connect events.
@@ -116,7 +115,7 @@
// Make sure connection times are after start and proxy times.
- net::LoadTimingInfo::ConnectTiming* connect_timing =
+ LoadTimingInfo::ConnectTiming* connect_timing =
&load_timing_info->connect_timing;
if (!connect_timing->dns_start.is_null()) {
DCHECK(!connect_timing->dns_end.is_null());
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc
index aa589f56..bcb5c68 100644
--- a/net/url_request/url_request_context_builder.cc
+++ b/net/url_request/url_request_context_builder.cc
@@ -112,7 +112,7 @@
return true;
}
- bool OnCanAccessFile(const net::URLRequest& request,
+ bool OnCanAccessFile(const URLRequest& request,
const base::FilePath& path) const override {
return true;
}
@@ -189,7 +189,7 @@
URLRequestContextBuilder::SchemeFactory::SchemeFactory(
const std::string& auth_scheme,
- net::HttpAuthHandlerFactory* auth_handler_factory)
+ HttpAuthHandlerFactory* auth_handler_factory)
: scheme(auth_scheme), factory(auth_handler_factory) {
}
@@ -256,12 +256,11 @@
if (net_log_) {
storage->set_net_log(net_log_.release());
} else {
- storage->set_net_log(new net::NetLog);
+ storage->set_net_log(new NetLog);
}
if (!host_resolver_) {
- host_resolver_ = net::HostResolver::CreateDefaultResolver(
- context->net_log());
+ host_resolver_ = HostResolver::CreateDefaultResolver(context->net_log());
}
storage->set_host_resolver(host_resolver_.Pass());
@@ -288,10 +287,9 @@
}
storage->set_proxy_service(proxy_service_.release());
- storage->set_ssl_config_service(new net::SSLConfigServiceDefaults);
+ storage->set_ssl_config_service(new SSLConfigServiceDefaults);
HttpAuthHandlerRegistryFactory* http_auth_handler_registry_factory =
- net::HttpAuthHandlerRegistryFactory::CreateDefault(
- context->host_resolver());
+ HttpAuthHandlerRegistryFactory::CreateDefault(context->host_resolver());
for (size_t i = 0; i < extra_http_auth_handlers_.size(); ++i) {
http_auth_handler_registry_factory->RegisterSchemeFactory(
extra_http_auth_handlers_[i].scheme,
@@ -310,7 +308,7 @@
new DefaultChannelIDStore(NULL), context->GetFileTaskRunner())));
}
- storage->set_transport_security_state(new net::TransportSecurityState());
+ storage->set_transport_security_state(new TransportSecurityState());
if (!transport_security_persister_path_.empty()) {
context->set_transport_security_persister(
make_scoped_ptr<TransportSecurityPersister>(
@@ -321,14 +319,13 @@
}
storage->set_http_server_properties(
- scoped_ptr<net::HttpServerProperties>(
- new net::HttpServerPropertiesImpl()));
+ scoped_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
storage->set_cert_verifier(CertVerifier::CreateDefault());
if (throttling_enabled_)
storage->set_throttler_manager(new URLRequestThrottlerManager());
- net::HttpNetworkSession::Params network_session_params;
+ HttpNetworkSession::Params network_session_params;
network_session_params.host_resolver = context->host_resolver();
network_session_params.cert_verifier = context->cert_verifier();
network_session_params.transport_security_state =
@@ -367,7 +364,7 @@
HttpCache::BackendFactory* http_cache_backend = NULL;
if (http_cache_params_.type == HttpCacheParams::DISK) {
http_cache_backend = new HttpCache::DefaultBackend(
- DISK_CACHE, net::CACHE_BACKEND_DEFAULT, http_cache_params_.path,
+ DISK_CACHE, CACHE_BACKEND_DEFAULT, http_cache_params_.path,
http_cache_params_.max_size, context->GetFileTaskRunner());
} else {
http_cache_backend =
@@ -377,8 +374,8 @@
http_transaction_factory = new HttpCache(
network_session_params, http_cache_backend);
} else {
- scoped_refptr<net::HttpNetworkSession> network_session(
- new net::HttpNetworkSession(network_session_params));
+ scoped_refptr<HttpNetworkSession> network_session(
+ new HttpNetworkSession(network_session_params));
http_transaction_factory = new HttpNetworkLayer(network_session.get());
}
diff --git a/net/url_request/url_request_context_builder.h b/net/url_request/url_request_context_builder.h
index 53a1792a..b21a652 100644
--- a/net/url_request/url_request_context_builder.h
+++ b/net/url_request/url_request_context_builder.h
@@ -70,7 +70,7 @@
HttpNetworkSessionParams();
~HttpNetworkSessionParams();
- // These fields mirror those in net::HttpNetworkSession::Params;
+ // These fields mirror those in HttpNetworkSession::Params;
bool ignore_certificate_errors;
HostMappingRules* host_mapping_rules;
uint16 testing_fixed_http_port;
@@ -147,7 +147,7 @@
// and |factory| are provided. The builder takes ownership of the factory and
// Build() must be called after this method.
void add_http_auth_handler_factory(const std::string& scheme,
- net::HttpAuthHandlerFactory* factory) {
+ HttpAuthHandlerFactory* factory) {
extra_http_auth_handlers_.push_back(SchemeFactory(scheme, factory));
}
@@ -155,7 +155,7 @@
void EnableHttpCache(const HttpCacheParams& params);
void DisableHttpCache();
- // Override default net::HttpNetworkSession::Params settings.
+ // Override default HttpNetworkSession::Params settings.
void set_http_network_session_params(
const HttpNetworkSessionParams& http_network_session_params) {
http_network_session_params_ = http_network_session_params;
@@ -200,12 +200,11 @@
private:
struct NET_EXPORT SchemeFactory {
- SchemeFactory(const std::string& scheme,
- net::HttpAuthHandlerFactory* factory);
+ SchemeFactory(const std::string& scheme, HttpAuthHandlerFactory* factory);
~SchemeFactory();
std::string scheme;
- net::HttpAuthHandlerFactory* factory;
+ HttpAuthHandlerFactory* factory;
};
std::string accept_language_;
diff --git a/net/url_request/url_request_context_builder_unittest.cc b/net/url_request/url_request_context_builder_unittest.cc
index df1edafd..2252623aef 100644
--- a/net/url_request/url_request_context_builder_unittest.cc
+++ b/net/url_request/url_request_context_builder_unittest.cc
@@ -106,7 +106,7 @@
TEST_F(URLRequestContextBuilderTest, ExtraHttpAuthHandlerFactory) {
GURL gurl("www.google.com");
- const int kBasicReturnCode = net::OK;
+ const int kBasicReturnCode = OK;
MockHttpAuthHandlerFactory* mock_factory_basic =
new MockHttpAuthHandlerFactory(kBasicReturnCode);
scoped_ptr<HttpAuthHandler> handler;
diff --git a/net/url_request/url_request_context_getter.cc b/net/url_request/url_request_context_getter.cc
index 721a709..d743885 100644
--- a/net/url_request/url_request_context_getter.cc
+++ b/net/url_request/url_request_context_getter.cc
@@ -36,14 +36,14 @@
}
TrivialURLRequestContextGetter::TrivialURLRequestContextGetter(
- net::URLRequestContext* context,
+ URLRequestContext* context,
const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner)
- : context_(context), main_task_runner_(main_task_runner) {}
+ : context_(context), main_task_runner_(main_task_runner) {
+}
TrivialURLRequestContextGetter::~TrivialURLRequestContextGetter() {}
-net::URLRequestContext*
-TrivialURLRequestContextGetter::GetURLRequestContext() {
+URLRequestContext* TrivialURLRequestContextGetter::GetURLRequestContext() {
return context_;
}
diff --git a/net/url_request/url_request_context_getter.h b/net/url_request/url_request_context_getter.h
index 17d17bd0..3f3a850d 100644
--- a/net/url_request/url_request_context_getter.h
+++ b/net/url_request/url_request_context_getter.h
@@ -19,7 +19,7 @@
struct URLRequestContextGetterTraits;
-// Interface for retrieving an net::URLRequestContext.
+// Interface for retrieving an URLRequestContext.
class NET_EXPORT URLRequestContextGetter
: public base::RefCountedThreadSafe<URLRequestContextGetter,
URLRequestContextGetterTraits> {
@@ -28,7 +28,7 @@
// Returns a SingleThreadTaskRunner corresponding to the thread on
// which the network IO happens (the thread on which the returned
- // net::URLRequestContext may be used).
+ // URLRequestContext may be used).
virtual scoped_refptr<base::SingleThreadTaskRunner>
GetNetworkTaskRunner() const = 0;
@@ -57,12 +57,12 @@
class NET_EXPORT TrivialURLRequestContextGetter
: public URLRequestContextGetter {
public:
- TrivialURLRequestContextGetter(
- net::URLRequestContext* context,
- const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner);
+ TrivialURLRequestContextGetter(
+ URLRequestContext* context,
+ const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner);
- // net::URLRequestContextGetter implementation:
- net::URLRequestContext* GetURLRequestContext() override;
+ // URLRequestContextGetter implementation:
+ URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
const override;
@@ -70,7 +70,7 @@
private:
~TrivialURLRequestContextGetter() override;
- net::URLRequestContext* context_;
+ URLRequestContext* context_;
const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
DISALLOW_COPY_AND_ASSIGN(TrivialURLRequestContextGetter);
diff --git a/net/url_request/url_request_data_job.cc b/net/url_request/url_request_data_job.cc
index e074646..b4c7a67 100644
--- a/net/url_request/url_request_data_job.cc
+++ b/net/url_request/url_request_data_job.cc
@@ -18,10 +18,10 @@
std::string* charset,
std::string* data,
HttpResponseHeaders* headers) {
- if (!net::DataURL::Parse(url, mime_type, charset, data))
- return net::ERR_INVALID_URL;
+ if (!DataURL::Parse(url, mime_type, charset, data))
+ return ERR_INVALID_URL;
- // |mime_type| set by net::DataURL::Parse() is guaranteed to be in
+ // |mime_type| set by DataURL::Parse() is guaranteed to be in
// token "/" token
// form. |charset| is also guaranteed to be a token.
@@ -40,7 +40,7 @@
headers->AddHeader("Access-Control-Allow-Origin: *");
}
- return net::OK;
+ return OK;
}
URLRequestDataJob::URLRequestDataJob(
diff --git a/net/url_request/url_request_data_job_unittest.cc b/net/url_request/url_request_data_job_unittest.cc
index 49a7ecd..8c6d0939 100644
--- a/net/url_request/url_request_data_job_unittest.cc
+++ b/net/url_request/url_request_data_job_unittest.cc
@@ -18,19 +18,18 @@
std::string mime_type;
std::string charset;
std::string data;
- scoped_refptr<net::HttpResponseHeaders> headers(
- new net::HttpResponseHeaders(std::string()));
+ scoped_refptr<HttpResponseHeaders> headers(
+ new HttpResponseHeaders(std::string()));
- ASSERT_EQ(
- net::OK,
- URLRequestDataJob::BuildResponse(
- GURL("data:,Hello"), &mime_type, &charset, &data, headers.get()));
+ ASSERT_EQ(OK,
+ URLRequestDataJob::BuildResponse(GURL("data:,Hello"), &mime_type,
+ &charset, &data, headers.get()));
EXPECT_EQ("text/plain", mime_type);
EXPECT_EQ("US-ASCII", charset);
EXPECT_EQ("Hello", data);
- const net::HttpVersion& version = headers->GetParsedHttpVersion();
+ const HttpVersion& version = headers->GetParsedHttpVersion();
EXPECT_EQ(1, version.major_value());
EXPECT_EQ(1, version.minor_value());
EXPECT_EQ("OK", headers->GetStatusText());
@@ -47,29 +46,26 @@
std::string mime_type;
std::string charset;
std::string data;
- scoped_refptr<net::HttpResponseHeaders> headers(
- new net::HttpResponseHeaders(std::string()));
+ scoped_refptr<HttpResponseHeaders> headers(
+ new HttpResponseHeaders(std::string()));
- EXPECT_EQ(
- net::ERR_INVALID_URL,
- URLRequestDataJob::BuildResponse(
- GURL("bogus"), &mime_type, &charset, &data, headers.get()));
+ EXPECT_EQ(ERR_INVALID_URL,
+ URLRequestDataJob::BuildResponse(GURL("bogus"), &mime_type,
+ &charset, &data, headers.get()));
}
TEST(BuildResponseTest, InvalidMimeType) {
std::string mime_type;
std::string charset;
std::string data;
- scoped_refptr<net::HttpResponseHeaders> headers(
- new net::HttpResponseHeaders(std::string()));
+ scoped_refptr<HttpResponseHeaders> headers(
+ new HttpResponseHeaders(std::string()));
// MIME type contains delimiters. Must be accepted but Content-Type header
// should be generated as if the mediatype was text/plain.
- EXPECT_EQ(
- net::OK,
- URLRequestDataJob::BuildResponse(
- GURL("data:f(o/b)r,test"),
- &mime_type, &charset, &data, headers.get()));
+ EXPECT_EQ(OK, URLRequestDataJob::BuildResponse(GURL("data:f(o/b)r,test"),
+ &mime_type, &charset, &data,
+ headers.get()));
std::string value;
EXPECT_TRUE(headers->GetNormalizedHeader("Content-Type", &value));
@@ -80,15 +76,13 @@
std::string mime_type;
std::string charset;
std::string data;
- scoped_refptr<net::HttpResponseHeaders> headers(
- new net::HttpResponseHeaders(std::string()));
+ scoped_refptr<HttpResponseHeaders> headers(
+ new HttpResponseHeaders(std::string()));
// MIME type contains delimiters. Must be rejected.
- EXPECT_EQ(
- net::ERR_INVALID_URL,
- URLRequestDataJob::BuildResponse(
- GURL("data:text/html;charset=(),test"),
- &mime_type, &charset, &data, headers.get()));
+ EXPECT_EQ(ERR_INVALID_URL, URLRequestDataJob::BuildResponse(
+ GURL("data:text/html;charset=(),test"),
+ &mime_type, &charset, &data, headers.get()));
}
} // namespace net
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index b1399189..864001e 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -198,7 +198,7 @@
void URLRequestFileJob::OnSeekComplete(int64 result) {
}
-void URLRequestFileJob::OnReadComplete(net::IOBuffer* buf, int result) {
+void URLRequestFileJob::OnReadComplete(IOBuffer* buf, int result) {
}
URLRequestFileJob::~URLRequestFileJob() {
@@ -294,7 +294,7 @@
NotifyHeadersComplete();
}
-void URLRequestFileJob::DidRead(scoped_refptr<net::IOBuffer> buf, int result) {
+void URLRequestFileJob::DidRead(scoped_refptr<IOBuffer> buf, int result) {
if (result > 0) {
SetStatus(URLRequestStatus()); // Clear the IO_PENDING status
remaining_bytes_ -= result;
diff --git a/net/url_request/url_request_file_job.h b/net/url_request/url_request_file_job.h
index fe7c6e9..0436dac5 100644
--- a/net/url_request/url_request_file_job.h
+++ b/net/url_request/url_request_file_job.h
@@ -46,7 +46,7 @@
// An interface for subclasses who wish to monitor read operations.
virtual void OnSeekComplete(int64 result);
- virtual void OnReadComplete(net::IOBuffer* buf, int result);
+ virtual void OnReadComplete(IOBuffer* buf, int result);
protected:
~URLRequestFileJob() override;
@@ -91,7 +91,7 @@
void DidSeek(int64 result);
// Callback after data is asynchronously read from the file into |buf|.
- void DidRead(scoped_refptr<net::IOBuffer> buf, int result);
+ void DidRead(scoped_refptr<IOBuffer> buf, int result);
scoped_ptr<FileStream> stream_;
FileMetaInfo meta_info_;
diff --git a/net/url_request/url_request_file_job_unittest.cc b/net/url_request/url_request_file_job_unittest.cc
index af05259..427ed3d0 100644
--- a/net/url_request/url_request_file_job_unittest.cc
+++ b/net/url_request/url_request_file_job_unittest.cc
@@ -82,16 +82,15 @@
return job;
}
- net::URLRequestJob* MaybeInterceptRedirect(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate,
- const GURL& location) const override {
+ URLRequestJob* MaybeInterceptRedirect(URLRequest* request,
+ NetworkDelegate* network_delegate,
+ const GURL& location) const override {
return nullptr;
}
- net::URLRequestJob* MaybeInterceptResponse(
- net::URLRequest* request,
- net::NetworkDelegate* network_delegate) const override {
+ URLRequestJob* MaybeInterceptResponse(
+ URLRequest* request,
+ NetworkDelegate* network_delegate) const override {
return nullptr;
}
diff --git a/net/url_request/url_request_filter_unittest.cc b/net/url_request/url_request_filter_unittest.cc
index 54e140142..fb66587d 100644
--- a/net/url_request/url_request_filter_unittest.cc
+++ b/net/url_request/url_request_filter_unittest.cc
@@ -114,7 +114,7 @@
EXPECT_EQ(0, filter->hit_count());
filter->AddHostnameInterceptor(
kUrl1.scheme(), kUrl1.host(),
- scoped_ptr<net::URLRequestInterceptor>(new TestURLRequestInterceptor()));
+ scoped_ptr<URLRequestInterceptor>(new TestURLRequestInterceptor()));
{
scoped_refptr<URLRequestJob> found =
filter->MaybeInterceptRequest(request1.get(), NULL);
@@ -127,9 +127,8 @@
// Check URLRequestInterceptor URL matching.
filter->ClearHandlers();
EXPECT_EQ(0, filter->hit_count());
- filter->AddUrlInterceptor(
- kUrl2,
- scoped_ptr<net::URLRequestInterceptor>(new TestURLRequestInterceptor()));
+ filter->AddUrlInterceptor(kUrl2, scoped_ptr<URLRequestInterceptor>(
+ new TestURLRequestInterceptor()));
{
scoped_refptr<URLRequestJob> found =
filter->MaybeInterceptRequest(request2.get(), NULL);
diff --git a/net/url_request/url_request_ftp_job_unittest.cc b/net/url_request/url_request_ftp_job_unittest.cc
index cbbf407..c7cdecf1 100644
--- a/net/url_request/url_request_ftp_job_unittest.cc
+++ b/net/url_request/url_request_ftp_job_unittest.cc
@@ -36,7 +36,7 @@
int CreateProxyResolver(
const scoped_refptr<ProxyResolverScriptData>& pac_script,
scoped_ptr<ProxyResolver>* resolver,
- const net::CompletionCallback& callback,
+ const CompletionCallback& callback,
scoped_ptr<Request>* request) override {
resolver->reset(new MockAsyncProxyResolver());
return OK;
@@ -287,7 +287,7 @@
EXPECT_TRUE(url_request->status().is_success());
EXPECT_TRUE(url_request->proxy_server().Equals(
- net::HostPortPair::FromString("localhost:80")));
+ HostPortPair::FromString("localhost:80")));
EXPECT_EQ(1, network_delegate()->completed_requests());
EXPECT_EQ(0, network_delegate()->error_count());
EXPECT_FALSE(request_delegate.auth_required_called());
@@ -337,7 +337,7 @@
EXPECT_TRUE(url_request->status().is_success());
EXPECT_TRUE(url_request->proxy_server().Equals(
- net::HostPortPair::FromString("localhost:80")));
+ HostPortPair::FromString("localhost:80")));
EXPECT_EQ(1, network_delegate()->completed_requests());
EXPECT_EQ(0, network_delegate()->error_count());
EXPECT_TRUE(request_delegate.auth_required_called());
@@ -627,7 +627,7 @@
EXPECT_TRUE(url_request1->status().is_success());
EXPECT_TRUE(url_request1->proxy_server().Equals(
- net::HostPortPair::FromString("localhost:80")));
+ HostPortPair::FromString("localhost:80")));
EXPECT_EQ(1, network_delegate()->completed_requests());
EXPECT_EQ(0, network_delegate()->error_count());
EXPECT_FALSE(request_delegate1.auth_required_called());
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 91ba0fb..88b6a477 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -660,7 +660,7 @@
// End of the call started in OnStartCompleted.
OnCallToDelegateComplete();
- if (result != net::OK) {
+ if (result != OK) {
std::string source("delegate");
request_->net_log().AddEvent(NetLog::TYPE_CANCELLED,
NetLog::StringCallback("source", &source));
@@ -708,11 +708,9 @@
options.set_include_httponly();
options.set_server_time(response_date_);
- net::CookieStore::SetCookiesCallback callback(
- base::Bind(&URLRequestHttpJob::OnCookieSaved,
- weak_factory_.GetWeakPtr(),
- save_next_cookie_running,
- callback_pending));
+ CookieStore::SetCookiesCallback callback(base::Bind(
+ &URLRequestHttpJob::OnCookieSaved, weak_factory_.GetWeakPtr(),
+ save_next_cookie_running, callback_pending));
// Loop through the cookies as long as SetCookieWithOptionsAsync completes
// synchronously.
@@ -884,8 +882,8 @@
headers.get(),
&override_response_headers_,
&allowed_unsafe_redirect_url_);
- if (error != net::OK) {
- if (error == net::ERR_IO_PENDING) {
+ if (error != OK) {
+ if (error == ERR_IO_PENDING) {
awaiting_callback_ = true;
} else {
std::string source("delegate");
@@ -899,7 +897,7 @@
}
}
- SaveCookiesAndNotifyHeadersComplete(net::OK);
+ SaveCookiesAndNotifyHeadersComplete(OK);
} else if (IsCertificateError(result)) {
// We encountered an SSL certificate error.
if (result == ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY ||
@@ -1255,8 +1253,8 @@
// the uncompressed size. Although this violates the HTTP spec we want to
// support it (as IE and FireFox do), but *only* for an exact match.
// See http://crbug.com/79694.
- if (rv == net::ERR_CONTENT_LENGTH_MISMATCH ||
- rv == net::ERR_INCOMPLETE_CHUNKED_ENCODING) {
+ if (rv == ERR_CONTENT_LENGTH_MISMATCH ||
+ rv == ERR_INCOMPLETE_CHUNKED_ENCODING) {
if (request_ && request_->response_headers()) {
int64 expected_length = request_->response_headers()->GetContentLength();
VLOG(1) << __FUNCTION__ << "() "
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h
index 1931b70..f45058e 100644
--- a/net/url_request/url_request_http_job.h
+++ b/net/url_request/url_request_http_job.h
@@ -87,7 +87,7 @@
// Processes the Public-Key-Pins header, if one exists.
void ProcessPublicKeyPinsHeader();
- // |result| should be net::OK, or the request is canceled.
+ // |result| should be OK, or the request is canceled.
void OnHeadersReceivedCallback(int result);
void OnStartCompleted(int result);
void OnReadCompleted(int result);
@@ -138,7 +138,7 @@
// Starts the transaction if extensions using the webrequest API do not
// object.
void StartTransaction();
- // If |result| is net::OK, calls StartTransactionInternal. Otherwise notifies
+ // If |result| is OK, calls StartTransactionInternal. Otherwise notifies
// cancellation.
void MaybeStartTransactionInternal(int result);
void StartTransactionInternal();
diff --git a/net/url_request/url_request_redirect_job.cc b/net/url_request/url_request_redirect_job.cc
index 09e4abc..3901aa5 100644
--- a/net/url_request/url_request_redirect_job.cc
+++ b/net/url_request/url_request_redirect_job.cc
@@ -91,8 +91,7 @@
redirect_reason_.c_str());
std::string http_origin;
- const net::HttpRequestHeaders& request_headers =
- request_->extra_request_headers();
+ const HttpRequestHeaders& request_headers = request_->extra_request_headers();
if (request_headers.GetHeader("Origin", &http_origin)) {
// If this redirect is used in a cross-origin request, add CORS headers to
// make sure that the redirect gets through. Note that the destination URL
diff --git a/net/url_request/url_request_simple_job.cc b/net/url_request/url_request_simple_job.cc
index 46d9c38a9..bbb9178 100644
--- a/net/url_request/url_request_simple_job.cc
+++ b/net/url_request/url_request_simple_job.cc
@@ -77,12 +77,12 @@
base::Bind(&URLRequestSimpleJob::OnReadCompleted,
weak_factory_.GetWeakPtr(), buf_size));
next_data_offset_ += buf_size;
- SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
+ SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
return false;
}
void URLRequestSimpleJob::OnReadCompleted(int bytes_read) {
- SetStatus(net::URLRequestStatus());
+ SetStatus(URLRequestStatus());
NotifyReadComplete(bytes_read);
}
diff --git a/net/url_request/url_request_simple_job_unittest.cc b/net/url_request/url_request_simple_job_unittest.cc
index cf8e34a..1f8d5a4 100644
--- a/net/url_request/url_request_simple_job_unittest.cc
+++ b/net/url_request/url_request_simple_job_unittest.cc
@@ -68,12 +68,12 @@
DISALLOW_COPY_AND_ASSIGN(MockSimpleJob);
};
-class CancelURLRequestDelegate : public net::URLRequest::Delegate {
+class CancelURLRequestDelegate : public URLRequest::Delegate {
public:
explicit CancelURLRequestDelegate()
: buf_(new IOBuffer(kBufferSize)), run_loop_(new base::RunLoop) {}
- void OnResponseStarted(net::URLRequest* request) override {
+ void OnResponseStarted(URLRequest* request) override {
int bytes_read = 0;
EXPECT_FALSE(request->Read(buf_.get(), kBufferSize, &bytes_read));
EXPECT_TRUE(request->status().is_io_pending());
diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h
index fbdbe0f..cb8dcd9 100644
--- a/net/url_request/url_request_test_job.h
+++ b/net/url_request/url_request_test_job.h
@@ -53,7 +53,7 @@
// url. The headers should include the HTTP status line and be formatted as
// expected by HttpResponseHeaders.
URLRequestTestJob(URLRequest* request,
- net::NetworkDelegate* network_delegate,
+ NetworkDelegate* network_delegate,
const std::string& response_headers,
const std::string& response_data,
bool auto_advance);
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc
index ebccd876..f402aa5 100644
--- a/net/url_request/url_request_test_util.cc
+++ b/net/url_request/url_request_test_util.cc
@@ -394,9 +394,9 @@
}
void TestNetworkDelegate::OnBeforeSendProxyHeaders(
- net::URLRequest* request,
- const net::ProxyInfo& proxy_info,
- net::HttpRequestHeaders* headers) {
+ URLRequest* request,
+ const ProxyInfo& proxy_info,
+ HttpRequestHeaders* headers) {
++observed_before_proxy_headers_sent_callbacks_;
last_observed_proxy_ = proxy_info.proxy_server().host_port_pair();
}
@@ -439,7 +439,7 @@
if (!redirect_on_headers_received_url_.is_empty()) {
*override_response_headers =
- new net::HttpResponseHeaders(original_response_headers->raw_headers());
+ new HttpResponseHeaders(original_response_headers->raw_headers());
(*override_response_headers)->ReplaceStatusLine("HTTP/1.1 302 Found");
(*override_response_headers)->RemoveHeader("Location");
(*override_response_headers)->AddHeader(
diff --git a/net/url_request/url_request_test_util.h b/net/url_request/url_request_test_util.h
index c856c985..cfa75f007 100644
--- a/net/url_request/url_request_test_util.h
+++ b/net/url_request/url_request_test_util.h
@@ -300,9 +300,9 @@
int OnBeforeSendHeaders(URLRequest* request,
const CompletionCallback& callback,
HttpRequestHeaders* headers) override;
- void OnBeforeSendProxyHeaders(net::URLRequest* request,
- const net::ProxyInfo& proxy_info,
- net::HttpRequestHeaders* headers) override;
+ void OnBeforeSendProxyHeaders(URLRequest* request,
+ const ProxyInfo& proxy_info,
+ HttpRequestHeaders* headers) override;
void OnSendHeaders(URLRequest* request,
const HttpRequestHeaders& headers) override;
int OnHeadersReceived(
diff --git a/net/url_request/view_cache_helper_unittest.cc b/net/url_request/view_cache_helper_unittest.cc
index 097eade9..213a6f1 100644
--- a/net/url_request/view_cache_helper_unittest.cc
+++ b/net/url_request/view_cache_helper_unittest.cc
@@ -51,7 +51,7 @@
reinterpret_cast<const char*>(pickle.data())));
int len = static_cast<int>(pickle.size());
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
int rv = entry->WriteData(0, 0, buf.get(), len, cb.callback(), true);
ASSERT_EQ(len, cb.GetResult(rv));
}
@@ -64,7 +64,7 @@
scoped_refptr<IOBuffer> buf(new IOBuffer(len));
memcpy(buf->data(), data.data(), data.length());
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
int rv = entry->WriteData(index, 0, buf.get(), len, cb.callback(), true);
ASSERT_EQ(len, cb.GetResult(rv));
}
@@ -72,7 +72,7 @@
void WriteToEntry(disk_cache::Backend* cache, const std::string& key,
const std::string& data0, const std::string& data1,
const std::string& data2) {
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
disk_cache::Entry* entry;
int rv = cache->CreateEntry(key, &entry, cb.callback());
rv = cb.GetResult(rv);
@@ -89,7 +89,7 @@
}
void FillCache(URLRequestContext* context) {
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
disk_cache::Backend* cache;
int rv =
context->http_transaction_factory()->GetCache()->GetBackend(
@@ -185,7 +185,7 @@
TestURLRequestContext context;
ViewCacheHelper helper;
- net::TestCompletionCallback cb;
+ TestCompletionCallback cb;
disk_cache::Backend* cache;
int rv =
context.http_transaction_factory()->GetCache()->GetBackend(
diff --git a/net/websockets/websocket_frame.cc b/net/websockets/websocket_frame.cc
index a90cc0a..3782f282 100644
--- a/net/websockets/websocket_frame.cc
+++ b/net/websockets/websocket_frame.cc
@@ -13,6 +13,8 @@
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
+namespace net {
+
namespace {
const uint8 kFinalBit = 0x80;
@@ -26,20 +28,18 @@
const uint64 kPayloadLengthWithEightByteExtendedLengthField = 127;
inline void MaskWebSocketFramePayloadByBytes(
- const net::WebSocketMaskingKey& masking_key,
+ const WebSocketMaskingKey& masking_key,
size_t masking_key_offset,
char* const begin,
char* const end) {
for (char* masked = begin; masked != end; ++masked) {
*masked ^= masking_key.key[masking_key_offset++];
- if (masking_key_offset == net::WebSocketFrameHeader::kMaskingKeyLength)
+ if (masking_key_offset == WebSocketFrameHeader::kMaskingKeyLength)
masking_key_offset = 0;
}
}
-} // Unnamed namespace.
-
-namespace net {
+} // namespace
scoped_ptr<WebSocketFrameHeader> WebSocketFrameHeader::Clone() const {
scoped_ptr<WebSocketFrameHeader> ret(new WebSocketFrameHeader(opcode));