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

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

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: h264_vt_encoder_unittest.cc Created 4 years, 5 months 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <queue> 10 #include <queue>
11 #include <tuple> 11 #include <tuple>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h"
14 #include "base/callback.h" 15 #include "base/callback.h"
15 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
16 #include "base/json/json_reader.h" 17 #include "base/json/json_reader.h"
17 #include "base/json/json_string_value_serializer.h" 18 #include "base/json/json_string_value_serializer.h"
18 #include "base/location.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/run_loop.h" 22 #include "base/run_loop.h"
23 #include "base/single_thread_task_runner.h"
24 #include "base/stl_util.h" 23 #include "base/stl_util.h"
25 #include "base/strings/string_piece.h" 24 #include "base/strings/string_piece.h"
26 #include "base/strings/string_split.h" 25 #include "base/strings/string_split.h"
27 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
28 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
29 #include "base/threading/thread_task_runner_handle.h" 28 #include "base/threading/thread_task_runner_handle.h"
30 #include "base/time/time.h" 29 #include "base/time/time.h"
31 #include "chrome/browser/content_settings/cookie_settings_factory.h" 30 #include "chrome/browser/content_settings/cookie_settings_factory.h"
32 #include "chrome/browser/extensions/event_router_forwarder.h" 31 #include "chrome/browser/extensions/event_router_forwarder.h"
33 #include "chrome/browser/net/chrome_network_delegate.h" 32 #include "chrome/browser/net/chrome_network_delegate.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // processed because request is canceled before the handler responds. 456 // processed because request is canceled before the handler responds.
458 response = new ExtensionWebRequestEventRouter::EventResponse( 457 response = new ExtensionWebRequestEventRouter::EventResponse(
459 extension_id, base::Time::FromDoubleT(1)); 458 extension_id, base::Time::FromDoubleT(1));
460 GURL redirect_url("about:redirected"); 459 GURL redirect_url("about:redirected");
461 response->new_url = redirect_url; 460 response->new_url = redirect_url;
462 ipc_sender_.PushTask( 461 ipc_sender_.PushTask(
463 base::Bind(&EventHandledOnIOThread, 462 base::Bind(&EventHandledOnIOThread,
464 &profile_, extension_id, kEventName, kEventName + "/1", 463 &profile_, extension_id, kEventName, kEventName + "/1",
465 request->identifier(), response)); 464 request->identifier(), response));
466 465
466 base::RunLoop run_loop;
467
467 // Extension response for OnErrorOccurred: Terminate the message loop. 468 // Extension response for OnErrorOccurred: Terminate the message loop.
468 ipc_sender_.PushTask( 469 ipc_sender_.PushTask(
469 base::Bind(&base::MessageLoop::PostTask, 470 base::Bind(base::IgnoreResult(&base::SingleThreadTaskRunner::PostTask),
470 base::Unretained(base::MessageLoop::current()), FROM_HERE, 471 base::ThreadTaskRunnerHandle::Get(), FROM_HERE,
471 base::MessageLoop::QuitWhenIdleClosure())); 472 run_loop.QuitWhenIdleClosure()));
472 473
473 request->Start(); 474 request->Start();
474 // request->Start() will have submitted OnBeforeRequest by the time we cancel. 475 // request->Start() will have submitted OnBeforeRequest by the time we cancel.
475 request->Cancel(); 476 request->Cancel();
476 base::RunLoop().Run(); 477 run_loop.Run();
477 478
478 EXPECT_TRUE(!request->is_pending()); 479 EXPECT_TRUE(!request->is_pending());
479 EXPECT_EQ(net::URLRequestStatus::CANCELED, request->status().status()); 480 EXPECT_EQ(net::URLRequestStatus::CANCELED, request->status().status());
480 EXPECT_EQ(net::ERR_ABORTED, request->status().error()); 481 EXPECT_EQ(net::ERR_ABORTED, request->status().error());
481 EXPECT_EQ(request_url, request->url()); 482 EXPECT_EQ(request_url, request->url());
482 EXPECT_EQ(1U, request->url_chain().size()); 483 EXPECT_EQ(1U, request->url_chain().size());
483 EXPECT_EQ(0U, ipc_sender_.GetNumTasks()); 484 EXPECT_EQ(0U, ipc_sender_.GetNumTasks());
484 485
485 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener( 486 ExtensionWebRequestEventRouter::GetInstance()->RemoveEventListener(
486 &profile_, extension_id, kEventName + "/1", 0, 0); 487 &profile_, extension_id, kEventName + "/1", 0, 0);
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 EXPECT_TRUE(credentials_set); 2347 EXPECT_TRUE(credentials_set);
2347 EXPECT_FALSE(auth3.Empty()); 2348 EXPECT_FALSE(auth3.Empty());
2348 EXPECT_EQ(username, auth1.username()); 2349 EXPECT_EQ(username, auth1.username());
2349 EXPECT_EQ(password, auth1.password()); 2350 EXPECT_EQ(password, auth1.password());
2350 EXPECT_EQ(1u, warning_set.size()); 2351 EXPECT_EQ(1u, warning_set.size());
2351 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2352 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2352 EXPECT_EQ(3u, capturing_net_log.GetSize()); 2353 EXPECT_EQ(3u, capturing_net_log.GetSize());
2353 } 2354 }
2354 2355
2355 } // namespace extensions 2356 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/devtools/device/port_forwarding_browsertest.cc ('k') | chrome/browser/ui/cocoa/app_menu/app_menu_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698