Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 11413050: chrome/browser: Update calls from RunAllPending() to RunUntilIdle(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 601
602 // Part 1. 602 // Part 1.
603 // Subscribe to OnBeforeRequest with requestBody requirement. 603 // Subscribe to OnBeforeRequest with requestBody requirement.
604 ASSERT_TRUE(GenerateInfoSpec(string_spec_post, &extra_info_spec_body)); 604 ASSERT_TRUE(GenerateInfoSpec(string_spec_post, &extra_info_spec_body));
605 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( 605 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
606 &profile_, extension_id, extension_id, kEventName, kEventName + "/1", 606 &profile_, extension_id, extension_id, kEventName, kEventName + "/1",
607 filter, extra_info_spec_body, ipc_sender_factory.GetWeakPtr()); 607 filter, extra_info_spec_body, ipc_sender_factory.GetWeakPtr());
608 608
609 FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2); 609 FireURLRequestWithData(kMethodPost, kMultipart, form_1, form_2);
610 610
611 MessageLoop::current()->RunAllPending(); 611 MessageLoop::current()->RunUntilIdle();
612 // We inspect the result in the message list of |ipc_sender_| later. 612 // We inspect the result in the message list of |ipc_sender_| later.
613 613
614 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( 614 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(
615 &profile_, extension_id, kEventName + "/1"); 615 &profile_, extension_id, kEventName + "/1");
616 } 616 }
617 617
618 { 618 {
619 Feature::ScopedCurrentChannel sc( 619 Feature::ScopedCurrentChannel sc(
620 pass > 0 ? VersionInfo::CHANNEL_STABLE : VersionInfo::CHANNEL_DEV); 620 pass > 0 ? VersionInfo::CHANNEL_STABLE : VersionInfo::CHANNEL_DEV);
621 621
(...skipping 21 matching lines...) Expand all
643 filter, extra_info_spec_body, ipc_sender_factory.GetWeakPtr()); 643 filter, extra_info_spec_body, ipc_sender_factory.GetWeakPtr());
644 644
645 // Part 3. 645 // Part 3.
646 // Now send a POST request with body which is not parseable as a form. 646 // Now send a POST request with body which is not parseable as a form.
647 FireURLRequestWithData(kMethodPost, NULL /*no header*/, plain_1, plain_2); 647 FireURLRequestWithData(kMethodPost, NULL /*no header*/, plain_1, plain_2);
648 648
649 // Part 4. 649 // Part 4.
650 // Now send a PUT request with the same body as above. 650 // Now send a PUT request with the same body as above.
651 FireURLRequestWithData(kMethodPut, NULL /*no header*/, plain_1, plain_2); 651 FireURLRequestWithData(kMethodPut, NULL /*no header*/, plain_1, plain_2);
652 652
653 MessageLoop::current()->RunAllPending(); 653 MessageLoop::current()->RunUntilIdle();
654 654
655 // Clean-up. 655 // Clean-up.
656 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( 656 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(
657 &profile_, extension_id, kEventName + "/1"); 657 &profile_, extension_id, kEventName + "/1");
658 } 658 }
659 } 659 }
660 660
661 IPC::Message* message = NULL; 661 IPC::Message* message = NULL;
662 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin(); 662 TestIPCSender::SentMessages::const_iterator i = ipc_sender_.sent_begin();
663 for (size_t test = 0; test < arraysize(kExpected); ++test) { 663 for (size_t test = 0; test < arraysize(kExpected); ++test) {
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 EXPECT_TRUE(credentials_set); 2081 EXPECT_TRUE(credentials_set);
2082 EXPECT_FALSE(auth3.Empty()); 2082 EXPECT_FALSE(auth3.Empty());
2083 EXPECT_EQ(username, auth1.username()); 2083 EXPECT_EQ(username, auth1.username());
2084 EXPECT_EQ(password, auth1.password()); 2084 EXPECT_EQ(password, auth1.password());
2085 EXPECT_EQ(1u, warning_set.size()); 2085 EXPECT_EQ(1u, warning_set.size());
2086 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2086 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2087 EXPECT_EQ(3u, capturing_net_log.GetSize()); 2087 EXPECT_EQ(3u, capturing_net_log.GetSize());
2088 } 2088 }
2089 2089
2090 } // namespace extensions 2090 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698