Commit fddbc779 authored by John Mellor's avatar John Mellor Committed by Commit Bot

Revert "Render snippets in ArticleSnippetsTest in isolation"

This reverts commit ab640662.

Reason for revert: ArticleSnippetsTest has failed consistently
on KitKat Tablet Tester since this landed. Specifically the
following tests are failing:
  ArticleSnippetsTest#testDownloadSuggestion__ChromeHomeEnabled
  ArticleSnippetsTest#testSigninPromo__ChromeHomeEnabled
  ArticleSnippetsTest#testSnippetAppearance__ChromeHomeEnabled

Additionally, many other test suites that follow
chrome_public_test_apk started failing when this landed; not
sure if that's related.

Original change's description:
> Render snippets in ArticleSnippetsTest in isolation
> 
> Remove the "snippets" render that shows all cards together, because
> multiple, non-article sections are not realistic in the modern design
> anymore.
> 
> Rebaseline other renders:
> * Use relative timestamp instead of Jan 17, 1970
> * Use only single-card backgrounds for pre-modern cards
> * Update modern card background color after https://crrev.com/497799
> * Update pre-modern text color after https://crrev.com/500684
> 
> Also move card contents in the modern layout except for the rounded
> corners into a RelativeLayout, to avoid a circular dependency between
> the height of the containing layout and the position of the bottom
> corner (see https://developer.android.com/reference/android/widget/RelativeLayout.html).
> 
> Bug: 757735
> Change-Id: I81add3d5bdd8ffec61b9e8aa2ff3a9caa44ccf91
> Reviewed-on: https://chromium-review.googlesource.com/628562
> Commit-Queue: Bernhard Bauer <bauerb@chromium.org>
> Reviewed-by: Sami Kyöstilä <skyostil@chromium.org>
> Reviewed-by: Juan Antonio Navarro Pérez <perezju@chromium.org>
> Reviewed-by: Peter Conn <peconn@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#500975}

TBR=bauerb@chromium.org,skyostil@chromium.org,perezju@chromium.org,peconn@chromium.org

Change-Id: Iedb4e042448a8e4c8090d8af5fbdbb6e2f19a6b7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 757735
Reviewed-on: https://chromium-review.googlesource.com/663382Reviewed-by: default avatarJohn Mellor <johnme@chromium.org>
Commit-Queue: John Mellor <johnme@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501269}
parent d95a5c1b
...@@ -32,7 +32,7 @@ In particular, ~ at the start of a string means it's a regex. ...@@ -32,7 +32,7 @@ In particular, ~ at the start of a string means it's a regex.
--> -->
<Bug pattern="BC_UNCONFIRMED_CAST" /> <Bug pattern="BC_UNCONFIRMED_CAST" />
<!-- Ignore unused public rules and implementations thereof in instrumentation tests --> <!-- Ignore unused public Rule and RuleChain in instrumentation tests -->
<Match> <Match>
<Class name="~.*\.*Test" /> <Class name="~.*\.*Test" />
<Field type="android.support.test.rule.UiThreadTestRule" /> <Field type="android.support.test.rule.UiThreadTestRule" />
...@@ -43,10 +43,5 @@ In particular, ~ at the start of a string means it's a regex. ...@@ -43,10 +43,5 @@ In particular, ~ at the start of a string means it's a regex.
<Field type="org.junit.rules.RuleChain" /> <Field type="org.junit.rules.RuleChain" />
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" /> <Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
</Match> </Match>
<Match>
<Class name="~.*\.*Test" />
<Field type="org.junit.rules.TestRule" />
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD" />
</Match>
</FindBugsFilter> </FindBugsFilter>
...@@ -6,19 +6,12 @@ ...@@ -6,19 +6,12 @@
<RelativeLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:chrome="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
style="@style/SuggestionCardModern" style="@style/SuggestionCardModern"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<!-- This layout is nested inside another layout so that we can align the thumbnail corners
relative to it. The corners are aligned with respect to the whole card, in case the card
contents are taller than the thumbnail. -->
<RelativeLayout
android:id="@+id/card_contents"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.chromium.chrome.browser.widget.TintedImageView <org.chromium.chrome.browser.widget.TintedImageView
android:id="@+id/article_thumbnail" android:id="@+id/article_thumbnail"
android:layout_width="@dimen/snippets_thumbnail_size_large" android:layout_width="@dimen/snippets_thumbnail_size_large"
...@@ -33,19 +26,38 @@ ...@@ -33,19 +26,38 @@
<ImageView <ImageView
android:id="@+id/offline_icon" android:id="@+id/offline_icon"
android:layout_width="@dimen/content_suggestions_card_modern_offline_badge_overlay_size" android:layout_width="@dimen/content_suggestions_card_modern_offline_badge_overlay_size"
android:layout_height= android:layout_height="@dimen/content_suggestions_card_modern_offline_badge_overlay_size"
"@dimen/content_suggestions_card_modern_offline_badge_overlay_size"
android:layout_alignTop="@id/article_thumbnail" android:layout_alignTop="@id/article_thumbnail"
android:layout_alignStart="@id/article_thumbnail" android:layout_alignStart="@id/article_thumbnail"
android:layout_marginStart= android:layout_marginStart="@dimen/content_suggestions_card_modern_offline_badge_overlay_margin_start"
"@dimen/content_suggestions_card_modern_offline_badge_overlay_margin_start" android:layout_marginTop="@dimen/content_suggestions_card_modern_offline_badge_overlay_margin_top"
android:layout_marginTop=
"@dimen/content_suggestions_card_modern_offline_badge_overlay_margin_top"
android:contentDescription="@null" android:contentDescription="@null"
android:visibility="gone" android:visibility="gone"
app:srcCompat="@drawable/ic_offline_pin_white" app:srcCompat="@drawable/ic_offline_pin_white"
tools:src="@drawable/ic_offline_pin_white"/> tools:src="@drawable/ic_offline_pin_white"/>
<!-- It would have been nice to use RoundedBitmapDrawable on the thumbnail, but with that you
cannot select which corners must be rounded, they are all rounded. -->
<ImageView
android:id="@+id/corner_top"
android:layout_width="@dimen/content_suggestions_card_modern_corner_radius"
android:layout_height="@dimen/content_suggestions_card_modern_corner_radius"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:contentDescription="@null"
android:scaleX="@integer/automirror_scale_x"
app:srcCompat="@drawable/content_suggestions_card_corner_top" />
<ImageView
android:id="@+id/corner_bottom"
android:layout_width="@dimen/content_suggestions_card_modern_corner_radius"
android:layout_height="@dimen/content_suggestions_card_modern_corner_radius"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:contentDescription="@null"
android:scaleX="@integer/automirror_scale_x"
app:srcCompat="@drawable/content_suggestions_card_corner_bottom" />
<LinearLayout <LinearLayout
android:id="@+id/text_layout" android:id="@+id/text_layout"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
...@@ -88,8 +100,8 @@ ...@@ -88,8 +100,8 @@
- article_publisher's android:layout_weight="1" - article_publisher's android:layout_weight="1"
- article_publisher's android:ellipsize="end" - article_publisher's android:ellipsize="end"
- article_age's android:layout_width="wrap_content" - article_age's android:layout_width="wrap_content"
All ensure that when the publisher string is long, it starts to ellipsize All ensure that when the publisher string is long, it starts to ellipsize before
before pushing the article age string and the offline icon off the screen. pushing the article age string and the offline icon off the screen.
See: https://crbug.com/625775 and https://crbug.com/678568 --> See: https://crbug.com/625775 and https://crbug.com/678568 -->
<TextView <TextView
android:id="@+id/article_publisher" android:id="@+id/article_publisher"
...@@ -115,28 +127,4 @@ ...@@ -115,28 +127,4 @@
tools:text=" - 3 hours ago" /> tools:text=" - 3 hours ago" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout>
<!-- It would have been nice to use RoundedBitmapDrawable on the thumbnail, but with that you
cannot select which corners must be rounded, they are all rounded. -->
<ImageView
android:id="@+id/corner_top"
android:layout_width="@dimen/content_suggestions_card_modern_corner_radius"
android:layout_height="@dimen/content_suggestions_card_modern_corner_radius"
android:layout_alignTop="@id/card_contents"
android:layout_alignParentStart="true"
android:contentDescription="@null"
android:scaleX="@integer/automirror_scale_x"
app:srcCompat="@drawable/content_suggestions_card_corner_top" />
<ImageView
android:id="@+id/corner_bottom"
android:layout_width="@dimen/content_suggestions_card_modern_corner_radius"
android:layout_height="@dimen/content_suggestions_card_modern_corner_radius"
android:layout_alignBottom="@id/card_contents"
android:layout_alignParentStart="true"
android:contentDescription="@null"
android:scaleX="@integer/automirror_scale_x"
app:srcCompat="@drawable/content_suggestions_card_corner_bottom" />
</RelativeLayout> </RelativeLayout>
...@@ -31,7 +31,6 @@ android_library("chrome_java_test_support") { ...@@ -31,7 +31,6 @@ android_library("chrome_java_test_support") {
"javatests/src/org/chromium/chrome/test/util/ApplicationData.java", "javatests/src/org/chromium/chrome/test/util/ApplicationData.java",
"javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java", "javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java",
"javatests/src/org/chromium/chrome/test/util/BookmarkTestUtil.java", "javatests/src/org/chromium/chrome/test/util/BookmarkTestUtil.java",
"javatests/src/org/chromium/chrome/test/util/browser/compositor/layouts/DisableChromeAnimations.java",
"javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java", "javatests/src/org/chromium/chrome/test/util/browser/contextmenu/ContextMenuUtils.java",
"javatests/src/org/chromium/chrome/test/util/browser/Features.java", "javatests/src/org/chromium/chrome/test/util/browser/Features.java",
"javatests/src/org/chromium/chrome/test/util/browser/LocationSettingsTestUtil.java", "javatests/src/org/chromium/chrome/test/util/browser/LocationSettingsTestUtil.java",
......
// Copyright 2017 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.
package org.chromium.chrome.test.util.browser.compositor.layouts;
import org.junit.rules.ExternalResource;
import org.chromium.chrome.browser.compositor.layouts.ChromeAnimation;
/**
* JUnit 4 rule that disables animations in ChromeAnimation for tests.
*/
public class DisableChromeAnimations extends ExternalResource {
private float mOldAnimationMultiplier;
@Override
protected void before() {
mOldAnimationMultiplier = ChromeAnimation.Animation.getAnimationMultiplier();
ChromeAnimation.Animation.setAnimationMultiplierForTesting(0f);
}
@Override
protected void after() {
ChromeAnimation.Animation.setAnimationMultiplierForTesting(mOldAnimationMultiplier);
}
}
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