| 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 "chromecast/browser/cast_media_blocker.h" | 5 #include "chromecast/browser/cast_media_blocker.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "content/public/browser/media_session.h" | 10 #include "content/public/browser/media_session.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class CastMediaBlockerTest : public content::RenderViewHostTestHarness { | 47 class CastMediaBlockerTest : public content::RenderViewHostTestHarness { |
| 48 public: | 48 public: |
| 49 CastMediaBlockerTest() {} | 49 CastMediaBlockerTest() {} |
| 50 ~CastMediaBlockerTest() override {} | 50 ~CastMediaBlockerTest() override {} |
| 51 | 51 |
| 52 void SetUp() override { | 52 void SetUp() override { |
| 53 initializer_ = base::MakeUnique<content::TestContentClientInitializer>(); | 53 initializer_ = base::MakeUnique<content::TestContentClientInitializer>(); |
| 54 content::RenderViewHostTestHarness::SetUp(); | 54 content::RenderViewHostTestHarness::SetUp(); |
| 55 media_session_ = base::MakeUnique<MockMediaSession>( | 55 media_session_ = base::MakeUnique<MockMediaSession>( |
| 56 content::MediaSession::Get(web_contents())); | 56 content::MediaSession::Get(web_contents())); |
| 57 media_blocker_ = base::MakeUnique<CastMediaBlocker>(media_session_.get(), | 57 media_blocker_ = base::MakeUnique<CastMediaBlocker>(media_session_.get()); |
| 58 web_contents()); | |
| 59 | 58 |
| 60 content::WebContentsTester::For(web_contents()) | 59 content::WebContentsTester::For(web_contents()) |
| 61 ->NavigateAndCommit(GURL("https://www.youtube.com")); | 60 ->NavigateAndCommit(GURL("https://www.youtube.com")); |
| 62 } | 61 } |
| 63 | 62 |
| 64 void TearDown() override { content::RenderViewHostTestHarness::TearDown(); } | 63 void TearDown() override { content::RenderViewHostTestHarness::TearDown(); } |
| 65 | 64 |
| 66 void MediaSessionChanged(bool controllable, bool suspended) { | 65 void MediaSessionChanged(bool controllable, bool suspended) { |
| 67 media_blocker_->MediaSessionStateChanged(controllable, suspended); | 66 media_blocker_->MediaSessionStateChanged(controllable, suspended); |
| 68 } | 67 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // Tests CastMediaBlocker does not resume if unblocked and media is playing. | 271 // Tests CastMediaBlocker does not resume if unblocked and media is playing. |
| 273 EXPECT_CALL(*media_session_, Suspend(_)).Times(1); | 272 EXPECT_CALL(*media_session_, Suspend(_)).Times(1); |
| 274 EXPECT_CALL(*media_session_, Resume(_)).Times(0); | 273 EXPECT_CALL(*media_session_, Resume(_)).Times(0); |
| 275 MediaSessionChanged(true, false); | 274 MediaSessionChanged(true, false); |
| 276 media_blocker_->BlockMediaLoading(true); | 275 media_blocker_->BlockMediaLoading(true); |
| 277 media_blocker_->BlockMediaLoading(false); | 276 media_blocker_->BlockMediaLoading(false); |
| 278 } | 277 } |
| 279 | 278 |
| 280 } // namespace shell | 279 } // namespace shell |
| 281 } // namespace chromecast | 280 } // namespace chromecast |
| OLD | NEW |