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.graphics.Canvas; | 7 import android.graphics.Canvas; |
8 import android.support.test.InstrumentationRegistry; | 8 import android.support.test.InstrumentationRegistry; |
9 import android.support.test.filters.LargeTest; | 9 import android.support.test.filters.LargeTest; |
10 import android.support.test.filters.MediumTest; | 10 import android.support.test.filters.MediumTest; |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 webServer.shutdown(); | 383 webServer.shutdown(); |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 /** | 387 /** |
388 * Tests setting whether the search provider has a logo. | 388 * Tests setting whether the search provider has a logo. |
389 */ | 389 */ |
390 @Test | 390 @Test |
391 @SmallTest | 391 @SmallTest |
392 @Feature({"NewTabPage"}) | 392 @Feature({"NewTabPage"}) |
| 393 @CommandLineFlags.Add("disable-features=NTPCondensedLayout") |
393 public void testSetSearchProviderHasLogo() throws Throwable { | 394 public void testSetSearchProviderHasLogo() throws Throwable { |
394 mActivityTestRule.runOnUiThread(new Runnable() { | 395 mActivityTestRule.runOnUiThread(new Runnable() { |
395 @Override | 396 @Override |
396 public void run() { | 397 public void run() { |
397 NewTabPageView ntpView = mNtp.getNewTabPageView(); | 398 NewTabPageView ntpView = mNtp.getNewTabPageView(); |
398 View logoView = ntpView.findViewById(R.id.search_provider_logo); | 399 View logoView = ntpView.findViewById(R.id.search_provider_logo); |
399 Assert.assertEquals(View.VISIBLE, logoView.getVisibility()); | 400 Assert.assertEquals(View.VISIBLE, logoView.getVisibility()); |
400 ntpView.setSearchProviderHasLogo(false); | 401 ntpView.setSearchProviderHasLogo(false); |
401 Assert.assertEquals(View.GONE, logoView.getVisibility()); | 402 Assert.assertEquals(View.GONE, logoView.getVisibility()); |
402 ntpView.setSearchProviderHasLogo(true); | 403 ntpView.setSearchProviderHasLogo(true); |
(...skipping 24 matching lines...) Expand all Loading... |
427 }); | 428 }); |
428 } | 429 } |
429 | 430 |
430 /** | 431 /** |
431 * Verifies that the placeholder is only shown when there are no tile sugges
tions and the search | 432 * Verifies that the placeholder is only shown when there are no tile sugges
tions and the search |
432 * provider has no logo. | 433 * provider has no logo. |
433 */ | 434 */ |
434 @Test | 435 @Test |
435 @SmallTest | 436 @SmallTest |
436 @Feature({"NewTabPage"}) | 437 @Feature({"NewTabPage"}) |
| 438 @CommandLineFlags.Add("disable-features=NTPCondensedLayout") |
437 public void testPlaceholder() { | 439 public void testPlaceholder() { |
438 final NewTabPageView ntpView = mNtp.getNewTabPageView(); | 440 final NewTabPageView ntpView = mNtp.getNewTabPageView(); |
439 final View logoView = ntpView.findViewById(R.id.search_provider_logo); | 441 final View logoView = ntpView.findViewById(R.id.search_provider_logo); |
440 final View searchBoxView = ntpView.findViewById(R.id.search_box); | 442 final View searchBoxView = ntpView.findViewById(R.id.search_box); |
441 | 443 |
442 // Initially, the logo is visible, the search box is visible, there is o
ne tile suggestion, | 444 // Initially, the logo is visible, the search box is visible, there is o
ne tile suggestion, |
443 // and the placeholder has not been inflated yet. | 445 // and the placeholder has not been inflated yet. |
444 Assert.assertEquals(View.VISIBLE, logoView.getVisibility()); | 446 Assert.assertEquals(View.VISIBLE, logoView.getVisibility()); |
445 Assert.assertEquals(View.VISIBLE, searchBoxView.getVisibility()); | 447 Assert.assertEquals(View.VISIBLE, searchBoxView.getVisibility()); |
446 Assert.assertEquals(1, mTileGridLayout.getChildCount()); | 448 Assert.assertEquals(1, mTileGridLayout.getChildCount()); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 */ | 564 */ |
563 private void waitForFakeboxTopPosition(final NewTabPage ntp, int position) { | 565 private void waitForFakeboxTopPosition(final NewTabPage ntp, int position) { |
564 CriteriaHelper.pollUiThread(Criteria.equals(position, new Callable<Integ
er>() { | 566 CriteriaHelper.pollUiThread(Criteria.equals(position, new Callable<Integ
er>() { |
565 @Override | 567 @Override |
566 public Integer call() { | 568 public Integer call() { |
567 return getFakeboxTop(ntp); | 569 return getFakeboxTop(ntp); |
568 } | 570 } |
569 })); | 571 })); |
570 } | 572 } |
571 } | 573 } |
OLD | NEW |