OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_service_impl.h" | 5 #include "content/browser/media/session/media_session_service_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/browser/media/session/media_session_impl.h" | 9 #include "content/browser/media/session/media_session_impl.h" |
10 #include "content/browser/media/session/media_session_player_observer.h" | 10 #include "content/browser/media/session/media_session_player_observer.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // actions are reset. | 168 // actions are reset. |
169 NavigateToURLAndWaitForFinish(shell(), GetTestUrl(".", "title2.html")); | 169 NavigateToURLAndWaitForFinish(shell(), GetTestUrl(".", "title2.html")); |
170 | 170 |
171 EXPECT_EQ(blink::mojom::MediaSessionPlaybackState::NONE, | 171 EXPECT_EQ(blink::mojom::MediaSessionPlaybackState::NONE, |
172 GetService()->playback_state()); | 172 GetService()->playback_state()); |
173 EXPECT_FALSE(GetService()->metadata().has_value()); | 173 EXPECT_FALSE(GetService()->metadata().has_value()); |
174 EXPECT_EQ(0u, GetService()->actions().size()); | 174 EXPECT_EQ(0u, GetService()->actions().size()); |
175 } | 175 } |
176 | 176 |
177 IN_PROC_BROWSER_TEST_F(MediaSessionServiceImplBrowserTest, | 177 IN_PROC_BROWSER_TEST_F(MediaSessionServiceImplBrowserTest, |
178 DontResetServiceForSamePageNavigation) { | 178 DontResetServiceForSameDocumentNavigation) { |
179 NavigateToURL(shell(), GetTestUrl(".", "title1.html")); | 179 NavigateToURL(shell(), GetTestUrl(".", "title1.html")); |
180 EnsurePlayer(); | 180 EnsurePlayer(); |
181 | 181 |
182 EXPECT_TRUE(ExecuteScriptToSetUpMediaSessionSync()); | 182 EXPECT_TRUE(ExecuteScriptToSetUpMediaSessionSync()); |
183 | 183 |
184 // Start a same-page navigation and check the playback state, metadata, | 184 // Start a fragment navigation and check the playback state, metadata, |
185 // actions are not reset. | 185 // actions are not reset. |
186 GURL same_page_url = GetTestUrl(".", "title1.html"); | 186 GURL fragment_change_url = GetTestUrl(".", "title1.html"); |
187 same_page_url = GURL(same_page_url.spec() + "#some-anchor"); | 187 fragment_change_url = GURL(fragment_change_url.spec() + "#some-anchor"); |
188 NavigateToURLAndWaitForFinish(shell(), same_page_url); | 188 NavigateToURLAndWaitForFinish(shell(), fragment_change_url); |
189 | 189 |
190 EXPECT_EQ(blink::mojom::MediaSessionPlaybackState::PLAYING, | 190 EXPECT_EQ(blink::mojom::MediaSessionPlaybackState::PLAYING, |
191 GetService()->playback_state()); | 191 GetService()->playback_state()); |
192 EXPECT_TRUE(GetService()->metadata().has_value()); | 192 EXPECT_TRUE(GetService()->metadata().has_value()); |
193 EXPECT_EQ(1u, GetService()->actions().size()); | 193 EXPECT_EQ(1u, GetService()->actions().size()); |
194 } | 194 } |
195 | 195 |
196 } // namespace content | 196 } // namespace content |
OLD | NEW |