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

Side by Side Diff: chromecast/browser/cast_media_blocker_browsertest.cc

Issue 2510473002: Reland: [chromecast] Make testnames consistent. (Closed)
Patch Set: rebase Created 4 years, 1 month 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
« no previous file with comments | « chromecast/browser/BUILD.gn ('k') | chromecast/browser/cast_media_blocker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/threading/platform_thread.h" 7 #include "base/threading/platform_thread.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "chromecast/browser/cast_media_blocker.h" 9 #include "chromecast/browser/cast_media_blocker.h"
10 #include "chromecast/browser/test/chromecast_browser_test.h" 10 #include "chromecast/browser/test/cast_browser_test.h"
11 #include "chromecast/chromecast_features.h" 11 #include "chromecast/chromecast_features.h"
12 #include "content/public/browser/media_session.h" 12 #include "content/public/browser/media_session.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
15 #include "media/base/test_data_util.h" 15 #include "media/base/test_data_util.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 #include "url/url_constants.h" 17 #include "url/url_constants.h"
18 18
19 namespace chromecast { 19 namespace chromecast {
20 namespace shell { 20 namespace shell {
21 21
22 class ChromecastShellMediaBlockingBrowserTest : public ChromecastBrowserTest { 22 class CastMediaBlockerBrowserTest : public CastBrowserTest {
23 public: 23 public:
24 ChromecastShellMediaBlockingBrowserTest() {} 24 CastMediaBlockerBrowserTest() {}
25 25
26 protected: 26 protected:
27 // ChromecastBrowserTest implementation. 27 // CastBrowserTest implementation.
28 void TearDownOnMainThread() override { 28 void TearDownOnMainThread() override {
29 blocker_.reset(); 29 blocker_.reset();
30 30
31 ChromecastBrowserTest::TearDownOnMainThread(); 31 CastBrowserTest::TearDownOnMainThread();
32 } 32 }
33 33
34 void PlayMedia(const std::string& tag, const std::string& media_file) { 34 void PlayMedia(const std::string& tag, const std::string& media_file) {
35 base::StringPairs query_params; 35 base::StringPairs query_params;
36 query_params.push_back(std::make_pair(tag, media_file)); 36 query_params.push_back(std::make_pair(tag, media_file));
37 query_params.push_back(std::make_pair("loop", "true")); 37 query_params.push_back(std::make_pair("loop", "true"));
38 38
39 std::string query = media::GetURLQueryString(query_params); 39 std::string query = media::GetURLQueryString(query_params);
40 GURL gurl = content::GetFileUrlWithQuery( 40 GURL gurl = content::GetFileUrlWithQuery(
41 media::GetTestDataFilePath("player.html"), query); 41 media::GetTestDataFilePath("player.html"), query);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 77
78 FAIL() << "Could not successfullly " << (blocked ? "block" : "unblock") 78 FAIL() << "Could not successfullly " << (blocked ? "block" : "unblock")
79 << " media element"; 79 << " media element";
80 } 80 }
81 81
82 private: 82 private:
83 content::WebContents* web_contents_; 83 content::WebContents* web_contents_;
84 std::unique_ptr<CastMediaBlocker> blocker_; 84 std::unique_ptr<CastMediaBlocker> blocker_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(ChromecastShellMediaBlockingBrowserTest); 86 DISALLOW_COPY_AND_ASSIGN(CastMediaBlockerBrowserTest);
87 }; 87 };
88 88
89 IN_PROC_BROWSER_TEST_F(ChromecastShellMediaBlockingBrowserTest, 89 IN_PROC_BROWSER_TEST_F(CastMediaBlockerBrowserTest, Audio_BlockUnblock) {
90 Audio_BlockUnblock) {
91 PlayMedia("audio", "bear-audio-10s-CBR-has-TOC.mp3"); 90 PlayMedia("audio", "bear-audio-10s-CBR-has-TOC.mp3");
92 91
93 BlockAndTestPlayerState("audio", true); 92 BlockAndTestPlayerState("audio", true);
94 BlockAndTestPlayerState("audio", false); 93 BlockAndTestPlayerState("audio", false);
95 } 94 }
96 95
97 #if !BUILDFLAG(IS_CAST_AUDIO_ONLY) 96 #if !BUILDFLAG(IS_CAST_AUDIO_ONLY)
98 IN_PROC_BROWSER_TEST_F(ChromecastShellMediaBlockingBrowserTest, 97 IN_PROC_BROWSER_TEST_F(CastMediaBlockerBrowserTest, Video_BlockUnblock) {
99 Video_BlockUnblock) {
100 PlayMedia("video", "tulip2.webm"); 98 PlayMedia("video", "tulip2.webm");
101 99
102 BlockAndTestPlayerState("video", true); 100 BlockAndTestPlayerState("video", true);
103 BlockAndTestPlayerState("video", false); 101 BlockAndTestPlayerState("video", false);
104 } 102 }
105 #endif 103 #endif
106 104
107 } // namespace shell 105 } // namespace shell
108 } // namespace chromecast 106 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/BUILD.gn ('k') | chromecast/browser/cast_media_blocker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698