Skip to content

Instantly share code, notes, and snippets.

@domfarolino
Created January 23, 2020 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domfarolino/c8293bb5437b2ba16a5b8f34796b6bba to your computer and use it in GitHub Desktop.
Save domfarolino/c8293bb5437b2ba16a5b8f34796b6bba to your computer and use it in GitHub Desktop.
diff --git a/third_party/blink/common/loader/throttling_url_loader_unittest.cc b/third_party/blink/common/loader/throttling_url_loader_unittest.cc
index 592695073167..0d0d7b0ea2da 100644
--- a/third_party/blink/common/loader/throttling_url_loader_unittest.cc
+++ b/third_party/blink/common/loader/throttling_url_loader_unittest.cc
@@ -513,10 +513,12 @@ TEST_F(ThrottlingURLLoaderTest, ModifyURLAndDeferRedirect) {
throttle_->set_will_start_request_callback(
base::BindRepeating([](blink::URLLoaderThrottle::Delegate* /* delegate */,
bool* defer) { *defer = true; }));
+ base::RunLoop run_loop;
+ auto quit_closure = run_loop.QuitClosure();
throttle_->set_will_redirect_request_callback(base::BindLambdaForTesting(
- [](blink::URLLoaderThrottle::Delegate* /* delegate */, bool* defer,
+ [quit_closure](blink::URLLoaderThrottle::Delegate* /* delegate */, bool* defer,
std::vector<std::string>* /* removed_headers */,
- net::HttpRequestHeaders* /* modified_headers */) { *defer = true; }));
+ net::HttpRequestHeaders* /* modified_headers */) { *defer = true; quit_closure.Run(); }));
CreateLoaderAndStart();
@@ -524,6 +526,7 @@ TEST_F(ThrottlingURLLoaderTest, ModifyURLAndDeferRedirect) {
EXPECT_EQ(0u, throttle_->will_redirect_request_called());
throttle_->delegate()->Resume();
+ run_loop.Run();
EXPECT_EQ(1u, throttle_->will_start_request_called());
EXPECT_EQ(1u, throttle_->will_redirect_request_called());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment