Commit 0b0b98fe authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

Revert "Add live details, images, duration fields for episodes."

This reverts commit 0410b740.

Reason for revert: Causing MediaFeedsWebUIBrowserTest.All failures, see https://crbug.com/1072145.

Original change's description:
> Add live details, images, duration fields for episodes.
> 
> Bug: 1065986
> Change-Id: I4d3339006bbea2aaf1a6c9566e34a6faa506b04c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2148247
> Commit-Queue: Sam Bowen <sgbowen@google.com>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Becca Hughes <beccahughes@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#760284}

TBR=dcheng@chromium.org,beccahughes@chromium.org,sgbowen@google.com

Change-Id: I77600047ed412095a253d955770a74e613b4dbb4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1065986, 1072145
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2155621Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760323}
parent 14d89816
...@@ -87,13 +87,6 @@ message Action { ...@@ -87,13 +87,6 @@ message Action {
int64 start_time_secs = 2; int64 start_time_secs = 2;
} }
// Details specific to live content.
// https://wicg.github.io/media-feeds/#media-item-live-metadata
message LiveDetails {
int64 start_time_secs = 1;
int64 end_time_secs = 2;
}
// The content that should be suggested to play next if the user has finished // The content that should be suggested to play next if the user has finished
// watching the current content. // watching the current content.
message PlayNextCandidate { message PlayNextCandidate {
...@@ -112,9 +105,6 @@ message PlayNextCandidate { ...@@ -112,9 +105,6 @@ message PlayNextCandidate {
// The identifiers for the content. We will store up to one of each type. // The identifiers for the content. We will store up to one of each type.
repeated Identifier identifier = 6; repeated Identifier identifier = 6;
// Images for this episode.
repeated Image image = 7;
} }
// https://schema.org/TVEpisode // https://schema.org/TVEpisode
...@@ -128,15 +118,6 @@ message TVEpisode { ...@@ -128,15 +118,6 @@ message TVEpisode {
// The identifiers for the episode. We will store up to one of each type. // The identifiers for the episode. We will store up to one of each type.
repeated Identifier identifier = 4; repeated Identifier identifier = 4;
// The duration of the content in seconds.
int64 duration_secs = 5;
// Images for this episode.
repeated Image image = 6;
// Details specific to live content.
LiveDetails live_details = 7;
} }
// A reference to an image along with the width and height in px. Only stores // A reference to an image along with the width and height in px. Only stores
......
...@@ -185,9 +185,6 @@ struct PlayNextCandidate { ...@@ -185,9 +185,6 @@ struct PlayNextCandidate {
// The identifiers for the content. We will store up to one of each type. // The identifiers for the content. We will store up to one of each type.
array<Identifier> identifiers; array<Identifier> identifiers;
// The images for the episode.
array<media_session.mojom.MediaImage> images;
}; };
// https://schema.org/TVEpisode // https://schema.org/TVEpisode
...@@ -199,23 +196,14 @@ struct TVEpisode { ...@@ -199,23 +196,14 @@ struct TVEpisode {
int64 episode_number; int64 episode_number;
int64 season_number; int64 season_number;
// The duration of the content.
mojo_base.mojom.TimeDelta duration;
// The identifiers for the episode. We will store up to one of each type. // The identifiers for the episode. We will store up to one of each type.
array<Identifier> identifiers; array<Identifier> identifiers;
// Information about a live stream event.
LiveDetails? live;
// The images for the episode.
array<media_session.mojom.MediaImage> images;
}; };
// Details specific to live content. // Details specific to live content.
struct LiveDetails { struct LiveDetails {
// The date/time the feed item became live. // The date/time the feed item became live.
mojo_base.mojom.Time start_time; mojo_base.mojom.Time? start_time;
// The date/time the feed item finished becoming live. // The date/time the feed item finished becoming live.
mojo_base.mojom.Time? end_time; mojo_base.mojom.Time? end_time;
...@@ -270,7 +258,7 @@ struct MediaFeedItem { ...@@ -270,7 +258,7 @@ struct MediaFeedItem {
// The duration of this feed item. // The duration of this feed item.
mojo_base.mojom.TimeDelta? duration; mojo_base.mojom.TimeDelta? duration;
// Information about a live stream event. // Whether the feed item is live.
LiveDetails? live; LiveDetails? live;
// The TV episode data associated with the content. // The TV episode data associated with the content.
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/updateable_sequenced_task_runner.h" #include "base/updateable_sequenced_task_runner.h"
#include "chrome/browser/media/feeds/media_feeds.pb.h" #include "chrome/browser/media/feeds/media_feeds.pb.h"
#include "chrome/browser/media/feeds/media_feeds_store.mojom-forward.h"
#include "chrome/browser/media/feeds/media_feeds_utils.h" #include "chrome/browser/media/feeds/media_feeds_utils.h"
#include "chrome/browser/media/history/media_history_store.h" #include "chrome/browser/media/history/media_history_store.h"
#include "sql/statement.h" #include "sql/statement.h"
...@@ -90,27 +89,6 @@ media_feeds::mojom::ActionPtr Convert(const media_feeds::Action& action) { ...@@ -90,27 +89,6 @@ media_feeds::mojom::ActionPtr Convert(const media_feeds::Action& action) {
return out; return out;
} }
media_feeds::mojom::LiveDetailsPtr Convert(
const media_feeds::LiveDetails& live_details) {
auto out = media_feeds::mojom::LiveDetails::New();
if (live_details.start_time_secs()) {
out->start_time = base::Time::FromDeltaSinceWindowsEpoch(
base::TimeDelta::FromSeconds(live_details.start_time_secs()));
}
if (live_details.end_time_secs()) {
out->end_time = base::Time::FromDeltaSinceWindowsEpoch(
base::TimeDelta::FromSeconds(live_details.end_time_secs()));
}
return out;
}
media_session::MediaImage Convert(const media_feeds::Image& image) {
return media_feeds::ProtoToMediaImage(image);
}
void FillIdentifier(const media_feeds::mojom::IdentifierPtr& identifier, void FillIdentifier(const media_feeds::mojom::IdentifierPtr& identifier,
media_feeds::Identifier* proto) { media_feeds::Identifier* proto) {
switch (identifier->type) { switch (identifier->type) {
...@@ -136,26 +114,6 @@ void FillAction(const media_feeds::mojom::ActionPtr& action, ...@@ -136,26 +114,6 @@ void FillAction(const media_feeds::mojom::ActionPtr& action,
proto->set_start_time_secs(action->start_time->InSeconds()); proto->set_start_time_secs(action->start_time->InSeconds());
} }
void FillLiveDetails(const media_feeds::mojom::LiveDetailsPtr& live_details,
media_feeds::LiveDetails* proto) {
proto->set_start_time_secs(
live_details->start_time.ToDeltaSinceWindowsEpoch().InSeconds());
if (live_details->end_time.has_value())
proto->set_end_time_secs(
live_details->end_time->ToDeltaSinceWindowsEpoch().InSeconds());
}
void FillImage(const media_session::MediaImage& image,
media_feeds::Image* proto) {
proto->set_url(image.src.spec());
if (!image.sizes.empty()) {
proto->set_width(image.sizes[0].width());
proto->set_height(image.sizes[0].height());
}
}
} // namespace } // namespace
const char MediaHistoryFeedItemsTable::kTableName[] = "mediaFeedItem"; const char MediaHistoryFeedItemsTable::kTableName[] = "mediaFeedItem";
...@@ -273,8 +231,12 @@ bool MediaHistoryFeedItemsTable::SaveItem( ...@@ -273,8 +231,12 @@ bool MediaHistoryFeedItemsTable::SaveItem(
statement.BindBool(8, !item->live.is_null()); statement.BindBool(8, !item->live.is_null());
if (!item->live.is_null()) { if (!item->live.is_null()) {
if (item->live->start_time.has_value()) {
statement.BindInt64( statement.BindInt64(
9, item->live->start_time.ToDeltaSinceWindowsEpoch().InSeconds()); 9, item->live->start_time->ToDeltaSinceWindowsEpoch().InSeconds());
} else {
statement.BindNull(9);
}
if (item->live->end_time.has_value()) { if (item->live->end_time.has_value()) {
statement.BindInt64( statement.BindInt64(
...@@ -351,19 +313,10 @@ bool MediaHistoryFeedItemsTable::SaveItem( ...@@ -351,19 +313,10 @@ bool MediaHistoryFeedItemsTable::SaveItem(
tv_episode.set_name(item->tv_episode->name); tv_episode.set_name(item->tv_episode->name);
tv_episode.set_episode_number(item->tv_episode->episode_number); tv_episode.set_episode_number(item->tv_episode->episode_number);
tv_episode.set_season_number(item->tv_episode->season_number); tv_episode.set_season_number(item->tv_episode->season_number);
tv_episode.set_duration_secs(item->tv_episode->duration.InSeconds());
for (auto& identifier : item->tv_episode->identifiers) for (auto& identifier : item->tv_episode->identifiers)
FillIdentifier(identifier, tv_episode.add_identifier()); FillIdentifier(identifier, tv_episode.add_identifier());
for (auto& image : item->tv_episode->images)
media_feeds::MediaImageToProto(tv_episode.add_image(), image);
if (!item->tv_episode->live.is_null()) {
FillLiveDetails(item->tv_episode->live,
tv_episode.mutable_live_details());
}
BindProto(statement, 18, tv_episode); BindProto(statement, 18, tv_episode);
} else { } else {
statement.BindNull(18); statement.BindNull(18);
...@@ -384,9 +337,6 @@ bool MediaHistoryFeedItemsTable::SaveItem( ...@@ -384,9 +337,6 @@ bool MediaHistoryFeedItemsTable::SaveItem(
for (auto& identifier : item->play_next_candidate->identifiers) for (auto& identifier : item->play_next_candidate->identifiers)
FillIdentifier(identifier, play_next_candidate.add_identifier()); FillIdentifier(identifier, play_next_candidate.add_identifier());
for (auto& image : item->play_next_candidate->images)
FillImage(image, play_next_candidate.add_image());
BindProto(statement, 19, play_next_candidate); BindProto(statement, 19, play_next_candidate);
} else { } else {
statement.BindNull(19); statement.BindNull(19);
...@@ -554,17 +504,9 @@ MediaHistoryFeedItemsTable::GetItemsForFeed(const int64_t feed_id) { ...@@ -554,17 +504,9 @@ MediaHistoryFeedItemsTable::GetItemsForFeed(const int64_t feed_id) {
item->tv_episode->name = tv_episode.name(); item->tv_episode->name = tv_episode.name();
item->tv_episode->episode_number = tv_episode.episode_number(); item->tv_episode->episode_number = tv_episode.episode_number();
item->tv_episode->season_number = tv_episode.season_number(); item->tv_episode->season_number = tv_episode.season_number();
item->tv_episode->duration =
base::TimeDelta::FromSeconds(tv_episode.duration_secs());
if (tv_episode.has_live_details())
item->tv_episode->live = Convert(tv_episode.live_details());
for (auto& identifier : tv_episode.identifier()) for (auto& identifier : tv_episode.identifier())
item->tv_episode->identifiers.push_back(Convert(identifier)); item->tv_episode->identifiers.push_back(Convert(identifier));
for (auto& image : tv_episode.image())
item->tv_episode->images.push_back(Convert(image));
} }
if (statement.GetColumnType(18) == sql::ColumnType::kBlob) { if (statement.GetColumnType(18) == sql::ColumnType::kBlob) {
...@@ -589,9 +531,6 @@ MediaHistoryFeedItemsTable::GetItemsForFeed(const int64_t feed_id) { ...@@ -589,9 +531,6 @@ MediaHistoryFeedItemsTable::GetItemsForFeed(const int64_t feed_id) {
for (auto& identifier : play_next_candidate.identifier()) for (auto& identifier : play_next_candidate.identifier())
item->play_next_candidate->identifiers.push_back(Convert(identifier)); item->play_next_candidate->identifiers.push_back(Convert(identifier));
for (auto& image : play_next_candidate.image())
item->play_next_candidate->images.push_back(Convert(image));
} }
if (statement.GetColumnType(19) == sql::ColumnType::kBlob) { if (statement.GetColumnType(19) == sql::ColumnType::kBlob) {
......
...@@ -691,11 +691,6 @@ class MediaHistoryStoreFeedsTest : public MediaHistoryStoreUnitTest { ...@@ -691,11 +691,6 @@ class MediaHistoryStoreFeedsTest : public MediaHistoryStoreUnitTest {
item->tv_episode->episode_number = 2; item->tv_episode->episode_number = 2;
item->tv_episode->identifiers.push_back(CreateIdentifier( item->tv_episode->identifiers.push_back(CreateIdentifier(
media_feeds::mojom::Identifier::Type::kTMSId, "TEST3")); media_feeds::mojom::Identifier::Type::kTMSId, "TEST3"));
item->tv_episode->duration = base::TimeDelta::FromMinutes(40);
item->tv_episode->live = media_feeds::mojom::LiveDetails::New();
item->tv_episode->live->start_time =
base::Time::FromDeltaSinceWindowsEpoch(
base::TimeDelta::FromSeconds(15));
item->play_next_candidate = media_feeds::mojom::PlayNextCandidate::New(); item->play_next_candidate = media_feeds::mojom::PlayNextCandidate::New();
item->play_next_candidate->name = "Next TV Episode Name"; item->play_next_candidate->name = "Next TV Episode Name";
item->play_next_candidate->season_number = 1; item->play_next_candidate->season_number = 1;
...@@ -723,18 +718,6 @@ class MediaHistoryStoreFeedsTest : public MediaHistoryStoreUnitTest { ...@@ -723,18 +718,6 @@ class MediaHistoryStoreFeedsTest : public MediaHistoryStoreUnitTest {
item->images.push_back(image); item->images.push_back(image);
} }
{
media_session::MediaImage image;
image.src = GURL("https://www.example.org/episode-image.png");
item->tv_episode->images.push_back(image);
}
{
media_session::MediaImage image;
image.src = GURL("https://www.example.org/next-image.png");
item->play_next_candidate->images.push_back(image);
}
items.push_back(std::move(item)); items.push_back(std::move(item));
} }
...@@ -759,8 +742,6 @@ class MediaHistoryStoreFeedsTest : public MediaHistoryStoreUnitTest { ...@@ -759,8 +742,6 @@ class MediaHistoryStoreFeedsTest : public MediaHistoryStoreUnitTest {
item->action_status = item->action_status =
media_feeds::mojom::MediaFeedItemActionStatus::kPotential; media_feeds::mojom::MediaFeedItemActionStatus::kPotential;
item->live = media_feeds::mojom::LiveDetails::New(); item->live = media_feeds::mojom::LiveDetails::New();
item->live->start_time = base::Time::FromDeltaSinceWindowsEpoch(
base::TimeDelta::FromSeconds(30));
item->safe_search_result = media_feeds::mojom::SafeSearchResult::kUnsafe; item->safe_search_result = media_feeds::mojom::SafeSearchResult::kUnsafe;
items.push_back(std::move(item)); items.push_back(std::move(item));
} }
......
...@@ -213,20 +213,30 @@ class MediaFeedsTableDelegate { ...@@ -213,20 +213,30 @@ class MediaFeedsTableDelegate {
// Format an array of strings. // Format an array of strings.
td.textContent = data.join(', '); td.textContent = data.join(', ');
} else if (key == 'live') { } else if (key == 'live') {
td.textContent = // Format LiveDetails.
formatLiveDetails(/** @type {mediaFeeds.mojom.LiveDetails} */ (data)); td.textContent = 'Live';
if (data.startTime) {
td.textContent += ' ' +
'StartTime=' +
convertMojoTimeToJS(
/** @type {mojoBase.mojom.Time} */ (data.startTime))
.toLocaleString();
}
if (data.endTime) {
td.textContent += ' ' +
'EndTime=' +
convertMojoTimeToJS(
/** @type {mojoBase.mojom.Time} */ (data.endTime))
.toLocaleString();
}
} else if (key == 'tvEpisode') { } else if (key == 'tvEpisode') {
// Format a TV Episode. // Format a TV Episode.
td.textContent = data.name + ' EpisodeNumber=' + data.episodeNumber + td.textContent = data.name + ' EpisodeNumber=' + data.episodeNumber +
' SeasonNumber=' + data.seasonNumber + ' ' + ' SeasonNumber=' + data.seasonNumber + ' ' +
formatIdentifiers(/** @type {Array<mediaFeeds.mojom.Identifier>} */ ( formatIdentifiers(/** @type {Array<mediaFeeds.mojom.Identifier>} */ (
data.identifiers)) + ' DurationSecs=' + data.identifiers));
timeDeltaToSeconds(data.duration);
if (data.live) {
td.textContent +=
' LiveDetails=' + formatLiveDetails(
/** @type {mediaFeeds.mojom.LiveDetails} */ (data.live));
}
} else if (key == 'playNextCandidate') { } else if (key == 'playNextCandidate') {
// Format a Play Next Candidate. // Format a Play Next Candidate.
td.textContent = data.name + ' EpisodeNumber=' + data.episodeNumber + td.textContent = data.name + ' EpisodeNumber=' + data.episodeNumber +
...@@ -323,33 +333,6 @@ function formatIdentifiers(mojoIdentifiers) { ...@@ -323,33 +333,6 @@ function formatIdentifiers(mojoIdentifiers) {
return identifiers.join(' '); return identifiers.join(' ');
} }
/**
* Formats a LiveDetails struct for display.
* @param {mediaFeeds.mojom.LiveDetails} mojoLiveDetails
* @returns {string}
*/
function formatLiveDetails(mojoLiveDetails) {
let textContent = 'Live';
if (mojoLiveDetails.startTime) {
textContent += ' ' +
'StartTime=' +
convertMojoTimeToJS(
/** @type {mojoBase.mojom.Time} */ (mojoLiveDetails.startTime))
.toLocaleString();
}
if (mojoLiveDetails.endTime) {
textContent += ' ' +
'EndTime=' +
convertMojoTimeToJS(
/** @type {mojoBase.mojom.Time} */ (mojoLiveDetails.endTime))
.toLocaleString();
}
return textContent;
}
/** /**
* Parses utf16 coded string. * Parses utf16 coded string.
* @param {?mojoBase.mojom.String16} arr * @param {?mojoBase.mojom.String16} arr
......
...@@ -77,12 +77,6 @@ MediaFeedsWebUIBrowserTest.prototype = { ...@@ -77,12 +77,6 @@ MediaFeedsWebUIBrowserTest.prototype = {
GEN('item->tv_episode->identifiers.push_back('); GEN('item->tv_episode->identifiers.push_back(');
GEN(' media_feeds::mojom::Identifier::New('); GEN(' media_feeds::mojom::Identifier::New(');
GEN(' media_feeds::mojom::Identifier::Type::kPartnerId, "TEST3"));'); GEN(' media_feeds::mojom::Identifier::Type::kPartnerId, "TEST3"));');
GEN('item->tv_episode->duration =');
GEN(' base::TimeDelta::FromSeconds(20);');
GEN('item->tv_episode->live = media_feeds::mojom::LiveDetails::New();');
GEN('item->tv_episode->live->start_time = ');
GEN(' base::Time::FromDeltaSinceWindowsEpoch(');
GEN(' base::TimeDelta::FromSeconds(30));');
GEN('item->play_next_candidate = '); GEN('item->play_next_candidate = ');
GEN(' media_feeds::mojom::PlayNextCandidate::New();'); GEN(' media_feeds::mojom::PlayNextCandidate::New();');
GEN('item->play_next_candidate->name = "Next TV Episode Name";'); GEN('item->play_next_candidate->name = "Next TV Episode Name";');
...@@ -217,7 +211,7 @@ TEST_F('MediaFeedsWebUIBrowserTest', 'All', function() { ...@@ -217,7 +211,7 @@ TEST_F('MediaFeedsWebUIBrowserTest', 'All', function() {
assertTrue( assertTrue(
feedItemsContents.childNodes[11].textContent.trim().includes('Live')); feedItemsContents.childNodes[11].textContent.trim().includes('Live'));
assertEquals( assertEquals(
'TV Episode Name EpisodeNumber=2 SeasonNumber=1 PartnerId=TEST3 DurationSecs=20 LiveDetails=Live StartTime=12/31/1600, 4:07:32 PM', 'TV Episode Name EpisodeNumber=2 SeasonNumber=1 PartnerId=TEST3',
feedItemsContents.childNodes[12].textContent.trim()); feedItemsContents.childNodes[12].textContent.trim());
assertEquals( assertEquals(
'Next TV Episode Name EpisodeNumber=3 SeasonNumber=1 PartnerId=TEST4 ActionURL=https://www.example.com/ ActionStartTimeSecs=3 DurationSecs=10', 'Next TV Episode Name EpisodeNumber=3 SeasonNumber=1 PartnerId=TEST4 ActionURL=https://www.example.com/ ActionStartTimeSecs=3 DurationSecs=10',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment