| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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; | 5 package org.chromium.chrome.browser.ntp; |
| 6 | 6 |
| 7 import android.os.Environment; | |
| 8 import android.test.suitebuilder.annotation.LargeTest; | 7 import android.test.suitebuilder.annotation.LargeTest; |
| 9 import android.test.suitebuilder.annotation.MediumTest; | 8 import android.test.suitebuilder.annotation.MediumTest; |
| 10 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
| 11 import android.view.KeyEvent; | 10 import android.view.KeyEvent; |
| 12 import android.view.View; | 11 import android.view.View; |
| 13 import android.view.ViewGroup; | 12 import android.view.ViewGroup; |
| 14 | 13 |
| 15 import org.chromium.base.ThreadUtils; | 14 import org.chromium.base.ThreadUtils; |
| 16 import org.chromium.base.test.util.CommandLineFlags; | 15 import org.chromium.base.test.util.CommandLineFlags; |
| 17 import org.chromium.base.test.util.DisableIf; | 16 import org.chromium.base.test.util.DisableIf; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 public boolean isSatisfied() { | 91 public boolean isSatisfied() { |
| 93 return recyclerView.computeVerticalScrollOffset() == mFakebox.ge
tTop(); | 92 return recyclerView.computeVerticalScrollOffset() == mFakebox.ge
tTop(); |
| 94 } | 93 } |
| 95 }); | 94 }); |
| 96 | 95 |
| 97 viewRenderer.renderAndCompare(mNtp.getView().getRootView(), "new_tab_pag
e_scrolled"); | 96 viewRenderer.renderAndCompare(mNtp.getView().getRootView(), "new_tab_pag
e_scrolled"); |
| 98 } | 97 } |
| 99 | 98 |
| 100 @Override | 99 @Override |
| 101 protected void setUp() throws Exception { | 100 protected void setUp() throws Exception { |
| 102 mTestServer = EmbeddedTestServer.createAndStartFileServer( | 101 mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation
().getContext()); |
| 103 getInstrumentation().getContext(), Environment.getExternalStorag
eDirectory()); | |
| 104 mFakeMostVisitedUrls = new String[] { mTestServer.getURL(TEST_PAGE) }; | 102 mFakeMostVisitedUrls = new String[] { mTestServer.getURL(TEST_PAGE) }; |
| 105 super.setUp(); | 103 super.setUp(); |
| 106 } | 104 } |
| 107 | 105 |
| 108 @Override | 106 @Override |
| 109 protected void tearDown() throws Exception { | 107 protected void tearDown() throws Exception { |
| 110 mTestServer.stopAndDestroyServer(); | 108 mTestServer.stopAndDestroyServer(); |
| 111 super.tearDown(); | 109 super.tearDown(); |
| 112 } | 110 } |
| 113 | 111 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 private void waitForFakeboxTopPosition(final NewTabPage ntp, int position) | 397 private void waitForFakeboxTopPosition(final NewTabPage ntp, int position) |
| 400 throws InterruptedException { | 398 throws InterruptedException { |
| 401 CriteriaHelper.pollUiThread(Criteria.equals(position, new Callable<Integ
er>() { | 399 CriteriaHelper.pollUiThread(Criteria.equals(position, new Callable<Integ
er>() { |
| 402 @Override | 400 @Override |
| 403 public Integer call() { | 401 public Integer call() { |
| 404 return getFakeboxTop(ntp); | 402 return getFakeboxTop(ntp); |
| 405 } | 403 } |
| 406 })); | 404 })); |
| 407 } | 405 } |
| 408 } | 406 } |
| OLD | NEW |