OLD | NEW |
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 Loading... |
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 |
OLD | NEW |