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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/ntp/snippets/ArticleSnippetsTest.java

Issue 2274293002: 📰 Keep Suggestion sections in declaration order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix render test Created 4 years, 3 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
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 package org.chromium.chrome.browser.ntp.snippets; 5 package org.chromium.chrome.browser.ntp.snippets;
6 6
7 import android.graphics.BitmapFactory; 7 import android.graphics.BitmapFactory;
8 import android.test.suitebuilder.annotation.MediumTest; 8 import android.test.suitebuilder.annotation.MediumTest;
9 import android.util.TypedValue; 9 import android.util.TypedValue;
10 import android.view.ContextMenu; 10 import android.view.ContextMenu;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 public ArticleSnippetsTest() { 54 public ArticleSnippetsTest() {
55 super(ChromeActivity.class); 55 super(ChromeActivity.class);
56 } 56 }
57 57
58 @MediumTest 58 @MediumTest
59 @Feature({"ArticleSnippets", "RenderTest"}) 59 @Feature({"ArticleSnippets", "RenderTest"})
60 public void testSnippetAppearance() throws IOException { 60 public void testSnippetAppearance() throws IOException {
61 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 61 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
62 @Override 62 @Override
63 public void run() { 63 public void run() {
64 setupTestData();
65
64 mContentView = new FrameLayout(getActivity()); 66 mContentView = new FrameLayout(getActivity());
65 mUiConfig = new UiConfig(mContentView); 67 mUiConfig = new UiConfig(mContentView);
66 68
67 getActivity().setContentView(mContentView); 69 getActivity().setContentView(mContentView);
68 70
69 mRecyclerView = (NewTabPageRecyclerView) getActivity().getLayout Inflater() 71 mRecyclerView = (NewTabPageRecyclerView) getActivity().getLayout Inflater()
70 .inflate(R.layout.new_tab_page_recycler_view, mContentVi ew, false); 72 .inflate(R.layout.new_tab_page_recycler_view, mContentVi ew, false);
71 mContentView.addView(mRecyclerView); 73 mContentView.addView(mRecyclerView);
72 74
73 View aboveTheFold = new View(getActivity()); 75 View aboveTheFold = new View(getActivity());
74 76
75
76 mRecyclerView.setAboveTheFoldView(aboveTheFold); 77 mRecyclerView.setAboveTheFoldView(aboveTheFold);
77 mAdapter = new NewTabPageAdapter(mNtpManager, aboveTheFold, mSni ppetsSource, 78 mAdapter = new NewTabPageAdapter(mNtpManager, aboveTheFold, mSni ppetsSource,
78 mUiConfig); 79 mUiConfig);
79 mRecyclerView.setAdapter(mAdapter); 80 mRecyclerView.setAdapter(mAdapter);
80
81 setupTestData();
82 } 81 }
83 }); 82 });
84 83
85 getInstrumentation().waitForIdleSync(); 84 getInstrumentation().waitForIdleSync();
86 85
87 int first = mAdapter.getFirstCardPosition(); 86 int first = mAdapter.getFirstCardPosition();
88 mViewRenderer.renderAndCompare(mRecyclerView.getChildAt(first), "short_s nippet"); 87 mViewRenderer.renderAndCompare(mRecyclerView.getChildAt(first), "short_s nippet");
89 mViewRenderer.renderAndCompare(mRecyclerView.getChildAt(first + 1), "lon g_snippet"); 88 mViewRenderer.renderAndCompare(mRecyclerView.getChildAt(first + 1), "lon g_snippet");
90 mViewRenderer.renderAndCompare(mRecyclerView.getChildAt(first + 2), "min imal_snippet"); 89 mViewRenderer.renderAndCompare(mRecyclerView.getChildAt(first + 2), "min imal_snippet");
91 mViewRenderer.renderAndCompare(mRecyclerView, "snippets"); 90 mViewRenderer.renderAndCompare(mRecyclerView, "snippets");
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 public void addContextMenuCloseCallback(Callback<Menu> callback) { 327 public void addContextMenuCloseCallback(Callback<Menu> callback) {
329 throw new UnsupportedOperationException(); 328 throw new UnsupportedOperationException();
330 } 329 }
331 330
332 @Override 331 @Override
333 public void removeContextMenuCloseCallback(Callback<Menu> callback) { 332 public void removeContextMenuCloseCallback(Callback<Menu> callback) {
334 throw new UnsupportedOperationException(); 333 throw new UnsupportedOperationException();
335 } 334 }
336 } 335 }
337 } 336 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698