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