| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <map> | 5 #include <map> |
| 6 #include <queue> | 6 #include <queue> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 SentMessages::const_iterator sent_end() const { | 152 SentMessages::const_iterator sent_end() const { |
| 153 return sent_messages_.end(); | 153 return sent_messages_.end(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 private: | 156 private: |
| 157 // IPC::Sender | 157 // IPC::Sender |
| 158 virtual bool Send(IPC::Message* message) OVERRIDE { | 158 virtual bool Send(IPC::Message* message) OVERRIDE { |
| 159 EXPECT_EQ(ExtensionMsg_MessageInvoke::ID, message->type()); | 159 EXPECT_EQ(ExtensionMsg_MessageInvoke::ID, message->type()); |
| 160 | 160 |
| 161 EXPECT_FALSE(task_queue_.empty()); | 161 EXPECT_FALSE(task_queue_.empty()); |
| 162 MessageLoop::current()->PostTask(FROM_HERE, task_queue_.front()); | 162 base::MessageLoop::current()->PostTask(FROM_HERE, task_queue_.front()); |
| 163 task_queue_.pop(); | 163 task_queue_.pop(); |
| 164 | 164 |
| 165 sent_messages_.push_back(linked_ptr<IPC::Message>(message)); | 165 sent_messages_.push_back(linked_ptr<IPC::Message>(message)); |
| 166 return true; | 166 return true; |
| 167 } | 167 } |
| 168 | 168 |
| 169 std::queue<base::Closure> task_queue_; | 169 std::queue<base::Closure> task_queue_; |
| 170 SentMessages sent_messages_; | 170 SentMessages sent_messages_; |
| 171 }; | 171 }; |
| 172 | 172 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 193 context_->Init(); | 193 context_->Init(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 // Fires a URLRequest with the specified |method|, |content_type| and three | 196 // Fires a URLRequest with the specified |method|, |content_type| and three |
| 197 // elements of upload data: bytes_1, a dummy empty file, bytes_2. | 197 // elements of upload data: bytes_1, a dummy empty file, bytes_2. |
| 198 void FireURLRequestWithData(const std::string& method, | 198 void FireURLRequestWithData(const std::string& method, |
| 199 const char* content_type, | 199 const char* content_type, |
| 200 const std::vector<char>& bytes_1, | 200 const std::vector<char>& bytes_1, |
| 201 const std::vector<char>& bytes_2); | 201 const std::vector<char>& bytes_2); |
| 202 | 202 |
| 203 MessageLoopForIO message_loop_; | 203 base::MessageLoopForIO message_loop_; |
| 204 content::TestBrowserThread ui_thread_; | 204 content::TestBrowserThread ui_thread_; |
| 205 content::TestBrowserThread io_thread_; | 205 content::TestBrowserThread io_thread_; |
| 206 TestingProfile profile_; | 206 TestingProfile profile_; |
| 207 TestingProfileManager profile_manager_; | 207 TestingProfileManager profile_manager_; |
| 208 net::TestDelegate delegate_; | 208 net::TestDelegate delegate_; |
| 209 BooleanPrefMember enable_referrers_; | 209 BooleanPrefMember enable_referrers_; |
| 210 TestIPCSender ipc_sender_; | 210 TestIPCSender ipc_sender_; |
| 211 scoped_refptr<EventRouterForwarder> event_router_; | 211 scoped_refptr<EventRouterForwarder> event_router_; |
| 212 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 212 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| 213 scoped_ptr<ChromeNetworkDelegate> network_delegate_; | 213 scoped_ptr<ChromeNetworkDelegate> network_delegate_; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 277 |
| 278 // Extension1 response to the redirected URL. Arrives second, and ignored. | 278 // Extension1 response to the redirected URL. Arrives second, and ignored. |
| 279 response = new ExtensionWebRequestEventRouter::EventResponse( | 279 response = new ExtensionWebRequestEventRouter::EventResponse( |
| 280 extension1_id, base::Time::FromDoubleT(1)); | 280 extension1_id, base::Time::FromDoubleT(1)); |
| 281 ipc_sender_.PushTask( | 281 ipc_sender_.PushTask( |
| 282 base::Bind(&EventHandledOnIOThread, | 282 base::Bind(&EventHandledOnIOThread, |
| 283 &profile_, extension1_id, kEventName, kEventName + "/1", | 283 &profile_, extension1_id, kEventName, kEventName + "/1", |
| 284 request.identifier(), response)); | 284 request.identifier(), response)); |
| 285 | 285 |
| 286 request.Start(); | 286 request.Start(); |
| 287 MessageLoop::current()->Run(); | 287 base::MessageLoop::current()->Run(); |
| 288 | 288 |
| 289 EXPECT_TRUE(!request.is_pending()); | 289 EXPECT_TRUE(!request.is_pending()); |
| 290 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status()); | 290 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status()); |
| 291 EXPECT_EQ(0, request.status().error()); | 291 EXPECT_EQ(0, request.status().error()); |
| 292 EXPECT_EQ(redirect_url, request.url()); | 292 EXPECT_EQ(redirect_url, request.url()); |
| 293 EXPECT_EQ(2U, request.url_chain().size()); | 293 EXPECT_EQ(2U, request.url_chain().size()); |
| 294 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); | 294 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); |
| 295 } | 295 } |
| 296 | 296 |
| 297 // Now test the same thing but the extensions answer in reverse order. | 297 // Now test the same thing but the extensions answer in reverse order. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 327 | 327 |
| 328 // Extension1 response to the redirected URL. Arrives second, and ignored. | 328 // Extension1 response to the redirected URL. Arrives second, and ignored. |
| 329 response = new ExtensionWebRequestEventRouter::EventResponse( | 329 response = new ExtensionWebRequestEventRouter::EventResponse( |
| 330 extension1_id, base::Time::FromDoubleT(1)); | 330 extension1_id, base::Time::FromDoubleT(1)); |
| 331 ipc_sender_.PushTask( | 331 ipc_sender_.PushTask( |
| 332 base::Bind(&EventHandledOnIOThread, | 332 base::Bind(&EventHandledOnIOThread, |
| 333 &profile_, extension1_id, kEventName, kEventName + "/1", | 333 &profile_, extension1_id, kEventName, kEventName + "/1", |
| 334 request2.identifier(), response)); | 334 request2.identifier(), response)); |
| 335 | 335 |
| 336 request2.Start(); | 336 request2.Start(); |
| 337 MessageLoop::current()->Run(); | 337 base::MessageLoop::current()->Run(); |
| 338 | 338 |
| 339 EXPECT_TRUE(!request2.is_pending()); | 339 EXPECT_TRUE(!request2.is_pending()); |
| 340 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request2.status().status()); | 340 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request2.status().status()); |
| 341 EXPECT_EQ(0, request2.status().error()); | 341 EXPECT_EQ(0, request2.status().error()); |
| 342 EXPECT_EQ(redirect_url, request2.url()); | 342 EXPECT_EQ(redirect_url, request2.url()); |
| 343 EXPECT_EQ(2U, request2.url_chain().size()); | 343 EXPECT_EQ(2U, request2.url_chain().size()); |
| 344 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); | 344 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); |
| 345 } | 345 } |
| 346 | 346 |
| 347 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 347 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 response = new ExtensionWebRequestEventRouter::EventResponse( | 391 response = new ExtensionWebRequestEventRouter::EventResponse( |
| 392 extension2_id, base::Time::FromDoubleT(2)); | 392 extension2_id, base::Time::FromDoubleT(2)); |
| 393 response->new_url = redirect_url; | 393 response->new_url = redirect_url; |
| 394 ipc_sender_.PushTask( | 394 ipc_sender_.PushTask( |
| 395 base::Bind(&EventHandledOnIOThread, | 395 base::Bind(&EventHandledOnIOThread, |
| 396 &profile_, extension2_id, kEventName, kEventName + "/2", | 396 &profile_, extension2_id, kEventName, kEventName + "/2", |
| 397 request.identifier(), response)); | 397 request.identifier(), response)); |
| 398 | 398 |
| 399 request.Start(); | 399 request.Start(); |
| 400 | 400 |
| 401 MessageLoop::current()->Run(); | 401 base::MessageLoop::current()->Run(); |
| 402 | 402 |
| 403 EXPECT_TRUE(!request.is_pending()); | 403 EXPECT_TRUE(!request.is_pending()); |
| 404 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); | 404 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); |
| 405 EXPECT_EQ(net::ERR_BLOCKED_BY_CLIENT, request.status().error()); | 405 EXPECT_EQ(net::ERR_BLOCKED_BY_CLIENT, request.status().error()); |
| 406 EXPECT_EQ(request_url, request.url()); | 406 EXPECT_EQ(request_url, request.url()); |
| 407 EXPECT_EQ(1U, request.url_chain().size()); | 407 EXPECT_EQ(1U, request.url_chain().size()); |
| 408 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); | 408 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); |
| 409 | 409 |
| 410 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 410 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
| 411 &profile_, extension1_id, kEventName + "/1"); | 411 &profile_, extension1_id, kEventName + "/1"); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 extension_id, base::Time::FromDoubleT(1)); | 445 extension_id, base::Time::FromDoubleT(1)); |
| 446 GURL redirect_url("about:redirected"); | 446 GURL redirect_url("about:redirected"); |
| 447 response->new_url = redirect_url; | 447 response->new_url = redirect_url; |
| 448 ipc_sender_.PushTask( | 448 ipc_sender_.PushTask( |
| 449 base::Bind(&EventHandledOnIOThread, | 449 base::Bind(&EventHandledOnIOThread, |
| 450 &profile_, extension_id, kEventName, kEventName + "/1", | 450 &profile_, extension_id, kEventName, kEventName + "/1", |
| 451 request.identifier(), response)); | 451 request.identifier(), response)); |
| 452 | 452 |
| 453 // Extension response for OnErrorOccurred: Terminate the message loop. | 453 // Extension response for OnErrorOccurred: Terminate the message loop. |
| 454 ipc_sender_.PushTask( | 454 ipc_sender_.PushTask( |
| 455 base::Bind(&MessageLoop::PostTask, | 455 base::Bind(&base::MessageLoop::PostTask, |
| 456 base::Unretained(MessageLoop::current()), | 456 base::Unretained(base::MessageLoop::current()), |
| 457 FROM_HERE, MessageLoop::QuitClosure())); | 457 FROM_HERE, base::MessageLoop::QuitClosure())); |
| 458 | 458 |
| 459 request.Start(); | 459 request.Start(); |
| 460 // request.Start() will have submitted OnBeforeRequest by the time we cancel. | 460 // request.Start() will have submitted OnBeforeRequest by the time we cancel. |
| 461 request.Cancel(); | 461 request.Cancel(); |
| 462 MessageLoop::current()->Run(); | 462 base::MessageLoop::current()->Run(); |
| 463 | 463 |
| 464 EXPECT_TRUE(!request.is_pending()); | 464 EXPECT_TRUE(!request.is_pending()); |
| 465 EXPECT_EQ(net::URLRequestStatus::CANCELED, request.status().status()); | 465 EXPECT_EQ(net::URLRequestStatus::CANCELED, request.status().status()); |
| 466 EXPECT_EQ(net::ERR_ABORTED, request.status().error()); | 466 EXPECT_EQ(net::ERR_ABORTED, request.status().error()); |
| 467 EXPECT_EQ(request_url, request.url()); | 467 EXPECT_EQ(request_url, request.url()); |
| 468 EXPECT_EQ(1U, request.url_chain().size()); | 468 EXPECT_EQ(1U, request.url_chain().size()); |
| 469 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); | 469 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); |
| 470 | 470 |
| 471 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 471 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
| 472 &profile_, extension_id, kEventName + "/1"); | 472 &profile_, extension_id, kEventName + "/1"); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 // Subscribe to OnBeforeRequest with requestBody requirement. | 616 // Subscribe to OnBeforeRequest with requestBody requirement. |
| 617 ASSERT_TRUE(GenerateInfoSpec(string_spec_post, &extra_info_spec_body)); | 617 ASSERT_TRUE(GenerateInfoSpec(string_spec_post, &extra_info_spec_body)); |
| 618 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | 618 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( |
| 619 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", | 619 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", |
| 620 filter, extra_info_spec_body, -1, -1, | 620 filter, extra_info_spec_body, -1, -1, |
| 621 ipc_sender_factory.GetWeakPtr()); | 621 ipc_sender_factory.GetWeakPtr()); |
| 622 | 622 |
| 623 FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2); | 623 FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2); |
| 624 | 624 |
| 625 // We inspect the result in the message list of |ipc_sender_| later. | 625 // We inspect the result in the message list of |ipc_sender_| later. |
| 626 MessageLoop::current()->RunUntilIdle(); | 626 base::MessageLoop::current()->RunUntilIdle(); |
| 627 | 627 |
| 628 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 628 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
| 629 &profile_, extension_id, kEventName + "/1"); | 629 &profile_, extension_id, kEventName + "/1"); |
| 630 | 630 |
| 631 // Part 2. | 631 // Part 2. |
| 632 // Now subscribe to OnBeforeRequest *without* the requestBody requirement. | 632 // Now subscribe to OnBeforeRequest *without* the requestBody requirement. |
| 633 ASSERT_TRUE( | 633 ASSERT_TRUE( |
| 634 GenerateInfoSpec(string_spec_no_post, &extra_info_spec_empty)); | 634 GenerateInfoSpec(string_spec_no_post, &extra_info_spec_empty)); |
| 635 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( | 635 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( |
| 636 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", | 636 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", |
| (...skipping 12 matching lines...) Expand all Loading... |
| 649 ipc_sender_factory.GetWeakPtr()); | 649 ipc_sender_factory.GetWeakPtr()); |
| 650 | 650 |
| 651 // Part 3. | 651 // Part 3. |
| 652 // Now send a POST request with body which is not parseable as a form. | 652 // Now send a POST request with body which is not parseable as a form. |
| 653 FireURLRequestWithData(kMethodPost, NULL /*no header*/, plain_1, plain_2); | 653 FireURLRequestWithData(kMethodPost, NULL /*no header*/, plain_1, plain_2); |
| 654 | 654 |
| 655 // Part 4. | 655 // Part 4. |
| 656 // Now send a PUT request with the same body as above. | 656 // Now send a PUT request with the same body as above. |
| 657 FireURLRequestWithData(kMethodPut, NULL /*no header*/, plain_1, plain_2); | 657 FireURLRequestWithData(kMethodPut, NULL /*no header*/, plain_1, plain_2); |
| 658 | 658 |
| 659 MessageLoop::current()->RunUntilIdle(); | 659 base::MessageLoop::current()->RunUntilIdle(); |
| 660 | 660 |
| 661 // Clean-up. | 661 // Clean-up. |
| 662 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 662 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
| 663 &profile_, extension_id, kEventName + "/1"); | 663 &profile_, extension_id, kEventName + "/1"); |
| 664 | 664 |
| 665 IPC::Message* message = NULL; | 665 IPC::Message* message = NULL; |
| 666 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); | 666 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); |
| 667 for (size_t test = 0; test < arraysize(kExpected); ++test) { | 667 for (size_t test = 0; test < arraysize(kExpected); ++test) { |
| 668 SCOPED_TRACE(testing::Message("iteration number ") << test); | 668 SCOPED_TRACE(testing::Message("iteration number ") << test); |
| 669 EXPECT_NE(i, ipc_sender_.sent_end()); | 669 EXPECT_NE(i, ipc_sender_.sent_end()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 const GURL request_url("http://www.example.com"); | 710 const GURL request_url("http://www.example.com"); |
| 711 | 711 |
| 712 for (size_t i = 0; i < arraysize(kMethods); ++i) { | 712 for (size_t i = 0; i < arraysize(kMethods); ++i) { |
| 713 net::URLRequest request(request_url, &delegate_, context_.get()); | 713 net::URLRequest request(request_url, &delegate_, context_.get()); |
| 714 request.set_method(kMethods[i]); | 714 request.set_method(kMethods[i]); |
| 715 ipc_sender_.PushTask(base::Bind(&base::DoNothing)); | 715 ipc_sender_.PushTask(base::Bind(&base::DoNothing)); |
| 716 request.Start(); | 716 request.Start(); |
| 717 } | 717 } |
| 718 | 718 |
| 719 // We inspect the result in the message list of |ipc_sender_| later. | 719 // We inspect the result in the message list of |ipc_sender_| later. |
| 720 MessageLoop::current()->RunUntilIdle(); | 720 base::MessageLoop::current()->RunUntilIdle(); |
| 721 | 721 |
| 722 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( | 722 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( |
| 723 &profile_, extension_id, kEventName + "/1"); | 723 &profile_, extension_id, kEventName + "/1"); |
| 724 | 724 |
| 725 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); | 725 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); |
| 726 for (size_t test = 0; test < arraysize(kMethods); ++test, ++i) { | 726 for (size_t test = 0; test < arraysize(kMethods); ++test, ++i) { |
| 727 SCOPED_TRACE(testing::Message("iteration number ") << test); | 727 SCOPED_TRACE(testing::Message("iteration number ") << test); |
| 728 EXPECT_NE(i, ipc_sender_.sent_end()); | 728 EXPECT_NE(i, ipc_sender_.sent_end()); |
| 729 IPC::Message* message = i->get(); | 729 IPC::Message* message = i->get(); |
| 730 const DictionaryValue* details = NULL; | 730 const DictionaryValue* details = NULL; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 network_delegate_->set_cookie_settings( | 783 network_delegate_->set_cookie_settings( |
| 784 CookieSettings::Factory::GetForProfile(&profile_)); | 784 CookieSettings::Factory::GetForProfile(&profile_)); |
| 785 context_.reset(new net::TestURLRequestContext(true)); | 785 context_.reset(new net::TestURLRequestContext(true)); |
| 786 host_resolver_.reset(new net::MockHostResolver()); | 786 host_resolver_.reset(new net::MockHostResolver()); |
| 787 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); | 787 host_resolver_->rules()->AddSimulatedFailure("doesnotexist"); |
| 788 context_->set_host_resolver(host_resolver_.get()); | 788 context_->set_host_resolver(host_resolver_.get()); |
| 789 context_->set_network_delegate(network_delegate_.get()); | 789 context_->set_network_delegate(network_delegate_.get()); |
| 790 context_->Init(); | 790 context_->Init(); |
| 791 } | 791 } |
| 792 | 792 |
| 793 MessageLoopForIO message_loop_; | 793 base::MessageLoopForIO message_loop_; |
| 794 content::TestBrowserThread ui_thread_; | 794 content::TestBrowserThread ui_thread_; |
| 795 content::TestBrowserThread io_thread_; | 795 content::TestBrowserThread io_thread_; |
| 796 TestingProfile profile_; | 796 TestingProfile profile_; |
| 797 TestingProfileManager profile_manager_; | 797 TestingProfileManager profile_manager_; |
| 798 net::TestDelegate delegate_; | 798 net::TestDelegate delegate_; |
| 799 BooleanPrefMember enable_referrers_; | 799 BooleanPrefMember enable_referrers_; |
| 800 TestIPCSender ipc_sender_; | 800 TestIPCSender ipc_sender_; |
| 801 scoped_refptr<EventRouterForwarder> event_router_; | 801 scoped_refptr<EventRouterForwarder> event_router_; |
| 802 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 802 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| 803 scoped_ptr<ChromeNetworkDelegate> network_delegate_; | 803 scoped_ptr<ChromeNetworkDelegate> network_delegate_; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 // Don't do anything for the onSendHeaders message. | 881 // Don't do anything for the onSendHeaders message. |
| 882 ipc_sender_.PushTask(base::Bind(&base::DoNothing)); | 882 ipc_sender_.PushTask(base::Bind(&base::DoNothing)); |
| 883 | 883 |
| 884 // Note that we mess up the headers slightly: | 884 // Note that we mess up the headers slightly: |
| 885 // request.Start() will first add additional headers (e.g. the User-Agent) | 885 // request.Start() will first add additional headers (e.g. the User-Agent) |
| 886 // and then send an event to the extension. When we have prepared our | 886 // and then send an event to the extension. When we have prepared our |
| 887 // answers to the onBeforeSendHeaders events above, these headers did not | 887 // answers to the onBeforeSendHeaders events above, these headers did not |
| 888 // exists and are therefore not listed in the responses. This makes | 888 // exists and are therefore not listed in the responses. This makes |
| 889 // them seem deleted. | 889 // them seem deleted. |
| 890 request.Start(); | 890 request.Start(); |
| 891 MessageLoop::current()->Run(); | 891 base::MessageLoop::current()->Run(); |
| 892 | 892 |
| 893 EXPECT_TRUE(!request.is_pending()); | 893 EXPECT_TRUE(!request.is_pending()); |
| 894 // This cannot succeed as we send the request to a server that does not exist. | 894 // This cannot succeed as we send the request to a server that does not exist. |
| 895 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); | 895 EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status()); |
| 896 EXPECT_EQ(request_url, request.url()); | 896 EXPECT_EQ(request_url, request.url()); |
| 897 EXPECT_EQ(1U, request.url_chain().size()); | 897 EXPECT_EQ(1U, request.url_chain().size()); |
| 898 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); | 898 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); |
| 899 | 899 |
| 900 // Calculate the expected headers. | 900 // Calculate the expected headers. |
| 901 net::HttpRequestHeaders expected_headers; | 901 net::HttpRequestHeaders expected_headers; |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 EXPECT_TRUE(credentials_set); | 2134 EXPECT_TRUE(credentials_set); |
| 2135 EXPECT_FALSE(auth3.Empty()); | 2135 EXPECT_FALSE(auth3.Empty()); |
| 2136 EXPECT_EQ(username, auth1.username()); | 2136 EXPECT_EQ(username, auth1.username()); |
| 2137 EXPECT_EQ(password, auth1.password()); | 2137 EXPECT_EQ(password, auth1.password()); |
| 2138 EXPECT_EQ(1u, warning_set.size()); | 2138 EXPECT_EQ(1u, warning_set.size()); |
| 2139 EXPECT_TRUE(HasWarning(warning_set, "extid2")); | 2139 EXPECT_TRUE(HasWarning(warning_set, "extid2")); |
| 2140 EXPECT_EQ(3u, capturing_net_log.GetSize()); | 2140 EXPECT_EQ(3u, capturing_net_log.GetSize()); |
| 2141 } | 2141 } |
| 2142 | 2142 |
| 2143 } // namespace extensions | 2143 } // namespace extensions |
| OLD | NEW |