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

Side by Side Diff: content/browser/media/session/media_session_visibility_browsertest_base.h

Issue 1819113002: [MediaSession, Android] Adding visibility tests for MediaSession (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing tests Created 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_VISIBILITY_BROWSER_TEST_BASE _H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_VISIBILITY_BROWSER_TEST_BASE _H_
7
8 #include "content/public/test/content_browser_test.h"
9
10 namespace base {
11 class CommandLine;
12 class TimeDelta;
13 }
14
15 namespace content {
16
17 class WebContents;
18 class MediaSession;
19
20 // Base class of MediaSession visibility tests. The class is intended
21 // to be used to run tests under different configurations. Tests
22 // should inheret from this class, set up their own command line per
23 // their configuration, and use macro INCLUDE_TEST_FROM_BASE_CLASS to
24 // include required tests. See
25 // media_session_visibility_browsertest_instances.cc for examples.
26 class MediaSessionVisibilityBrowserTestBase
27 : public ContentBrowserTest {
28 public:
29 MediaSessionVisibilityBrowserTestBase() = default;
30
31 void SetUpOnMainThread() override;
32
33 void SetUpCommandLine(base::CommandLine* command_line) override;
34
35 void LoadTestPage();
36
37 void RunScript(std::string script);
38
39 // TODO(zqzhang): This method is shared with
40 // MediaRouterIntegrationTests. Move it into a general place.
41 bool ConditionalWait(base::TimeDelta timeout,
42 base::TimeDelta interval,
43 const base::Callback<bool(void)>& callback);
44
45 // TODO(zqzhang): This method is shared with
46 // MediaRouterIntegrationTests. Move it into a general place.
47 void Wait(base::TimeDelta timeout);
48
49 // Check the MediaSession state.
50 bool IsMediaSessionActive();
51 bool IsMediaSessionSuspended();
52 bool IsMediaSessionInactive();
53
54 // Wait for the MediaSession state to change.
55 bool WaitForMediaSessionActive();
56 bool WaitForMediaSessionSuspended();
57 bool WaitForMediaSessionInactive();
58
59 protected:
60 void TestSessionInactiveWhenHiddenAfterContentPause();
61 void TestSessionInactiveWhenHiddenWhilePlaying();
62 void TestSessionSuspendedWhenHiddenAfterContentPause();
63 void TestSessionActiveWhenHiddenWhilePlaying();
64
65 WebContents* web_contents_;
66 MediaSession* media_session_;
67 };
68
69 } // namespace content
70
71 #define INCLUDE_TEST_FROM_BASE_CLASS(test_fixture, test_name) \
72 IN_PROC_BROWSER_TEST_F(test_fixture, test_name) {\
73 test_name();\
74 }
75
76 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_VISIBILITY_BROWSER_TEST_B ASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698