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

Unified Diff: chromecast/browser/cast_media_blocker_browsertest.cc

Issue 2502143002: Revert of [chromecast] Make testnames consistent. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/browser/cast_media_blocker_browsertest.cc
diff --git a/chromecast/browser/cast_media_blocker_browsertest.cc b/chromecast/browser/cast_media_blocker_browsertest.cc
deleted file mode 100644
index 94a9ddabc273a96d7cf6073a358be1ba0e3a4fe3..0000000000000000000000000000000000000000
--- a/chromecast/browser/cast_media_blocker_browsertest.cc
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2016 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 "base/macros.h"
-#include "base/run_loop.h"
-#include "base/threading/platform_thread.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "chromecast/browser/cast_media_blocker.h"
-#include "chromecast/browser/test/cast_browser_test.h"
-#include "chromecast/chromecast_features.h"
-#include "content/public/browser/media_session.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/test/browser_test_utils.h"
-#include "media/base/test_data_util.h"
-#include "url/gurl.h"
-#include "url/url_constants.h"
-
-namespace chromecast {
-namespace shell {
-
-class CastMediaBlockerBrowserTest : public CastBrowserTest {
- public:
- CastMediaBlockerBrowserTest() {}
-
- protected:
- // CastBrowserTest implementation.
- void TearDownOnMainThread() override {
- blocker_.reset();
-
- CastBrowserTest::TearDownOnMainThread();
- }
-
- void PlayMedia(const std::string& tag, const std::string& media_file) {
- base::StringPairs query_params;
- query_params.push_back(std::make_pair(tag, media_file));
- query_params.push_back(std::make_pair("loop", "true"));
-
- std::string query = media::GetURLQueryString(query_params);
- GURL gurl = content::GetFileUrlWithQuery(
- media::GetTestDataFilePath("player.html"), query);
-
- web_contents_ = NavigateToURL(gurl);
- WaitForLoadStop(web_contents_);
-
- blocker_ = base::MakeUnique<CastMediaBlocker>(
- content::MediaSession::Get(web_contents_), web_contents_);
- }
-
- void BlockAndTestPlayerState(const std::string& media_type, bool blocked) {
- blocker_->BlockMediaLoading(blocked);
-
- // Changing states is not instant, but should be timely (< 0.5s).
- for (size_t i = 0; i < 5; i++) {
- base::RunLoop run_loop;
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE, run_loop.QuitClosure(),
- base::TimeDelta::FromMilliseconds(50));
- base::MessageLoop::ScopedNestableTaskAllower allow_nested(
- base::MessageLoop::current());
- run_loop.Run();
-
- const std::string command =
- "document.getElementsByTagName(\"" + media_type + "\")[0].paused";
- const std::string js =
- "window.domAutomationController.send(" + command + ");";
-
- bool paused;
- ASSERT_TRUE(ExecuteScriptAndExtractBool(web_contents_, js, &paused));
-
- if (paused == blocked) {
- SUCCEED() << "Media element has been successfullly "
- << (blocked ? "blocked" : "unblocked");
- return;
- }
- }
-
- FAIL() << "Could not successfullly " << (blocked ? "block" : "unblock")
- << " media element";
- }
-
- private:
- content::WebContents* web_contents_;
- std::unique_ptr<CastMediaBlocker> blocker_;
-
- DISALLOW_COPY_AND_ASSIGN(CastMediaBlockerBrowserTest);
-};
-
-IN_PROC_BROWSER_TEST_F(CastMediaBlockerBrowserTest, Audio_BlockUnblock) {
- PlayMedia("audio", "bear-audio-10s-CBR-has-TOC.mp3");
-
- BlockAndTestPlayerState("audio", true);
- BlockAndTestPlayerState("audio", false);
-}
-
-#if !BUILDFLAG(IS_CAST_AUDIO_ONLY)
-IN_PROC_BROWSER_TEST_F(CastMediaBlockerBrowserTest, Video_BlockUnblock) {
- PlayMedia("video", "tulip2.webm");
-
- BlockAndTestPlayerState("video", true);
- BlockAndTestPlayerState("video", false);
-}
-#endif
-
-} // namespace shell
-} // namespace chromecast
« 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