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

Side by Side Diff: content/browser/media/session/media_session_impl_service_routing_unittest.cc

Issue 2733843003: Fix a crash when receiving PAUSE action but no service is routed (Closed)
Patch Set: addressed comments Created 3 years, 9 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
« no previous file with comments | « content/browser/media/session/media_session_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/browser/media/session/media_session_impl.h" 5 #include "content/browser/media/session/media_session_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 395 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
396 396
397 services_[sub_frame_]->EnableAction(blink::mojom::MediaSessionAction::PAUSE); 397 services_[sub_frame_]->EnableAction(blink::mojom::MediaSessionAction::PAUSE);
398 398
399 MediaSessionImpl::Get(contents()) 399 MediaSessionImpl::Get(contents())
400 ->DidReceiveAction(blink::mojom::MediaSessionAction::PAUSE); 400 ->DidReceiveAction(blink::mojom::MediaSessionAction::PAUSE);
401 401
402 run_loop.Run(); 402 run_loop.Run();
403 } 403 }
404 404
405 TEST_F(MediaSessionImplServiceRoutingTest,
406 TestReceivingPauseActionWhenNoServiceRouted) {
407 CreateServiceForFrame(main_frame_);
408 CreateServiceForFrame(sub_frame_);
409
410 EXPECT_EQ(nullptr, ComputeServiceForRouting());
411
412 // This should not crash.
413 MediaSessionImpl::Get(contents())
414 ->DidReceiveAction(blink::mojom::MediaSessionAction::PAUSE);
415 }
416
405 } // namespace content 417 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/session/media_session_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698