forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland "[Media Session] Fix for Lacros"
This is a reland of ddb531f There is a fix in media_session_service.cc to allow the tests to pass when ash-chrome is not running. Original change's description: > [Media Session] Fix for Lacros > > At the moment in Lacros there are two instances of the > Media Session Service (MSS) one hosted in ash-chrome and > the other in lacros-chrome. This means that sessions in > either browser process cannot see sessions from the other. > > This changes it so when a client asks for lacros-chrome > MSS instead of providing a locally hosted MSS it binds > the MSS in ash-chrome. > > BUG=1140215 > > Change-Id: Ic155a6cd928f0735095f849f309f9075dbb1d36f > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485850 > Reviewed-by: Avi Drissman <avi@chromium.org> > Reviewed-by: Tommy Steimel <steimel@chromium.org> > Reviewed-by: Daniel Cheng <dcheng@chromium.org> > Reviewed-by: Erik Chen <erikchen@chromium.org> > Commit-Queue: Becca Hughes <beccahughes@chromium.org> > Cr-Commit-Position: refs/heads/master@{#825016} Bug: 1140215 Change-Id: I64834d9be778998b42bf3447444a6955265215ef Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2525851 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Tommy Steimel <steimel@chromium.org> Reviewed-by: Erik Chen <erikchen@chromium.org> Reviewed-by: Avi Drissman <avi@chromium.org> Commit-Queue: Becca Hughes <beccahughes@chromium.org> Cr-Commit-Position: refs/heads/master@{#825439}
- Loading branch information
1 parent
52c63a5
commit dde3def
Showing
18 changed files
with
362 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/ui/browser.h" | ||
#include "chrome/test/base/in_process_browser_test.h" | ||
#include "chrome/test/base/ui_test_utils.h" | ||
#include "content/public/browser/media_session.h" | ||
#include "content/public/test/browser_test.h" | ||
#include "services/media_session/public/cpp/test/mock_media_session.h" | ||
|
||
class MediaSessionLacrosBrowserTest : public InProcessBrowserTest { | ||
protected: | ||
MediaSessionLacrosBrowserTest() = default; | ||
|
||
MediaSessionLacrosBrowserTest(const MediaSessionLacrosBrowserTest&) = delete; | ||
MediaSessionLacrosBrowserTest& operator=( | ||
const MediaSessionLacrosBrowserTest&) = delete; | ||
|
||
~MediaSessionLacrosBrowserTest() override = default; | ||
}; | ||
|
||
// This test checks that a Media Session can become active which can only | ||
// happen if the Media Session Service is working correctly. | ||
IN_PROC_BROWSER_TEST_F(MediaSessionLacrosBrowserTest, CheckServiceWorks) { | ||
ASSERT_TRUE(embedded_test_server()->Start()); | ||
|
||
// Navigate to a test page with some media on it. | ||
ui_test_utils::NavigateToURL( | ||
browser(), embedded_test_server()->GetURL("/media/autoplay_iframe.html")); | ||
|
||
auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); | ||
|
||
media_session::test::MockMediaSessionMojoObserver observer( | ||
*content::MediaSession::Get(web_contents)); | ||
|
||
// Start playback. | ||
ASSERT_EQ( | ||
nullptr, | ||
content::EvalJs(web_contents, "document.getElementById('video').play()")); | ||
|
||
// Wait for the session to become active. | ||
observer.WaitForState( | ||
media_session::mojom::MediaSessionInfo::SessionState::kActive); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.