diff options
39 files changed, 344 insertions, 361 deletions
diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc index 1d4dacb..49e3d7b 100644 --- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc +++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc @@ -184,7 +184,7 @@ class GViewRequestInterceptorTest : public testing::Test { scoped_refptr<PluginPrefs> plugin_prefs_; net::URLRequestJobFactoryImpl job_factory_; const net::URLRequestJobFactory* old_factory_; - net::TestDelegate test_delegate_; + TestDelegate test_delegate_; FilePath pdf_path_; content::MockResourceContext resource_context_; }; diff --git a/chrome/browser/component_updater/test/component_updater_service_unittest.cc b/chrome/browser/component_updater/test/component_updater_service_unittest.cc index d66cca9..6a25757 100644 --- a/chrome/browser/component_updater/test/component_updater_service_unittest.cc +++ b/chrome/browser/component_updater/test/component_updater_service_unittest.cc @@ -64,7 +64,7 @@ class TestConfigurator : public ComponentUpdateService::Configurator { virtual size_t UrlSizeLimit() OVERRIDE { return 256; } virtual net::URLRequestContextGetter* RequestContext() OVERRIDE { - return new net::TestURLRequestContextGetter( + return new TestURLRequestContextGetter( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); } diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc index ee15049..9b33ea2 100644 --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc @@ -123,7 +123,7 @@ TEST(WebRequestActionTest, PerlToRe2Style) { TEST(WebRequestActionTest, TestPermissions) { // Necessary for TestURLRequest. MessageLoop message_loop(MessageLoop::TYPE_IO); - net::TestURLRequestContext context; + TestURLRequestContext context; std::string error; bool bad_message = false; @@ -146,7 +146,7 @@ TEST(WebRequestActionTest, TestPermissions) { ASSERT_TRUE(action.get()); // Check that redirect works on regular URLs but not on protected URLs. - net::TestURLRequest regular_request(GURL("http://test.com"), NULL, &context); + TestURLRequest regular_request(GURL("http://test.com"), NULL, &context); std::list<LinkedPtrEventResponseDelta> deltas = action_set->CreateDeltas( NULL, "ext1", @@ -154,8 +154,8 @@ TEST(WebRequestActionTest, TestPermissions) { false, base::Time()); EXPECT_EQ(1u, deltas.size()); - net::TestURLRequest protected_request(GURL("http://clients1.google.com"), - NULL, &context); + TestURLRequest protected_request(GURL("http://clients1.google.com"), + NULL, &context); deltas = action_set->CreateDeltas( NULL, "ext1", WebRequestRule::RequestData(&protected_request, ON_BEFORE_REQUEST), diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc index 83515fc..9ce53ab 100644 --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc @@ -84,15 +84,14 @@ TEST(WebRequestConditionAttributeTest, ResourceType) { EXPECT_EQ("", error); ASSERT_TRUE(attribute.get()); - net::TestURLRequestContext context; - net::TestURLRequest url_request_ok( - GURL("http://www.example.com"), NULL, &context); + TestURLRequestContext context; + TestURLRequest url_request_ok(GURL("http://www.example.com"), NULL, &context); content::ResourceRequestInfo::AllocateForTesting(&url_request_ok, ResourceType::MAIN_FRAME, NULL, -1, -1); EXPECT_TRUE(attribute->IsFulfilled( WebRequestRule::RequestData(&url_request_ok, ON_BEFORE_REQUEST))); - net::TestURLRequest url_request_fail( + TestURLRequest url_request_fail( GURL("http://www.example.com"), NULL, &context); content::ResourceRequestInfo::AllocateForTesting(&url_request_ok, ResourceType::SUB_FRAME, NULL, -1, -1); @@ -114,10 +113,10 @@ TEST(WebRequestConditionAttributeTest, ContentType) { "chrome/test/data/extensions/api_test/webrequest/declarative"))); ASSERT_TRUE(test_server.Start()); - net::TestURLRequestContext context; - net::TestDelegate delegate; - net::TestURLRequest url_request(test_server.GetURL("files/headers.html"), - &delegate, &context); + TestURLRequestContext context; + TestDelegate delegate; + TestURLRequest url_request(test_server.GetURL("files/headers.html"), + &delegate, &context); url_request.Start(); MessageLoop::current()->Run(); @@ -191,9 +190,9 @@ TEST(WebRequestConditionAttributeTest, ThirdParty) { const GURL url_empty; const GURL url_a("http://a.com"); const GURL url_b("http://b.com"); - net::TestURLRequestContext context; - net::TestDelegate delegate; - net::TestURLRequest url_request(url_a, &delegate, &context); + TestURLRequestContext context; + TestDelegate delegate; + TestURLRequest url_request(url_a, &delegate, &context); for (unsigned int i = 1; i <= kLastActiveStage; i <<= 1) { if (!(kActiveStages & i)) @@ -278,9 +277,9 @@ TEST(WebRequestConditionAttributeTest, Stages) { } const GURL url_empty; - net::TestURLRequestContext context; - net::TestDelegate delegate; - net::TestURLRequest url_request(url_empty, &delegate, &context); + TestURLRequestContext context; + TestDelegate delegate; + TestURLRequest url_request(url_empty, &delegate, &context); for (size_t i = 0; i < arraysize(active_stages); ++i) { EXPECT_FALSE(empty_attribute->IsFulfilled(WebRequestRule::RequestData( @@ -400,10 +399,10 @@ TEST(WebRequestConditionAttributeTest, RequestHeaders) { // Necessary for TestURLRequest. MessageLoop message_loop(MessageLoop::TYPE_IO); - net::TestURLRequestContext context; - net::TestDelegate delegate; - net::TestURLRequest url_request(GURL("http://example.com"), // Dummy URL. - &delegate, &context); + TestURLRequestContext context; + TestDelegate delegate; + TestURLRequest url_request(GURL("http://example.com"), // Dummy URL. + &delegate, &context); url_request.SetExtraRequestHeaderByName( "Custom-header", "custom/value", true /* overwrite */); url_request.Start(); @@ -485,10 +484,10 @@ TEST(WebRequestConditionAttributeTest, ResponseHeaders) { "chrome/test/data/extensions/api_test/webrequest/declarative"))); ASSERT_TRUE(test_server.Start()); - net::TestURLRequestContext context; - net::TestDelegate delegate; - net::TestURLRequest url_request(test_server.GetURL("files/headers.html"), - &delegate, &context); + TestURLRequestContext context; + TestDelegate delegate; + TestURLRequest url_request(test_server.GetURL("files/headers.html"), + &delegate, &context); url_request.Start(); MessageLoop::current()->Run(); diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc index 85b503f..52569f7 100644 --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc @@ -69,15 +69,14 @@ TEST(WebRequestConditionTest, CreateCondition) { EXPECT_EQ("", error); ASSERT_TRUE(result.get()); - net::TestURLRequestContext context; - net::TestURLRequest match_request( - GURL("http://www.example.com"), NULL, &context); + TestURLRequestContext context; + TestURLRequest match_request(GURL("http://www.example.com"), NULL, &context); content::ResourceRequestInfo::AllocateForTesting(&match_request, ResourceType::MAIN_FRAME, NULL, -1, -1); EXPECT_TRUE(result->IsFulfilled( WebRequestRule::RequestData(&match_request, ON_BEFORE_REQUEST))); - net::TestURLRequest wrong_resource_type( + TestURLRequest wrong_resource_type( GURL("https://www.example.com"), NULL, &context); content::ResourceRequestInfo::AllocateForTesting(&wrong_resource_type, ResourceType::SUB_FRAME, NULL, -1, -1); @@ -141,8 +140,8 @@ TEST(WebRequestConditionTest, CreateConditionSet) { // Test that the result is correct and matches http://www.example.com and // https://www.example.com GURL http_url("http://www.example.com"); - net::TestURLRequestContext context; - net::TestURLRequest http_request(http_url, NULL, &context); + TestURLRequestContext context; + TestURLRequest http_request(http_url, NULL, &context); url_match_ids = matcher.MatchURL(http_url); for (std::set<URLMatcherConditionSet::ID>::iterator i = url_match_ids.begin(); i != url_match_ids.end(); ++i) { @@ -154,7 +153,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) { GURL https_url("https://www.example.com"); url_match_ids = matcher.MatchURL(https_url); - net::TestURLRequest https_request(https_url, NULL, &context); + TestURLRequest https_request(https_url, NULL, &context); number_matches = 0; for (std::set<URLMatcherConditionSet::ID>::iterator i = url_match_ids.begin(); i != url_match_ids.end(); ++i) { @@ -167,7 +166,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) { // Check that both, hostPrefix and hostSuffix are evaluated. GURL https_foo_url("https://foo.example.com"); url_match_ids = matcher.MatchURL(https_foo_url); - net::TestURLRequest https_foo_request(https_foo_url, NULL, &context); + TestURLRequest https_foo_request(https_foo_url, NULL, &context); number_matches = 0; for (std::set<URLMatcherConditionSet::ID>::iterator i = url_match_ids.begin(); i != url_match_ids.end(); ++i) { @@ -224,23 +223,23 @@ TEST(WebRequestConditionTest, TestPortFilter) { // Test various URLs. GURL http_url("http://www.example.com"); - net::TestURLRequestContext context; - net::TestURLRequest http_request(http_url, NULL, &context); + TestURLRequestContext context; + TestURLRequest http_request(http_url, NULL, &context); url_match_ids = matcher.MatchURL(http_url); ASSERT_EQ(1u, url_match_ids.size()); GURL http_url_80("http://www.example.com:80"); - net::TestURLRequest http_request_80(http_url_80, NULL, &context); + TestURLRequest http_request_80(http_url_80, NULL, &context); url_match_ids = matcher.MatchURL(http_url_80); ASSERT_EQ(1u, url_match_ids.size()); GURL http_url_1000("http://www.example.com:1000"); - net::TestURLRequest http_request_1000(http_url_1000, NULL, &context); + TestURLRequest http_request_1000(http_url_1000, NULL, &context); url_match_ids = matcher.MatchURL(http_url_1000); ASSERT_EQ(1u, url_match_ids.size()); GURL http_url_2000("http://www.example.com:2000"); - net::TestURLRequest http_request_2000(http_url_2000, NULL, &context); + TestURLRequest http_request_2000(http_url_2000, NULL, &context); url_match_ids = matcher.MatchURL(http_url_2000); ASSERT_EQ(0u, url_match_ids.size()); } diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc index e92ec74..b6c3e2fcd 100644 --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc @@ -227,8 +227,8 @@ TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) { std::set<WebRequestRule::GlobalRuleId> matches; GURL http_url("http://www.example.com"); - net::TestURLRequestContext context; - net::TestURLRequest http_request(http_url, NULL, &context); + TestURLRequestContext context; + TestURLRequest http_request(http_url, NULL, &context); matches = registry->GetMatches( WebRequestRule::RequestData(&http_request, ON_BEFORE_REQUEST)); EXPECT_EQ(2u, matches.size()); @@ -238,7 +238,7 @@ TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) { matches.end()); GURL foobar_url("http://www.foobar.com"); - net::TestURLRequest foobar_request(foobar_url, NULL, &context); + TestURLRequest foobar_request(foobar_url, NULL, &context); matches = registry->GetMatches( WebRequestRule::RequestData(&foobar_request, ON_BEFORE_REQUEST)); EXPECT_EQ(1u, matches.size()); @@ -359,8 +359,8 @@ TEST_F(WebRequestRulesRegistryTest, Precedences) { EXPECT_EQ("", error); GURL url("http://www.google.com"); - net::TestURLRequestContext context; - net::TestURLRequest request(url, NULL, &context); + TestURLRequestContext context; + TestURLRequest request(url, NULL, &context); std::list<LinkedPtrEventResponseDelta> deltas = registry->CreateDeltas( NULL, @@ -409,8 +409,8 @@ TEST_F(WebRequestRulesRegistryTest, Priorities) { EXPECT_EQ("", error); GURL url("http://www.google.com/index.html"); - net::TestURLRequestContext context; - net::TestURLRequest request(url, NULL, &context); + TestURLRequestContext context; + TestURLRequest request(url, NULL, &context); std::list<LinkedPtrEventResponseDelta> deltas = registry->CreateDeltas( NULL, diff --git a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc index 14a609c..b1c5367 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api_unittest.cc @@ -164,7 +164,7 @@ class ExtensionWebRequestTest : public testing::Test { event_router_.get(), NULL, NULL, NULL, &profile_, CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, NULL, NULL, NULL)); - context_.reset(new net::TestURLRequestContext(true)); + context_.reset(new TestURLRequestContext(true)); context_->set_network_delegate(network_delegate_.get()); context_->Init(); } @@ -180,13 +180,13 @@ class ExtensionWebRequestTest : public testing::Test { content::TestBrowserThread ui_thread_; content::TestBrowserThread io_thread_; TestingProfile profile_; - net::TestDelegate delegate_; + TestDelegate delegate_; BooleanPrefMember enable_referrers_; TestIPCSender ipc_sender_; scoped_refptr<extensions::EventRouterForwarder> event_router_; scoped_refptr<ExtensionInfoMap> extension_info_map_; scoped_ptr<ChromeNetworkDelegate> network_delegate_; - scoped_ptr<net::TestURLRequestContext> context_; + scoped_ptr<TestURLRequestContext> context_; }; // Tests that we handle disagreements among extensions about responses to @@ -707,7 +707,7 @@ class ExtensionWebRequestHeaderModificationTest : event_router_.get(), NULL, NULL, NULL, &profile_, CookieSettings::Factory::GetForProfile(&profile_), &enable_referrers_, NULL, NULL, NULL)); - context_.reset(new net::TestURLRequestContext(true)); + context_.reset(new TestURLRequestContext(true)); host_resolver_.reset(new net::MockHostResolver()); host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); context_->set_host_resolver(host_resolver_.get()); @@ -719,14 +719,14 @@ class ExtensionWebRequestHeaderModificationTest : content::TestBrowserThread ui_thread_; content::TestBrowserThread io_thread_; TestingProfile profile_; - net::TestDelegate delegate_; + TestDelegate delegate_; BooleanPrefMember enable_referrers_; TestIPCSender ipc_sender_; scoped_refptr<extensions::EventRouterForwarder> event_router_; scoped_refptr<ExtensionInfoMap> extension_info_map_; scoped_ptr<ChromeNetworkDelegate> network_delegate_; scoped_ptr<net::MockHostResolver> host_resolver_; - scoped_ptr<net::TestURLRequestContext> context_; + scoped_ptr<TestURLRequestContext> context_; }; TEST_P(ExtensionWebRequestHeaderModificationTest, TestModifications) { diff --git a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc index d594c9f..b96c6f6 100644 --- a/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc @@ -16,7 +16,7 @@ using content::ResourceRequestInfo; TEST(ExtensionWebRequestHelpersTest, TestHideRequestForURL) { MessageLoopForIO message_loop; - net::TestURLRequestContext context; + TestURLRequestContext context; scoped_refptr<ExtensionInfoMap> extension_info_map(new ExtensionInfoMap); const char* sensitive_urls[] = { "http://clients2.google.com", @@ -36,7 +36,7 @@ TEST(ExtensionWebRequestHelpersTest, TestHideRequestForURL) { // Check that requests are rejected based on the destination for (size_t i = 0; i < arraysize(sensitive_urls); ++i) { GURL sensitive_url(sensitive_urls[i]); - net::TestURLRequest request(sensitive_url, NULL, &context); + TestURLRequest request(sensitive_url, NULL, &context); EXPECT_TRUE( WebRequestPermissions::HideRequest(extension_info_map.get(), &request)) << sensitive_urls[i]; @@ -44,7 +44,7 @@ TEST(ExtensionWebRequestHelpersTest, TestHideRequestForURL) { // Check that requests are accepted if they don't touch sensitive urls. for (size_t i = 0; i < arraysize(non_sensitive_urls); ++i) { GURL non_sensitive_url(non_sensitive_urls[i]); - net::TestURLRequest request(non_sensitive_url, NULL, &context); + TestURLRequest request(non_sensitive_url, NULL, &context); EXPECT_FALSE( WebRequestPermissions::HideRequest(extension_info_map.get(), &request)) << non_sensitive_urls[i]; @@ -54,14 +54,14 @@ TEST(ExtensionWebRequestHelpersTest, TestHideRequestForURL) { // WebStore. // Normally this request is not protected: GURL non_sensitive_url("http://www.google.com/test.js"); - net::TestURLRequest non_sensitive_request(non_sensitive_url, NULL, &context); + TestURLRequest non_sensitive_request(non_sensitive_url, NULL, &context); EXPECT_FALSE(WebRequestPermissions::HideRequest(extension_info_map.get(), &non_sensitive_request)); // If the origin is labeled by the WebStoreAppId, it becomes protected. int process_id = 42; int site_instance_id = 23; int frame_id = 17; - net::TestURLRequest sensitive_request(non_sensitive_url, NULL, &context); + TestURLRequest sensitive_request(non_sensitive_url, NULL, &context); ResourceRequestInfo::AllocateForTesting(&sensitive_request, ResourceType::SCRIPT, NULL, process_id, frame_id); extension_info_map->RegisterExtensionProcess(extension_misc::kWebStoreAppId, diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index c0e7837..0cd6836 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -85,7 +85,7 @@ class ExtensionProtocolTest : public testing::Test { scoped_refptr<ExtensionInfoMap> extension_info_map_; net::URLRequestJobFactoryImpl job_factory_; const net::URLRequestJobFactory* old_factory_; - net::TestDelegate test_delegate_; + TestDelegate test_delegate_; content::MockResourceContext resource_context_; }; diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index fcc3bb4..d78d955 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -133,12 +133,11 @@ class UserScriptListenerTest } protected: - net::TestURLRequest* StartTestRequest(net::URLRequest::Delegate* delegate, - const std::string& url_string, - net::TestURLRequestContext* context) { + TestURLRequest* StartTestRequest(net::URLRequest::Delegate* delegate, + const std::string& url_string, + TestURLRequestContext* context) { GURL url(url_string); - net::TestURLRequest* request = - new net::TestURLRequest(url, delegate, context); + TestURLRequest* request = new TestURLRequest(url, delegate, context); ResourceThrottle* throttle = listener_->CreateResourceThrottle(url, ResourceType::MAIN_FRAME); @@ -183,9 +182,9 @@ TEST_F(UserScriptListenerTest, DelayAndUpdate) { LoadTestExtension(); MessageLoop::current()->RunAllPending(); - net::TestDelegate delegate; - net::TestURLRequestContext context; - scoped_ptr<net::TestURLRequest> request( + TestDelegate delegate; + TestURLRequestContext context; + scoped_ptr<TestURLRequest> request( StartTestRequest(&delegate, kMatchingUrl, &context)); ASSERT_FALSE(request->is_pending()); @@ -201,9 +200,9 @@ TEST_F(UserScriptListenerTest, DelayAndUnload) { LoadTestExtension(); MessageLoop::current()->RunAllPending(); - net::TestDelegate delegate; - net::TestURLRequestContext context; - scoped_ptr<net::TestURLRequest> request( + TestDelegate delegate; + TestURLRequestContext context; + scoped_ptr<TestURLRequest> request( StartTestRequest(&delegate, kMatchingUrl, &context)); ASSERT_FALSE(request->is_pending()); @@ -223,9 +222,9 @@ TEST_F(UserScriptListenerTest, DelayAndUnload) { } TEST_F(UserScriptListenerTest, NoDelayNoExtension) { - net::TestDelegate delegate; - net::TestURLRequestContext context; - scoped_ptr<net::TestURLRequest> request( + TestDelegate delegate; + TestURLRequestContext context; + scoped_ptr<TestURLRequest> request( StartTestRequest(&delegate, kMatchingUrl, &context)); // The request should be started immediately. @@ -239,11 +238,11 @@ TEST_F(UserScriptListenerTest, NoDelayNotMatching) { LoadTestExtension(); MessageLoop::current()->RunAllPending(); - net::TestDelegate delegate; - net::TestURLRequestContext context; - scoped_ptr<net::TestURLRequest> request(StartTestRequest(&delegate, - kNotMatchingUrl, - &context)); + TestDelegate delegate; + TestURLRequestContext context; + scoped_ptr<TestURLRequest> request(StartTestRequest(&delegate, + kNotMatchingUrl, + &context)); // The request should be started immediately. ASSERT_TRUE(request->is_pending()); @@ -269,9 +268,9 @@ TEST_F(UserScriptListenerTest, MultiProfile) { content::Source<Profile>(&profile2), content::Details<Extension>(extension.get())); - net::TestDelegate delegate; - net::TestURLRequestContext context; - scoped_ptr<net::TestURLRequest> request( + TestDelegate delegate; + TestURLRequestContext context; + scoped_ptr<TestURLRequest> request( StartTestRequest(&delegate, kMatchingUrl, &context)); ASSERT_FALSE(request->is_pending()); @@ -300,11 +299,11 @@ TEST_F(UserScriptListenerTest, MultiProfile) { TEST_F(UserScriptListenerTest, ResumeBeforeStart) { LoadTestExtension(); MessageLoop::current()->RunAllPending(); - net::TestDelegate delegate; - net::TestURLRequestContext context; + TestDelegate delegate; + TestURLRequestContext context; GURL url(kMatchingUrl); - scoped_ptr<net::TestURLRequest> request( - new net::TestURLRequest(url, &delegate, &context)); + scoped_ptr<TestURLRequest> request( + new TestURLRequest(url, &delegate, &context)); ResourceThrottle* throttle = listener_->CreateResourceThrottle(url, ResourceType::MAIN_FRAME); diff --git a/chrome/browser/intents/cws_intents_registry_unittest.cc b/chrome/browser/intents/cws_intents_registry_unittest.cc index 9a66701..00017b6 100644 --- a/chrome/browser/intents/cws_intents_registry_unittest.cc +++ b/chrome/browser/intents/cws_intents_registry_unittest.cc @@ -154,8 +154,8 @@ const char kImagePngType[] = "image/png"; class CWSIntentsRegistryTest : public testing::Test { public: virtual void SetUp() { - scoped_refptr<net::TestURLRequestContextGetter> context_getter( - new net::TestURLRequestContextGetter(ui_loop_.message_loop_proxy())); + scoped_refptr<TestURLRequestContextGetter> context_getter( + new TestURLRequestContextGetter(ui_loop_.message_loop_proxy())); registry_.reset(context_getter); } diff --git a/chrome/browser/net/chrome_network_delegate_unittest.cc b/chrome/browser/net/chrome_network_delegate_unittest.cc index d08d8b5..e92393e 100644 --- a/chrome/browser/net/chrome_network_delegate_unittest.cc +++ b/chrome/browser/net/chrome_network_delegate_unittest.cc @@ -46,12 +46,12 @@ class ChromeNetworkDelegateTest : public testing::Test { void NeverThrottleLogicImpl() { scoped_ptr<ChromeNetworkDelegate> delegate(CreateNetworkDelegate()); - net::TestURLRequestContext context; - net::TestURLRequest extension_request( + TestURLRequestContext context; + TestURLRequest extension_request( GURL("http://example.com/"), NULL, &context); extension_request.set_first_party_for_cookies( GURL("chrome-extension://abcdef/bingo.html")); - net::TestURLRequest web_page_request( + TestURLRequest web_page_request( GURL("http://example.com/"), NULL, &context); web_page_request.set_first_party_for_cookies( GURL("http://example.com/helloworld.html")); @@ -130,7 +130,7 @@ class ChromeNetworkDelegateSafeSearchTest : public testing::Test { // Show the URL in the trace so we know where we failed. SCOPED_TRACE(url_string); - net::TestURLRequest request(GURL(url_string), &delegate_, &context_); + TestURLRequest request(GURL(url_string), &delegate_, &context_); request.Start(); MessageLoop::current()->RunUntilIdle(); @@ -145,8 +145,8 @@ class ChromeNetworkDelegateSafeSearchTest : public testing::Test { BooleanPrefMember enable_referrers_; BooleanPrefMember force_google_safe_search_; scoped_ptr<net::URLRequest> request_; - net::TestURLRequestContext context_; - net::TestDelegate delegate_; + TestURLRequestContext context_; + TestDelegate delegate_; MessageLoopForIO message_loop_; scoped_ptr<content::TestBrowserThread> io_thread_; }; diff --git a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc index 6f7cbcc..65b0b11 100644 --- a/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc +++ b/chrome/browser/net/http_pipelining_compatibility_client_unittest.cc @@ -94,7 +94,7 @@ class HttpPipeliningCompatibilityClientTest : public testing::Test { // TODO(rtenneti): Leaks StatisticsRecorder and will update suppressions. base::StatisticsRecorder::Initialize(); ASSERT_TRUE(test_server_.Start()); - context_ = new net::TestURLRequestContextGetter( + context_ = new TestURLRequestContextGetter( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); context_->AddRef(); @@ -204,7 +204,7 @@ class HttpPipeliningCompatibilityClientTest : public testing::Test { MessageLoopForIO message_loop_; net::TestServer test_server_; - net::TestURLRequestContextGetter* context_; + TestURLRequestContextGetter* context_; content::TestBrowserThread io_thread_; private: diff --git a/chrome/browser/predictors/resource_prefetcher_unittest.cc b/chrome/browser/predictors/resource_prefetcher_unittest.cc index 72c99d1..d5ab8ea 100644 --- a/chrome/browser/predictors/resource_prefetcher_unittest.cc +++ b/chrome/browser/predictors/resource_prefetcher_unittest.cc @@ -46,7 +46,7 @@ class TestResourcePrefetcher : public ResourcePrefetcher { class TestResourcePrefetcherDelegate : public ResourcePrefetcher::Delegate { public: explicit TestResourcePrefetcherDelegate(MessageLoop* loop) - : request_context_getter_(new net::TestURLRequestContextGetter( + : request_context_getter_(new TestURLRequestContextGetter( loop->message_loop_proxy())) { } ~TestResourcePrefetcherDelegate() { } @@ -59,7 +59,7 @@ class TestResourcePrefetcherDelegate : public ResourcePrefetcher::Delegate { ResourcePrefetcher::RequestVector* requests)); private: - scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; + scoped_refptr<TestURLRequestContextGetter> request_context_getter_; DISALLOW_COPY_AND_ASSIGN(TestResourcePrefetcherDelegate); }; diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc index 4f67ada..fabc49e 100644 --- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc +++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc @@ -119,10 +119,10 @@ class TestController { const GURL expected_url() { return expected_url_; } - void set_delegate(net::TestDelegate* delegate) { + void set_delegate(TestDelegate* delegate) { delegate_ = delegate; } - net::TestDelegate* delegate() { + TestDelegate* delegate() { return delegate_; } void set_use_delegate(bool value) { @@ -140,7 +140,7 @@ class TestController { bool result_; bool use_delegate_; GURL expected_url_; - net::TestDelegate* delegate_; + TestDelegate* delegate_; friend struct DefaultSingletonTraits<TestController>; }; @@ -156,7 +156,7 @@ class PrintDialogCloudTest : public InProcessBrowserTest { // Must be static for handing into AddHostnameHandler. static net::URLRequest::ProtocolFactory Factory; - class AutoQuitDelegate : public net::TestDelegate { + class AutoQuitDelegate : public TestDelegate { public: AutoQuitDelegate() {} diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc index b5ec124..2507893 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher_unittest.cc @@ -27,7 +27,7 @@ const FilePath::CharType kDocRoot[] = FILE_PATH_LITERAL("chrome/test/data"); int g_request_context_getter_instances = 0; class TrackingTestURLRequestContextGetter - : public net::TestURLRequestContextGetter { + : public TestURLRequestContextGetter { public: explicit TrackingTestURLRequestContextGetter( base::MessageLoopProxy* io_message_loop_proxy, @@ -38,9 +38,9 @@ class TrackingTestURLRequestContextGetter g_request_context_getter_instances++; } - virtual net::TestURLRequestContext* GetURLRequestContext() OVERRIDE { + virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE { if (!context_.get()) { - context_.reset(new net::TestURLRequestContext(true)); + context_.reset(new TestURLRequestContext(true)); context_->set_throttler_manager(throttler_manager_); context_->Init(); } @@ -55,7 +55,7 @@ class TrackingTestURLRequestContextGetter private: // Not owned here. net::URLRequestThrottlerManager* throttler_manager_; - scoped_ptr<net::TestURLRequestContext> context_; + scoped_ptr<TestURLRequestContext> context_; }; class TestCloudPrintURLFetcher : public CloudPrintURLFetcher { diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 2510025..fdb8bbb 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -618,7 +618,7 @@ net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( void TestingProfile::CreateRequestContext() { if (!request_context_) request_context_ = - new net::TestURLRequestContextGetter( + new TestURLRequestContextGetter( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); } diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 99c9643..00f7659 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -752,7 +752,7 @@ void CFUrlRequestUnittestRunner::OnInitializationTimeout() { void CFUrlRequestUnittestRunner::OverrideHttpHost() { override_http_host_.reset( - new net::ScopedCustomUrlRequestTestHttpHost( + new ScopedCustomUrlRequestTestHttpHost( chrome_frame_test::GetLocalIPv4Address())); } diff --git a/chrome_frame/test/net/fake_external_tab.h b/chrome_frame/test/net/fake_external_tab.h index 43ae7246..18e24b0 100644 --- a/chrome_frame/test/net/fake_external_tab.h +++ b/chrome_frame/test/net/fake_external_tab.h @@ -23,10 +23,7 @@ class CommandLine; class FakeBrowserProcessImpl; class ProcessSingleton; - -namespace net { class ScopedCustomUrlRequestTestHttpHost; -} // namespace net namespace content { class NotificationService; @@ -125,7 +122,7 @@ class CFUrlRequestUnittestRunner base::ProcessHandle crash_service_; DWORD test_thread_id_; - scoped_ptr<net::ScopedCustomUrlRequestTestHttpHost> override_http_host_; + scoped_ptr<ScopedCustomUrlRequestTestHttpHost> override_http_host_; scoped_ptr<test_server::SimpleWebServer> test_http_server_; test_server::SimpleResponse chrome_frame_html_; diff --git a/chrome_frame/test/test_server_test.cc b/chrome_frame/test/test_server_test.cc index 54f96a6..f3d7899 100644 --- a/chrome_frame/test/test_server_test.cc +++ b/chrome_frame/test/test_server_test.cc @@ -65,7 +65,7 @@ class TestURLRequest : public net::URLRequest { public: TestURLRequest(const GURL& url, Delegate* delegate, - net::TestURLRequestContext* context) + TestURLRequestContext* context) : net::URLRequest(url, delegate, context) { } }; @@ -81,7 +81,7 @@ class UrlTaskChain { MessageLoopForIO loop; - net::TestURLRequestContext context; + TestURLRequestContext context; TestURLRequest r(GURL(url_), &delegate_, &context); r.Start(); EXPECT_TRUE(r.is_pending()); @@ -103,7 +103,7 @@ class UrlTaskChain { protected: std::string url_; - net::TestDelegate delegate_; + TestDelegate delegate_; UrlTaskChain* next_; }; diff --git a/content/public/test/mock_resource_context.cc b/content/public/test/mock_resource_context.cc index 2758c2f..8f0df65 100644 --- a/content/public/test/mock_resource_context.cc +++ b/content/public/test/mock_resource_context.cc @@ -10,7 +10,7 @@ namespace content { MockResourceContext::MockResourceContext() - : test_request_context_(new net::TestURLRequestContext) { + : test_request_context_(new TestURLRequestContext) { } MockResourceContext::~MockResourceContext() {} diff --git a/content/test/webrtc_audio_device_test.cc b/content/test/webrtc_audio_device_test.cc index 0fc3e2d..ba01e1a 100644 --- a/content/test/webrtc_audio_device_test.cc +++ b/content/test/webrtc_audio_device_test.cc @@ -205,7 +205,7 @@ void WebRTCAudioDeviceTest::InitializeIOThread(const char* thread_name) { MessageLoop::current())); // Populate our resource context. - test_request_context_.reset(new net::TestURLRequestContext()); + test_request_context_.reset(new TestURLRequestContext()); MockRTCResourceContext* resource_context = static_cast<MockRTCResourceContext*>(resource_context_.get()); resource_context->set_request_context(test_request_context_.get()); diff --git a/jingle/glue/proxy_resolving_client_socket_unittest.cc b/jingle/glue/proxy_resolving_client_socket_unittest.cc index 662ba77..49d95f5 100644 --- a/jingle/glue/proxy_resolving_client_socket_unittest.cc +++ b/jingle/glue/proxy_resolving_client_socket_unittest.cc @@ -17,7 +17,7 @@ namespace { -class MyTestURLRequestContext : public net::TestURLRequestContext { +class MyTestURLRequestContext : public TestURLRequestContext { public: MyTestURLRequestContext() : TestURLRequestContext(true) { context_storage_.set_proxy_service( @@ -35,10 +35,9 @@ namespace jingle_glue { class ProxyResolvingClientSocketTest : public testing::Test { protected: ProxyResolvingClientSocketTest() - : url_request_context_getter_(new net::TestURLRequestContextGetter( + : url_request_context_getter_(new TestURLRequestContextGetter( base::MessageLoopProxy::current(), - scoped_ptr<net::TestURLRequestContext>( - new MyTestURLRequestContext))) {} + scoped_ptr<TestURLRequestContext>(new MyTestURLRequestContext))) {} virtual ~ProxyResolvingClientSocketTest() {} @@ -49,7 +48,7 @@ class ProxyResolvingClientSocketTest : public testing::Test { } MessageLoop message_loop_; - scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; + scoped_refptr<TestURLRequestContextGetter> url_request_context_getter_; }; // TODO(sanjeevr): Fix this test on Linux. diff --git a/jingle/notifier/base/xmpp_connection_unittest.cc b/jingle/notifier/base/xmpp_connection_unittest.cc index c6f9c81..05ddfc1 100644 --- a/jingle/notifier/base/xmpp_connection_unittest.cc +++ b/jingle/notifier/base/xmpp_connection_unittest.cc @@ -75,7 +75,7 @@ class XmppConnectionTest : public testing::Test { protected: XmppConnectionTest() : mock_pre_xmpp_auth_(new MockPreXmppAuth()), - url_request_context_getter_(new net::TestURLRequestContextGetter( + url_request_context_getter_(new TestURLRequestContextGetter( message_loop_.message_loop_proxy())) {} virtual ~XmppConnectionTest() {} @@ -89,7 +89,7 @@ class XmppConnectionTest : public testing::Test { MessageLoop message_loop_; MockXmppConnectionDelegate mock_xmpp_connection_delegate_; scoped_ptr<MockPreXmppAuth> mock_pre_xmpp_auth_; - scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_; + scoped_refptr<TestURLRequestContextGetter> url_request_context_getter_; }; TEST_F(XmppConnectionTest, CreateDestroy) { diff --git a/jingle/notifier/communicator/single_login_attempt_unittest.cc b/jingle/notifier/communicator/single_login_attempt_unittest.cc index bc6f2df..7b35c3c 100644 --- a/jingle/notifier/communicator/single_login_attempt_unittest.cc +++ b/jingle/notifier/communicator/single_login_attempt_unittest.cc @@ -70,7 +70,7 @@ class FakeDelegate : public SingleLoginAttempt::Delegate { ServerInformation redirect_server_; }; -class MyTestURLRequestContext : public net::TestURLRequestContext { +class MyTestURLRequestContext : public TestURLRequestContext { public: MyTestURLRequestContext() : TestURLRequestContext(true) { context_storage_.set_host_resolver( @@ -85,10 +85,9 @@ class SingleLoginAttemptTest : public ::testing::Test { SingleLoginAttemptTest() : login_settings_( buzz::XmppClientSettings(), - new net::TestURLRequestContextGetter( + new TestURLRequestContextGetter( base::MessageLoopProxy::current(), - scoped_ptr<net::TestURLRequestContext>( - new MyTestURLRequestContext())), + scoped_ptr<TestURLRequestContext>(new MyTestURLRequestContext())), ServerList( 1, ServerInformation( diff --git a/jingle/notifier/listener/push_client_unittest.cc b/jingle/notifier/listener/push_client_unittest.cc index 44d4d98..42daf2a 100644 --- a/jingle/notifier/listener/push_client_unittest.cc +++ b/jingle/notifier/listener/push_client_unittest.cc @@ -22,8 +22,7 @@ class PushClientTest : public testing::Test { protected: PushClientTest() { notifier_options_.request_context_getter = - new net::TestURLRequestContextGetter( - message_loop_.message_loop_proxy()); + new TestURLRequestContextGetter(message_loop_.message_loop_proxy()); } virtual ~PushClientTest() {} diff --git a/jingle/notifier/listener/xmpp_push_client_unittest.cc b/jingle/notifier/listener/xmpp_push_client_unittest.cc index c4d53de..3beb488 100644 --- a/jingle/notifier/listener/xmpp_push_client_unittest.cc +++ b/jingle/notifier/listener/xmpp_push_client_unittest.cc @@ -34,8 +34,7 @@ class XmppPushClientTest : public testing::Test { protected: XmppPushClientTest() { notifier_options_.request_context_getter = - new net::TestURLRequestContextGetter( - message_loop_.message_loop_proxy()); + new TestURLRequestContextGetter(message_loop_.message_loop_proxy()); } virtual ~XmppPushClientTest() {} diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc index 8007767..594b3a6 100644 --- a/net/socket_stream/socket_stream_unittest.cc +++ b/net/socket_stream/socket_stream_unittest.cc @@ -23,8 +23,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" -namespace net { - namespace { struct SocketStreamEvent { @@ -34,25 +32,25 @@ struct SocketStreamEvent { }; SocketStreamEvent(EventType type, - SocketStream* socket_stream, + net::SocketStream* socket_stream, int num, const std::string& str, - AuthChallengeInfo* auth_challenge_info, + net::AuthChallengeInfo* auth_challenge_info, int error) : event_type(type), socket(socket_stream), number(num), data(str), auth_info(auth_challenge_info), error_code(error) {} EventType event_type; - SocketStream* socket; + net::SocketStream* socket; int number; std::string data; - scoped_refptr<AuthChallengeInfo> auth_info; + scoped_refptr<net::AuthChallengeInfo> auth_info; int error_code; }; -class SocketStreamEventRecorder : public SocketStream::Delegate { +class SocketStreamEventRecorder : public net::SocketStream::Delegate { public: - explicit SocketStreamEventRecorder(const CompletionCallback& callback) + explicit SocketStreamEventRecorder(const net::CompletionCallback& callback) : callback_(callback) {} virtual ~SocketStreamEventRecorder() {} @@ -84,59 +82,59 @@ class SocketStreamEventRecorder : public SocketStream::Delegate { } virtual int OnStartOpenConnection( - SocketStream* socket, - const CompletionCallback& callback) OVERRIDE { + net::SocketStream* socket, + const net::CompletionCallback& callback) OVERRIDE { connection_callback_ = callback; events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_START_OPEN_CONNECTION, - socket, 0, std::string(), NULL, OK)); + socket, 0, std::string(), NULL, net::OK)); if (!on_start_open_connection_.is_null()) return on_start_open_connection_.Run(&events_.back()); - return OK; + return net::OK; } - virtual void OnConnected(SocketStream* socket, + virtual void OnConnected(net::SocketStream* socket, int num_pending_send_allowed) OVERRIDE { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_CONNECTED, socket, num_pending_send_allowed, std::string(), - NULL, OK)); + NULL, net::OK)); if (!on_connected_.is_null()) on_connected_.Run(&events_.back()); } - virtual void OnSentData(SocketStream* socket, + virtual void OnSentData(net::SocketStream* socket, int amount_sent) OVERRIDE { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_SENT_DATA, socket, - amount_sent, std::string(), NULL, OK)); + amount_sent, std::string(), NULL, net::OK)); if (!on_sent_data_.is_null()) on_sent_data_.Run(&events_.back()); } - virtual void OnReceivedData(SocketStream* socket, + virtual void OnReceivedData(net::SocketStream* socket, const char* data, int len) OVERRIDE { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_RECEIVED_DATA, socket, len, - std::string(data, len), NULL, OK)); + std::string(data, len), NULL, net::OK)); if (!on_received_data_.is_null()) on_received_data_.Run(&events_.back()); } - virtual void OnClose(SocketStream* socket) OVERRIDE { + virtual void OnClose(net::SocketStream* socket) OVERRIDE { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_CLOSE, socket, 0, - std::string(), NULL, OK)); + std::string(), NULL, net::OK)); if (!on_close_.is_null()) on_close_.Run(&events_.back()); if (!callback_.is_null()) - callback_.Run(OK); + callback_.Run(net::OK); } - virtual void OnAuthRequired(SocketStream* socket, - AuthChallengeInfo* auth_info) OVERRIDE { + virtual void OnAuthRequired(net::SocketStream* socket, + net::AuthChallengeInfo* auth_info) OVERRIDE { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_AUTH_REQUIRED, socket, 0, - std::string(), auth_info, OK)); + std::string(), auth_info, net::OK)); if (!on_auth_required_.is_null()) on_auth_required_.Run(&events_.back()); } - virtual void OnError(const SocketStream* socket, int error) OVERRIDE { + virtual void OnError(const net::SocketStream* socket, int error) OVERRIDE { events_.push_back( SocketStreamEvent(SocketStreamEvent::EVENT_ERROR, NULL, 0, std::string(), NULL, error)); @@ -154,7 +152,7 @@ class SocketStreamEventRecorder : public SocketStream::Delegate { << " password=" << credentials_.password(); event->socket->RestartWithAuth(credentials_); } - void SetAuthInfo(const AuthCredentials& credentials) { + void SetAuthInfo(const net::AuthCredentials& credentials) { credentials_ = credentials; } void CompleteConnection(int result) { @@ -174,9 +172,9 @@ class SocketStreamEventRecorder : public SocketStream::Delegate { base::Callback<void(SocketStreamEvent*)> on_close_; base::Callback<void(SocketStreamEvent*)> on_auth_required_; base::Callback<void(SocketStreamEvent*)> on_error_; - const CompletionCallback callback_; - CompletionCallback connection_callback_; - AuthCredentials credentials_; + const net::CompletionCallback callback_; + net::CompletionCallback connection_callback_; + net::AuthCredentials credentials_; DISALLOW_COPY_AND_ASSIGN(SocketStreamEventRecorder); }; @@ -185,7 +183,7 @@ class TestURLRequestContextWithProxy : public TestURLRequestContext { public: explicit TestURLRequestContextWithProxy(const std::string& proxy) : TestURLRequestContext(true) { - context_storage_.set_proxy_service(ProxyService::CreateFixed(proxy)); + context_storage_.set_proxy_service(net::ProxyService::CreateFixed(proxy)); Init(); } virtual ~TestURLRequestContextWithProxy() {} @@ -194,12 +192,12 @@ class TestURLRequestContextWithProxy : public TestURLRequestContext { class TestSocketStreamNetworkDelegate : public TestNetworkDelegate { public: TestSocketStreamNetworkDelegate() - : before_connect_result_(OK) {} + : before_connect_result_(net::OK) {} virtual ~TestSocketStreamNetworkDelegate() {} virtual int OnBeforeSocketStreamConnect( - SocketStream* stream, - const CompletionCallback& callback) OVERRIDE { + net::SocketStream* stream, + const net::CompletionCallback& callback) OVERRIDE { return before_connect_result_; } @@ -213,6 +211,8 @@ class TestSocketStreamNetworkDelegate : public TestNetworkDelegate { } // namespace +namespace net { + class SocketStreamTest : public PlatformTest { public: virtual ~SocketStreamTest() {} @@ -259,12 +259,12 @@ class SocketStreamTest : public PlatformTest { } virtual int DoSwitchToSpdyTest(SocketStreamEvent* event) { - return ERR_PROTOCOL_SWITCHED; + return net::ERR_PROTOCOL_SWITCHED; } virtual int DoIOPending(SocketStreamEvent* event) { - io_test_callback_.callback().Run(OK); - return ERR_IO_PENDING; + io_test_callback_.callback().Run(net::OK); + return net::ERR_IO_PENDING; } static const char kWebSocketHandshakeRequest[]; @@ -359,7 +359,7 @@ TEST_F(SocketStreamTest, CloseFlushPendingWrite) { EXPECT_EQ(SocketStreamEvent::EVENT_SENT_DATA, events[4].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_SENT_DATA, events[5].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[6].event_type); - EXPECT_EQ(ERR_CONNECTION_CLOSED, events[6].error_code); + EXPECT_EQ(net::ERR_CONNECTION_CLOSED, events[6].error_code); EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[7].event_type); } @@ -404,8 +404,8 @@ TEST_F(SocketStreamTest, BasicAuthProxy) { new SocketStreamEventRecorder(test_callback.callback())); delegate->SetOnConnected(base::Bind(&SocketStreamEventRecorder::DoClose, base::Unretained(delegate.get()))); - delegate->SetAuthInfo(AuthCredentials(ASCIIToUTF16("foo"), - ASCIIToUTF16("bar"))); + delegate->SetAuthInfo(net::AuthCredentials(ASCIIToUTF16("foo"), + ASCIIToUTF16("bar"))); delegate->SetOnAuthRequired(base::Bind( &SocketStreamEventRecorder::DoRestartWithAuth, base::Unretained(delegate.get()))); @@ -430,7 +430,7 @@ TEST_F(SocketStreamTest, BasicAuthProxy) { EXPECT_EQ(SocketStreamEvent::EVENT_AUTH_REQUIRED, events[1].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_CONNECTED, events[2].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[3].event_type); - EXPECT_EQ(ERR_ABORTED, events[3].error_code); + EXPECT_EQ(net::ERR_ABORTED, events[3].error_code); EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[4].event_type); // TODO(eroman): Add back NetLogTest here... @@ -488,7 +488,7 @@ TEST_F(SocketStreamTest, BasicAuthProxyWithAuthCache) { EXPECT_EQ(SocketStreamEvent::EVENT_START_OPEN_CONNECTION, events[0].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_CONNECTED, events[1].event_type); - EXPECT_EQ(ERR_ABORTED, events[2].error_code); + EXPECT_EQ(net::ERR_ABORTED, events[2].error_code); EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[3].event_type); } @@ -545,7 +545,7 @@ TEST_F(SocketStreamTest, WSSBasicAuthProxyWithAuthCache) { EXPECT_EQ(SocketStreamEvent::EVENT_START_OPEN_CONNECTION, events[0].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_CONNECTED, events[1].event_type); - EXPECT_EQ(ERR_ABORTED, events[2].error_code); + EXPECT_EQ(net::ERR_ABORTED, events[2].error_code); EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[3].event_type); } @@ -594,11 +594,11 @@ TEST_F(SocketStreamTest, IOPending) { socket_stream->Connect(); io_test_callback_.WaitForResult(); - EXPECT_EQ(SocketStream::STATE_RESOLVE_PROTOCOL_COMPLETE, + EXPECT_EQ(net::SocketStream::STATE_RESOLVE_PROTOCOL_COMPLETE, socket_stream->next_state_); - delegate->CompleteConnection(OK); + delegate->CompleteConnection(net::OK); - EXPECT_EQ(OK, test_callback.WaitForResult()); + EXPECT_EQ(net::OK, test_callback.WaitForResult()); const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents(); ASSERT_EQ(8U, events.size()); @@ -611,7 +611,7 @@ TEST_F(SocketStreamTest, IOPending) { EXPECT_EQ(SocketStreamEvent::EVENT_SENT_DATA, events[4].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_SENT_DATA, events[5].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[6].event_type); - EXPECT_EQ(ERR_CONNECTION_CLOSED, events[6].error_code); + EXPECT_EQ(net::ERR_CONNECTION_CLOSED, events[6].error_code); EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[7].event_type); } @@ -632,7 +632,7 @@ TEST_F(SocketStreamTest, SwitchToSpdy) { socket_stream->Connect(); - EXPECT_EQ(ERR_PROTOCOL_SWITCHED, test_callback.WaitForResult()); + EXPECT_EQ(net::ERR_PROTOCOL_SWITCHED, test_callback.WaitForResult()); const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents(); ASSERT_EQ(2U, events.size()); @@ -640,7 +640,7 @@ TEST_F(SocketStreamTest, SwitchToSpdy) { EXPECT_EQ(SocketStreamEvent::EVENT_START_OPEN_CONNECTION, events[0].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[1].event_type); - EXPECT_EQ(ERR_PROTOCOL_SWITCHED, events[1].error_code); + EXPECT_EQ(net::ERR_PROTOCOL_SWITCHED, events[1].error_code); } TEST_F(SocketStreamTest, SwitchAfterPending) { @@ -660,11 +660,11 @@ TEST_F(SocketStreamTest, SwitchAfterPending) { socket_stream->Connect(); io_test_callback_.WaitForResult(); - EXPECT_EQ(SocketStream::STATE_RESOLVE_PROTOCOL_COMPLETE, + EXPECT_EQ(net::SocketStream::STATE_RESOLVE_PROTOCOL_COMPLETE, socket_stream->next_state_); - delegate->CompleteConnection(ERR_PROTOCOL_SWITCHED); + delegate->CompleteConnection(net::ERR_PROTOCOL_SWITCHED); - EXPECT_EQ(ERR_PROTOCOL_SWITCHED, test_callback.WaitForResult()); + EXPECT_EQ(net::ERR_PROTOCOL_SWITCHED, test_callback.WaitForResult()); const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents(); ASSERT_EQ(2U, events.size()); @@ -672,7 +672,7 @@ TEST_F(SocketStreamTest, SwitchAfterPending) { EXPECT_EQ(SocketStreamEvent::EVENT_START_OPEN_CONNECTION, events[0].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[1].event_type); - EXPECT_EQ(ERR_PROTOCOL_SWITCHED, events[1].error_code); + EXPECT_EQ(net::ERR_PROTOCOL_SWITCHED, events[1].error_code); } // Test a connection though a secure proxy. @@ -722,7 +722,7 @@ TEST_F(SocketStreamTest, SecureProxyConnectError) { EXPECT_EQ(SocketStreamEvent::EVENT_START_OPEN_CONNECTION, events[0].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[1].event_type); - EXPECT_EQ(ERR_SSL_PROTOCOL_ERROR, events[1].error_code); + EXPECT_EQ(net::ERR_SSL_PROTOCOL_ERROR, events[1].error_code); EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[2].event_type); } @@ -774,7 +774,7 @@ TEST_F(SocketStreamTest, SecureProxyConnect) { events[0].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_CONNECTED, events[1].event_type); EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[2].event_type); - EXPECT_EQ(ERR_ABORTED, events[2].error_code); + EXPECT_EQ(net::ERR_ABORTED, events[2].error_code); EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[3].event_type); } @@ -802,7 +802,7 @@ TEST_F(SocketStreamTest, BeforeConnectFailed) { ASSERT_EQ(2U, events.size()); EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[0].event_type); - EXPECT_EQ(ERR_ACCESS_DENIED, events[0].error_code); + EXPECT_EQ(net::ERR_ACCESS_DENIED, events[0].error_code); EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[1].event_type); } diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc index 19c2395..b815a0c 100644 --- a/net/url_request/url_request_job_unittest.cc +++ b/net/url_request/url_request_job_unittest.cc @@ -40,11 +40,11 @@ const MockTransaction kGZip_Transaction = { TEST(URLRequestJob, TransactionNotifiedWhenDone) { MockNetworkLayer network_layer; - net::TestURLRequestContext context; + TestURLRequestContext context; context.set_http_transaction_factory(&network_layer); - net::TestDelegate d; - net::TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context); + TestDelegate d; + TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context); AddMockTransaction(&kGZip_Transaction); req.set_method("GET"); @@ -59,11 +59,11 @@ TEST(URLRequestJob, TransactionNotifiedWhenDone) { TEST(URLRequestJob, SyncTransactionNotifiedWhenDone) { MockNetworkLayer network_layer; - net::TestURLRequestContext context; + TestURLRequestContext context; context.set_http_transaction_factory(&network_layer); - net::TestDelegate d; - net::TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context); + TestDelegate d; + TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context); MockTransaction transaction(kGZip_Transaction); transaction.test_mode = TEST_MODE_SYNC_ALL; AddMockTransaction(&transaction); diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc index 9648b78..34335ae 100644 --- a/net/url_request/url_request_test_util.cc +++ b/net/url_request/url_request_test_util.cc @@ -20,11 +20,9 @@ #include "net/url_request/url_request_job_factory_impl.h" #include "testing/gtest/include/gtest/gtest.h" -namespace net { - namespace { -// These constants put the NetworkDelegate events of TestNetworkDelegate +// These constants put the net::NetworkDelegate events of TestNetworkDelegate // into an order. They are used in conjunction with // |TestNetworkDelegate::next_states_| to check that we do not send // events in the wrong order. @@ -65,34 +63,34 @@ void TestURLRequestContext::Init() { if (!host_resolver()) context_storage_.set_host_resolver( - scoped_ptr<HostResolver>(new MockCachingHostResolver())); + scoped_ptr<net::HostResolver>(new net::MockCachingHostResolver())); if (!proxy_service()) - context_storage_.set_proxy_service(ProxyService::CreateDirect()); + context_storage_.set_proxy_service(net::ProxyService::CreateDirect()); if (!cert_verifier()) - context_storage_.set_cert_verifier(CertVerifier::CreateDefault()); + context_storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); if (!ftp_transaction_factory()) { #if !defined(DISABLE_FTP_SUPPORT) context_storage_.set_ftp_transaction_factory( - new FtpNetworkLayer(host_resolver())); + new net::FtpNetworkLayer(host_resolver())); #else context_storage_.set_ftp_transaction_factory(NULL); #endif // !defined(DISABLE_FTP_SUPPORT) } if (!ssl_config_service()) - context_storage_.set_ssl_config_service(new SSLConfigServiceDefaults); + context_storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); if (!http_auth_handler_factory()) { context_storage_.set_http_auth_handler_factory( - HttpAuthHandlerFactory::CreateDefault(host_resolver())); + net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); } if (!http_server_properties()) { context_storage_.set_http_server_properties( - new HttpServerPropertiesImpl); + new net::HttpServerPropertiesImpl); } if (!transport_security_state()) { context_storage_.set_transport_security_state( - new TransportSecurityState()); + new net::TransportSecurityState()); } - HttpNetworkSession::Params params; + net::HttpNetworkSession::Params params; params.host_resolver = host_resolver(); params.cert_verifier = cert_verifier(); params.proxy_service = proxy_service(); @@ -102,33 +100,33 @@ void TestURLRequestContext::Init() { params.http_server_properties = http_server_properties(); if (!http_transaction_factory()) { - context_storage_.set_http_transaction_factory(new HttpCache( - new HttpNetworkSession(params), - HttpCache::DefaultBackend::InMemory(0))); + context_storage_.set_http_transaction_factory(new net::HttpCache( + new net::HttpNetworkSession(params), + net::HttpCache::DefaultBackend::InMemory(0))); } // In-memory cookie store. if (!cookie_store()) - context_storage_.set_cookie_store(new CookieMonster(NULL, NULL)); + context_storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); // In-memory origin bound cert service. if (!server_bound_cert_service()) { context_storage_.set_server_bound_cert_service( - new ServerBoundCertService( - new DefaultServerBoundCertStore(NULL), + new net::ServerBoundCertService( + new net::DefaultServerBoundCertStore(NULL), base::WorkerPool::GetTaskRunner(true))); } if (!http_user_agent_settings()) { context_storage_.set_http_user_agent_settings( - new StaticHttpUserAgentSettings( + new net::StaticHttpUserAgentSettings( "en-us,fr", "iso-8859-1,*,utf-8", EmptyString())); } if (!job_factory()) - context_storage_.set_job_factory(new URLRequestJobFactoryImpl); + context_storage_.set_job_factory(new net::URLRequestJobFactoryImpl); } TestURLRequest::TestURLRequest(const GURL& url, Delegate* delegate, TestURLRequestContext* context) - : URLRequest(url, delegate, context) { + : net::URLRequest(url, delegate, context) { } TestURLRequest::~TestURLRequest() { @@ -176,12 +174,12 @@ TestDelegate::TestDelegate() have_certificate_errors_(false), certificate_errors_are_fatal_(false), auth_required_(false), - buf_(new IOBuffer(kBufferSize)) { + buf_(new net::IOBuffer(kBufferSize)) { } TestDelegate::~TestDelegate() {} -void TestDelegate::OnReceivedRedirect(URLRequest* request, +void TestDelegate::OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, bool* defer_redirect) { EXPECT_TRUE(request->is_redirecting()); @@ -194,8 +192,8 @@ void TestDelegate::OnReceivedRedirect(URLRequest* request, } } -void TestDelegate::OnAuthRequired(URLRequest* request, - AuthChallengeInfo* auth_info) { +void TestDelegate::OnAuthRequired(net::URLRequest* request, + net::AuthChallengeInfo* auth_info) { auth_required_ = true; if (!credentials_.Empty()) { request->SetAuth(credentials_); @@ -204,8 +202,8 @@ void TestDelegate::OnAuthRequired(URLRequest* request, } } -void TestDelegate::OnSSLCertificateError(URLRequest* request, - const SSLInfo& ssl_info, +void TestDelegate::OnSSLCertificateError(net::URLRequest* request, + const net::SSLInfo& ssl_info, bool fatal) { // The caller can control whether it needs all SSL requests to go through, // independent of any possible errors, or whether it wants SSL errors to @@ -218,7 +216,7 @@ void TestDelegate::OnSSLCertificateError(URLRequest* request, request->Cancel(); } -void TestDelegate::OnResponseStarted(URLRequest* request) { +void TestDelegate::OnResponseStarted(net::URLRequest* request) { // It doesn't make sense for the request to have IO pending at this point. DCHECK(!request->status().is_io_pending()); EXPECT_FALSE(request->is_redirecting()); @@ -228,8 +226,8 @@ void TestDelegate::OnResponseStarted(URLRequest* request) { request->Cancel(); OnResponseCompleted(request); } else if (!request->status().is_success()) { - DCHECK(request->status().status() == URLRequestStatus::FAILED || - request->status().status() == URLRequestStatus::CANCELED); + DCHECK(request->status().status() == net::URLRequestStatus::FAILED || + request->status().status() == net::URLRequestStatus::CANCELED); request_failed_ = true; OnResponseCompleted(request); } else { @@ -242,7 +240,7 @@ void TestDelegate::OnResponseStarted(URLRequest* request) { } } -void TestDelegate::OnReadCompleted(URLRequest* request, int bytes_read) { +void TestDelegate::OnReadCompleted(net::URLRequest* request, int bytes_read) { // It doesn't make sense for the request to have IO pending at this point. DCHECK(!request->status().is_io_pending()); @@ -278,7 +276,7 @@ void TestDelegate::OnReadCompleted(URLRequest* request, int bytes_read) { request->Cancel(); } -void TestDelegate::OnResponseCompleted(URLRequest* request) { +void TestDelegate::OnResponseCompleted(net::URLRequest* request) { if (quit_on_complete_) MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); } @@ -311,8 +309,8 @@ void TestNetworkDelegate::InitRequestStatesIfNew(int request_id) { } int TestNetworkDelegate::OnBeforeURLRequest( - URLRequest* request, - const CompletionCallback& callback, + net::URLRequest* request, + const net::CompletionCallback& callback, GURL* new_url ) { int req_id = request->identifier(); InitRequestStatesIfNew(req_id); @@ -326,13 +324,13 @@ int TestNetworkDelegate::OnBeforeURLRequest( kStageCompletedError | // request canceled by delegate kStageAuthRequired; // Auth can come next for FTP requests created_requests_++; - return OK; + return net::OK; } int TestNetworkDelegate::OnBeforeSendHeaders( - URLRequest* request, - const CompletionCallback& callback, - HttpRequestHeaders* headers) { + net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpRequestHeaders* headers) { int req_id = request->identifier(); InitRequestStatesIfNew(req_id); event_order_[req_id] += "OnBeforeSendHeaders\n"; @@ -342,12 +340,12 @@ int TestNetworkDelegate::OnBeforeSendHeaders( kStageSendHeaders | kStageCompletedError; // request canceled by delegate - return OK; + return net::OK; } void TestNetworkDelegate::OnSendHeaders( - URLRequest* request, - const HttpRequestHeaders& headers) { + net::URLRequest* request, + const net::HttpRequestHeaders& headers) { int req_id = request->identifier(); InitRequestStatesIfNew(req_id); event_order_[req_id] += "OnSendHeaders\n"; @@ -359,10 +357,10 @@ void TestNetworkDelegate::OnSendHeaders( } int TestNetworkDelegate::OnHeadersReceived( - URLRequest* request, - const CompletionCallback& callback, - const HttpResponseHeaders* original_response_headers, - scoped_refptr<HttpResponseHeaders>* override_response_headers) { + net::URLRequest* request, + const net::CompletionCallback& callback, + const net::HttpResponseHeaders* original_response_headers, + scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { int req_id = request->identifier(); event_order_[req_id] += "OnHeadersReceived\n"; InitRequestStatesIfNew(req_id); @@ -378,10 +376,10 @@ int TestNetworkDelegate::OnHeadersReceived( // layer before the URLRequest reports that a response has started. next_states_[req_id] |= kStageBeforeSendHeaders; - return OK; + return net::OK; } -void TestNetworkDelegate::OnBeforeRedirect(URLRequest* request, +void TestNetworkDelegate::OnBeforeRedirect(net::URLRequest* request, const GURL& new_location) { int req_id = request->identifier(); InitRequestStatesIfNew(req_id); @@ -399,24 +397,24 @@ void TestNetworkDelegate::OnBeforeRedirect(URLRequest* request, next_states_[req_id] |= kStageResponseStarted; } -void TestNetworkDelegate::OnResponseStarted(URLRequest* request) { +void TestNetworkDelegate::OnResponseStarted(net::URLRequest* request) { int req_id = request->identifier(); InitRequestStatesIfNew(req_id); event_order_[req_id] += "OnResponseStarted\n"; EXPECT_TRUE(next_states_[req_id] & kStageResponseStarted) << event_order_[req_id]; next_states_[req_id] = kStageCompletedSuccess | kStageCompletedError; - if (request->status().status() == URLRequestStatus::FAILED) { + if (request->status().status() == net::URLRequestStatus::FAILED) { error_count_++; last_error_ = request->status().error(); } } -void TestNetworkDelegate::OnRawBytesRead(const URLRequest& request, +void TestNetworkDelegate::OnRawBytesRead(const net::URLRequest& request, int bytes_read) { } -void TestNetworkDelegate::OnCompleted(URLRequest* request, bool started) { +void TestNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) { int req_id = request->identifier(); InitRequestStatesIfNew(req_id); event_order_[req_id] += "OnCompleted\n"; @@ -431,13 +429,14 @@ void TestNetworkDelegate::OnCompleted(URLRequest* request, bool started) { event_order_[req_id]; next_states_[req_id] = kStageURLRequestDestroyed; completed_requests_++; - if (request->status().status() == URLRequestStatus::FAILED) { + if (request->status().status() == net::URLRequestStatus::FAILED) { error_count_++; last_error_ = request->status().error(); } } -void TestNetworkDelegate::OnURLRequestDestroyed(URLRequest* request) { +void TestNetworkDelegate::OnURLRequestDestroyed( + net::URLRequest* request) { int req_id = request->identifier(); InitRequestStatesIfNew(req_id); event_order_[req_id] += "OnURLRequestDestroyed\n"; @@ -451,11 +450,11 @@ void TestNetworkDelegate::OnPACScriptError(int line_number, const string16& error) { } -NetworkDelegate::AuthRequiredResponse TestNetworkDelegate::OnAuthRequired( - URLRequest* request, - const AuthChallengeInfo& auth_info, +net::NetworkDelegate::AuthRequiredResponse TestNetworkDelegate::OnAuthRequired( + net::URLRequest* request, + const net::AuthChallengeInfo& auth_info, const AuthCallback& callback, - AuthCredentials* credentials) { + net::AuthCredentials* credentials) { int req_id = request->identifier(); InitRequestStatesIfNew(req_id); event_order_[req_id] += "OnAuthRequired\n"; @@ -467,11 +466,11 @@ NetworkDelegate::AuthRequiredResponse TestNetworkDelegate::OnAuthRequired( kStageResponseStarted | // data: URLs do not trigger sending headers kStageBeforeRedirect | // a delegate can trigger a redirection kStageCompletedError; // request cancelled before callback - return NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; + return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; } -bool TestNetworkDelegate::OnCanGetCookies(const URLRequest& request, - const CookieList& cookie_list) { +bool TestNetworkDelegate::OnCanGetCookies(const net::URLRequest& request, + const net::CookieList& cookie_list) { bool allow = true; if (cookie_options_bit_mask_ & NO_GET_COOKIES) allow = false; @@ -483,9 +482,9 @@ bool TestNetworkDelegate::OnCanGetCookies(const URLRequest& request, return allow; } -bool TestNetworkDelegate::OnCanSetCookie(const URLRequest& request, +bool TestNetworkDelegate::OnCanSetCookie(const net::URLRequest& request, const std::string& cookie_line, - CookieOptions* options) { + net::CookieOptions* options) { bool allow = true; if (cookie_options_bit_mask_ & NO_SET_COOKIE) allow = false; @@ -499,24 +498,24 @@ bool TestNetworkDelegate::OnCanSetCookie(const URLRequest& request, return allow; } -bool TestNetworkDelegate::OnCanAccessFile(const URLRequest& request, +bool TestNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, const FilePath& path) const { return true; } bool TestNetworkDelegate::OnCanThrottleRequest( - const URLRequest& request) const { + const net::URLRequest& request) const { return true; } int TestNetworkDelegate::OnBeforeSocketStreamConnect( - SocketStream* socket, - const CompletionCallback& callback) { - return OK; + net::SocketStream* socket, + const net::CompletionCallback& callback) { + return net::OK; } void TestNetworkDelegate::OnRequestWaitStateChange( - const URLRequest& request, + const net::URLRequest& request, RequestWaitState state) { } @@ -543,29 +542,27 @@ const std::string& ScopedCustomUrlRequestTestHttpHost::value() { TestJobInterceptor::TestJobInterceptor() : main_intercept_job_(NULL) { } -URLRequestJob* TestJobInterceptor::MaybeIntercept( - URLRequest* request, - NetworkDelegate* network_delegate) const { - URLRequestJob* job = main_intercept_job_; +net::URLRequestJob* TestJobInterceptor::MaybeIntercept( + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const { + net::URLRequestJob* job = main_intercept_job_; main_intercept_job_ = NULL; return job; } -URLRequestJob* TestJobInterceptor::MaybeInterceptRedirect( +net::URLRequestJob* TestJobInterceptor::MaybeInterceptRedirect( const GURL& location, - URLRequest* request, - NetworkDelegate* network_delegate) const { + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const { return NULL; } -URLRequestJob* TestJobInterceptor::MaybeInterceptResponse( - URLRequest* request, - NetworkDelegate* network_delegate) const { +net::URLRequestJob* TestJobInterceptor::MaybeInterceptResponse( + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const { return NULL; } -void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { +void TestJobInterceptor::set_main_intercept_job(net::URLRequestJob* job) { main_intercept_job_ = job; } - -} // namespace net diff --git a/net/url_request/url_request_test_util.h b/net/url_request/url_request_test_util.h index 323efb2..41be008 100644 --- a/net/url_request/url_request_test_util.h +++ b/net/url_request/url_request_test_util.h @@ -41,11 +41,9 @@ using base::TimeDelta; -namespace net { - //----------------------------------------------------------------------------- -class TestURLRequestContext : public URLRequestContext { +class TestURLRequestContext : public net::URLRequestContext { public: TestURLRequestContext(); // Default constructor like TestURLRequestContext() but does not call @@ -61,14 +59,14 @@ class TestURLRequestContext : public URLRequestContext { bool initialized_; protected: - URLRequestContextStorage context_storage_; + net::URLRequestContextStorage context_storage_; }; //----------------------------------------------------------------------------- // Used to return a dummy context, which lives on the message loop // given in the constructor. -class TestURLRequestContextGetter : public URLRequestContextGetter { +class TestURLRequestContextGetter : public net::URLRequestContextGetter { public: // |network_task_runner| must not be NULL. explicit TestURLRequestContextGetter( @@ -79,7 +77,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter { const scoped_refptr<base::SingleThreadTaskRunner>& network_task_runner, scoped_ptr<TestURLRequestContext> context); - // URLRequestContextGetter implementation. + // net::URLRequestContextGetter implementation. virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE; virtual scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const OVERRIDE; @@ -94,7 +92,7 @@ class TestURLRequestContextGetter : public URLRequestContextGetter { //----------------------------------------------------------------------------- -class TestURLRequest : public URLRequest { +class TestURLRequest : public net::URLRequest { public: TestURLRequest( const GURL& url, Delegate* delegate, TestURLRequestContext* context); @@ -103,7 +101,7 @@ class TestURLRequest : public URLRequest { //----------------------------------------------------------------------------- -class TestDelegate : public URLRequest::Delegate { +class TestDelegate : public net::URLRequest::Delegate { public: TestDelegate(); virtual ~TestDelegate(); @@ -119,7 +117,7 @@ class TestDelegate : public URLRequest::Delegate { void set_allow_certificate_errors(bool val) { allow_certificate_errors_ = val; } - void set_credentials(const AuthCredentials& credentials) { + void set_credentials(const net::AuthCredentials& credentials) { credentials_ = credentials; } @@ -138,25 +136,25 @@ class TestDelegate : public URLRequest::Delegate { } bool auth_required_called() const { return auth_required_; } - // URLRequest::Delegate: - virtual void OnReceivedRedirect(URLRequest* request, const GURL& new_url, + // net::URLRequest::Delegate: + virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, bool* defer_redirect) OVERRIDE; - virtual void OnAuthRequired(URLRequest* request, - AuthChallengeInfo* auth_info) OVERRIDE; + virtual void OnAuthRequired(net::URLRequest* request, + net::AuthChallengeInfo* auth_info) OVERRIDE; // NOTE: |fatal| causes |certificate_errors_are_fatal_| to be set to true. // (Unit tests use this as a post-condition.) But for policy, this method // consults |allow_certificate_errors_|. - virtual void OnSSLCertificateError(URLRequest* request, - const SSLInfo& ssl_info, + virtual void OnSSLCertificateError(net::URLRequest* request, + const net::SSLInfo& ssl_info, bool fatal) OVERRIDE; - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; - virtual void OnReadCompleted(URLRequest* request, + virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; + virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) OVERRIDE; private: static const int kBufferSize = 4096; - virtual void OnResponseCompleted(URLRequest* request); + virtual void OnResponseCompleted(net::URLRequest* request); // options for controlling behavior bool cancel_in_rr_; @@ -166,7 +164,7 @@ class TestDelegate : public URLRequest::Delegate { bool quit_on_complete_; bool quit_on_redirect_; bool allow_certificate_errors_; - AuthCredentials credentials_; + net::AuthCredentials credentials_; // tracks status of callbacks int response_started_count_; @@ -180,12 +178,12 @@ class TestDelegate : public URLRequest::Delegate { std::string data_received_; // our read buffer - scoped_refptr<IOBuffer> buf_; + scoped_refptr<net::IOBuffer> buf_; }; //----------------------------------------------------------------------------- -class TestNetworkDelegate : public NetworkDelegate { +class TestNetworkDelegate : public net::NetworkDelegate { public: enum Options { NO_GET_COOKIES = 1 << 0, @@ -207,47 +205,48 @@ class TestNetworkDelegate : public NetworkDelegate { int set_cookie_count() const { return set_cookie_count_; } protected: - // NetworkDelegate: - virtual int OnBeforeURLRequest(URLRequest* request, - const CompletionCallback& callback, + // net::NetworkDelegate: + virtual int OnBeforeURLRequest(net::URLRequest* request, + const net::CompletionCallback& callback, GURL* new_url) OVERRIDE; - virtual int OnBeforeSendHeaders(URLRequest* request, - const CompletionCallback& callback, - HttpRequestHeaders* headers) OVERRIDE; - virtual void OnSendHeaders(URLRequest* request, - const HttpRequestHeaders& headers) OVERRIDE; + virtual int OnBeforeSendHeaders(net::URLRequest* request, + const net::CompletionCallback& callback, + net::HttpRequestHeaders* headers) OVERRIDE; + virtual void OnSendHeaders(net::URLRequest* request, + const net::HttpRequestHeaders& headers) OVERRIDE; virtual int OnHeadersReceived( - URLRequest* request, - const CompletionCallback& callback, - const HttpResponseHeaders* original_response_headers, - scoped_refptr<HttpResponseHeaders>* override_response_headers) OVERRIDE; - virtual void OnBeforeRedirect(URLRequest* request, + net::URLRequest* request, + const net::CompletionCallback& callback, + const net::HttpResponseHeaders* original_response_headers, + scoped_refptr<net::HttpResponseHeaders>* override_response_headers) + OVERRIDE; + virtual void OnBeforeRedirect(net::URLRequest* request, const GURL& new_location) OVERRIDE; - virtual void OnResponseStarted(URLRequest* request) OVERRIDE; - virtual void OnRawBytesRead(const URLRequest& request, + virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE; + virtual void OnRawBytesRead(const net::URLRequest& request, int bytes_read) OVERRIDE; - virtual void OnCompleted(URLRequest* request, bool started) OVERRIDE; - virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE; + virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE; + virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE; virtual void OnPACScriptError(int line_number, const string16& error) OVERRIDE; - virtual NetworkDelegate::AuthRequiredResponse OnAuthRequired( - URLRequest* request, - const AuthChallengeInfo& auth_info, + virtual net::NetworkDelegate::AuthRequiredResponse OnAuthRequired( + net::URLRequest* request, + const net::AuthChallengeInfo& auth_info, const AuthCallback& callback, - AuthCredentials* credentials) OVERRIDE; - virtual bool OnCanGetCookies(const URLRequest& request, - const CookieList& cookie_list) OVERRIDE; - virtual bool OnCanSetCookie(const URLRequest& request, + net::AuthCredentials* credentials) OVERRIDE; + virtual bool OnCanGetCookies(const net::URLRequest& request, + const net::CookieList& cookie_list) OVERRIDE; + virtual bool OnCanSetCookie(const net::URLRequest& request, const std::string& cookie_line, - CookieOptions* options) OVERRIDE; - virtual bool OnCanAccessFile(const URLRequest& request, + net::CookieOptions* options) OVERRIDE; + virtual bool OnCanAccessFile(const net::URLRequest& request, const FilePath& path) const OVERRIDE; virtual bool OnCanThrottleRequest( - const URLRequest& request) const OVERRIDE; + const net::URLRequest& request) const OVERRIDE; virtual int OnBeforeSocketStreamConnect( - SocketStream* stream, - const CompletionCallback& callback) OVERRIDE; - virtual void OnRequestWaitStateChange(const URLRequest& request, + net::SocketStream* stream, + const net::CompletionCallback& callback) OVERRIDE; + virtual void OnRequestWaitStateChange(const net::URLRequest& request, RequestWaitState state) OVERRIDE; void InitRequestStatesIfNew(int request_id); @@ -262,7 +261,7 @@ class TestNetworkDelegate : public NetworkDelegate { int blocked_set_cookie_count_; int set_cookie_count_; - // NetworkDelegate callbacks happen in a particular order (e.g. + // net::NetworkDelegate callbacks happen in a particular order (e.g. // OnBeforeURLRequest is always called before OnBeforeSendHeaders). // This bit-set indicates for each request id (key) what events may be sent // next. @@ -301,26 +300,24 @@ class ScopedCustomUrlRequestTestHttpHost { //----------------------------------------------------------------------------- // A simple Interceptor that returns a pre-built URLRequestJob only once. -class TestJobInterceptor : public URLRequestJobFactory::Interceptor { +class TestJobInterceptor : public net::URLRequestJobFactory::Interceptor { public: TestJobInterceptor(); - virtual URLRequestJob* MaybeIntercept( - URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE; - virtual URLRequestJob* MaybeInterceptRedirect( + virtual net::URLRequestJob* MaybeIntercept( + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const OVERRIDE; + virtual net::URLRequestJob* MaybeInterceptRedirect( const GURL& location, - URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE; - virtual URLRequestJob* MaybeInterceptResponse( - URLRequest* request, - NetworkDelegate* network_delegate) const OVERRIDE; - void set_main_intercept_job(URLRequestJob* job); + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const OVERRIDE; + virtual net::URLRequestJob* MaybeInterceptResponse( + net::URLRequest* request, + net::NetworkDelegate* network_delegate) const OVERRIDE; + void set_main_intercept_job(net::URLRequestJob* job); private: - mutable URLRequestJob* main_intercept_job_; + mutable net::URLRequestJob* main_intercept_job_; }; -} // namespace net - #endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_ diff --git a/sync/internal_api/http_bridge_unittest.cc b/sync/internal_api/http_bridge_unittest.cc index 5dae475..bd2e0f8 100644 --- a/sync/internal_api/http_bridge_unittest.cc +++ b/sync/internal_api/http_bridge_unittest.cc @@ -48,7 +48,7 @@ class SyncHttpBridgeTest : public testing::Test { HttpBridge* BuildBridge() { if (!fake_default_request_context_getter_) { fake_default_request_context_getter_ = - new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); + new TestURLRequestContextGetter(io_thread_.message_loop_proxy()); fake_default_request_context_getter_->AddRef(); } HttpBridge* bridge = new HttpBridge( @@ -86,7 +86,7 @@ class SyncHttpBridgeTest : public testing::Test { } // Note this is lazy created, so don't call this before your bridge. - net::TestURLRequestContextGetter* GetTestRequestContextGetter() { + TestURLRequestContextGetter* GetTestRequestContextGetter() { return fake_default_request_context_getter_; } @@ -99,7 +99,7 @@ class SyncHttpBridgeTest : public testing::Test { private: // A make-believe "default" request context, as would be returned by // Profile::GetDefaultRequestContext(). Created lazily by BuildBridge. - net::TestURLRequestContextGetter* fake_default_request_context_getter_; + TestURLRequestContextGetter* fake_default_request_context_getter_; HttpBridge* bridge_for_race_test_; @@ -157,7 +157,7 @@ void SyncHttpBridgeTest::RunSyncThreadBridgeUseTest( base::WaitableEvent* signal_when_created, base::WaitableEvent* signal_when_released) { scoped_refptr<net::URLRequestContextGetter> ctx_getter( - new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy())); + new TestURLRequestContextGetter(io_thread_.message_loop_proxy())); { scoped_refptr<ShuntedHttpBridge> bridge(new ShuntedHttpBridge( ctx_getter, this, true)); @@ -187,7 +187,7 @@ TEST_F(SyncHttpBridgeTest, TestUsesSameHttpNetworkSession) { // Test the HttpBridge without actually making any network requests. TEST_F(SyncHttpBridgeTest, TestMakeSynchronousPostShunted) { scoped_refptr<net::URLRequestContextGetter> ctx_getter( - new net::TestURLRequestContextGetter(io_thread()->message_loop_proxy())); + new TestURLRequestContextGetter(io_thread()->message_loop_proxy())); scoped_refptr<HttpBridge> http_bridge(new ShuntedHttpBridge( ctx_getter, this, false)); http_bridge->SetURL("http://www.google.com", 9999); @@ -309,7 +309,7 @@ TEST_F(SyncHttpBridgeTest, TestResponseHeader) { TEST_F(SyncHttpBridgeTest, Abort) { scoped_refptr<net::URLRequestContextGetter> ctx_getter( - new net::TestURLRequestContextGetter(io_thread()->message_loop_proxy())); + new TestURLRequestContextGetter(io_thread()->message_loop_proxy())); scoped_refptr<ShuntedHttpBridge> http_bridge(new ShuntedHttpBridge( ctx_getter, this, true)); http_bridge->SetURL("http://www.google.com", 9999); @@ -328,7 +328,7 @@ TEST_F(SyncHttpBridgeTest, Abort) { TEST_F(SyncHttpBridgeTest, AbortLate) { scoped_refptr<net::URLRequestContextGetter> ctx_getter( - new net::TestURLRequestContextGetter(io_thread()->message_loop_proxy())); + new TestURLRequestContextGetter(io_thread()->message_loop_proxy())); scoped_refptr<ShuntedHttpBridge> http_bridge(new ShuntedHttpBridge( ctx_getter, this, false)); http_bridge->SetURL("http://www.google.com", 9999); diff --git a/sync/notifier/invalidator_factory_unittest.cc b/sync/notifier/invalidator_factory_unittest.cc index 48c4b564c..d552efd 100644 --- a/sync/notifier/invalidator_factory_unittest.cc +++ b/sync/notifier/invalidator_factory_unittest.cc @@ -28,8 +28,7 @@ class InvalidatorFactoryTest : public testing::Test { virtual void SetUp() OVERRIDE { notifier_options_.request_context_getter = - new net::TestURLRequestContextGetter( - message_loop_.message_loop_proxy()); + new TestURLRequestContextGetter(message_loop_.message_loop_proxy()); } virtual void TearDown() OVERRIDE { diff --git a/sync/notifier/non_blocking_invalidator_unittest.cc b/sync/notifier/non_blocking_invalidator_unittest.cc index f2a44abe..73b85bf 100644 --- a/sync/notifier/non_blocking_invalidator_unittest.cc +++ b/sync/notifier/non_blocking_invalidator_unittest.cc @@ -43,7 +43,7 @@ class NonBlockingInvalidatorTestDelegate { options.message_loop_type = MessageLoop::TYPE_IO; io_thread_.StartWithOptions(options); request_context_getter_ = - new net::TestURLRequestContextGetter(io_thread_.message_loop_proxy()); + new TestURLRequestContextGetter(io_thread_.message_loop_proxy()); notifier::NotifierOptions invalidator_options; invalidator_options.request_context_getter = request_context_getter_; invalidator_.reset( diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc index f49e59e..78db3b4 100644 --- a/sync/tools/sync_client.cc +++ b/sync/tools/sync_client.cc @@ -101,7 +101,7 @@ class NullInvalidationStateTracker }; // Needed to use a real host resolver. -class MyTestURLRequestContext : public net::TestURLRequestContext { +class MyTestURLRequestContext : public TestURLRequestContext { public: MyTestURLRequestContext() : TestURLRequestContext(true) { context_storage_.set_host_resolver( @@ -114,13 +114,13 @@ class MyTestURLRequestContext : public net::TestURLRequestContext { virtual ~MyTestURLRequestContext() {} }; -class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { +class MyTestURLRequestContextGetter : public TestURLRequestContextGetter { public: explicit MyTestURLRequestContextGetter( const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) : TestURLRequestContextGetter(io_message_loop_proxy) {} - virtual net::TestURLRequestContext* GetURLRequestContext() OVERRIDE { + virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE { // Construct |context_| lazily so it gets constructed on the right // thread (the IO thread). if (!context_.get()) diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc index bc90088..d8cc213 100644 --- a/sync/tools/sync_listen_notifications.cc +++ b/sync/tools/sync_listen_notifications.cc @@ -114,7 +114,7 @@ class NullInvalidationStateTracker }; // Needed to use a real host resolver. -class MyTestURLRequestContext : public net::TestURLRequestContext { +class MyTestURLRequestContext : public TestURLRequestContext { public: MyTestURLRequestContext() : TestURLRequestContext(true) { context_storage_.set_host_resolver( @@ -127,13 +127,13 @@ class MyTestURLRequestContext : public net::TestURLRequestContext { virtual ~MyTestURLRequestContext() {} }; -class MyTestURLRequestContextGetter : public net::TestURLRequestContextGetter { +class MyTestURLRequestContextGetter : public TestURLRequestContextGetter { public: explicit MyTestURLRequestContextGetter( const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) : TestURLRequestContextGetter(io_message_loop_proxy) {} - virtual net::TestURLRequestContext* GetURLRequestContext() OVERRIDE { + virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE { // Construct |context_| lazily so it gets constructed on the right // thread (the IO thread). if (!context_.get()) diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 3eaed05..51e6331 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -564,7 +564,7 @@ class IOThread : public base::Thread { job_factory_.reset(new net::URLRequestJobFactoryImpl); job_factory_->SetProtocolHandler("http", new MockHttpServerJobFactory); job_factory_->SetProtocolHandler("https", new MockHttpServerJobFactory); - request_context_.reset(new net::TestURLRequestContext()); + request_context_.reset(new TestURLRequestContext()); request_context_->set_job_factory(job_factory_.get()); } diff --git a/webkit/fileapi/file_system_dir_url_request_job_unittest.cc b/webkit/fileapi/file_system_dir_url_request_job_unittest.cc index 0c8b06c..234d88a 100644 --- a/webkit/fileapi/file_system_dir_url_request_job_unittest.cc +++ b/webkit/fileapi/file_system_dir_url_request_job_unittest.cc @@ -82,7 +82,7 @@ class FileSystemDirURLRequestJobTest : public testing::Test { } void TestRequestHelper(const GURL& url, bool run_to_completion) { - delegate_.reset(new net::TestDelegate()); + delegate_.reset(new TestDelegate()); delegate_->set_quit_on_redirect(true); request_.reset(empty_context_.CreateRequest(url, delegate_.get())); job_ = new FileSystemDirURLRequestJob( @@ -214,7 +214,7 @@ class FileSystemDirURLRequestJobTest : public testing::Test { ScopedTempDir temp_dir_; net::URLRequestContext empty_context_; - scoped_ptr<net::TestDelegate> delegate_; + scoped_ptr<TestDelegate> delegate_; scoped_ptr<net::URLRequest> request_; scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy_; scoped_refptr<FileSystemContext> file_system_context_; diff --git a/webkit/fileapi/file_system_url_request_job_unittest.cc b/webkit/fileapi/file_system_url_request_job_unittest.cc index 7297194..2e93374 100644 --- a/webkit/fileapi/file_system_url_request_job_unittest.cc +++ b/webkit/fileapi/file_system_url_request_job_unittest.cc @@ -97,7 +97,7 @@ class FileSystemURLRequestJobTest : public testing::Test { void TestRequestHelper(const GURL& url, const net::HttpRequestHeaders* headers, bool run_to_completion) { - delegate_.reset(new net::TestDelegate()); + delegate_.reset(new TestDelegate()); // Make delegate_ exit the MessageLoop when the request is done. delegate_->set_quit_on_complete(true); delegate_->set_quit_on_redirect(true); @@ -205,7 +205,7 @@ class FileSystemURLRequestJobTest : public testing::Test { net::URLRequestContext empty_context_; // NOTE: order matters, request must die before delegate - scoped_ptr<net::TestDelegate> delegate_; + scoped_ptr<TestDelegate> delegate_; scoped_ptr<net::URLRequest> request_; scoped_refptr<net::URLRequestJob> pending_job_; |