| 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.widget; | 5 package org.chromium.chrome.browser.widget; | 
| 6 | 6 | 
| 7 import android.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; | 
| 8 | 8 | 
| 9 import org.chromium.base.CommandLine; | 9 import org.chromium.base.CommandLine; | 
| 10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; | 
| 11 import org.chromium.content.browser.test.NativeLibraryTestBase; | 11 import org.chromium.content.browser.test.NativeLibraryTestBase; | 
| 12 | 12 | 
| 13 /** | 13 /** | 
| 14  * Unit tests for RoundedIconGenerator. | 14  * Unit tests for RoundedIconGenerator. | 
| 15  */ | 15  */ | 
| 16 public class RoundedIconGeneratorTest extends NativeLibraryTestBase { | 16 public class RoundedIconGeneratorTest extends NativeLibraryTestBase { | 
| 17     private String getIconTextForUrl(String url, boolean includePrivateRegistrie
    s) { | 17     private String getIconTextForUrl(String url, boolean includePrivateRegistrie
    s) { | 
| 18         return RoundedIconGenerator.getIconTextForUrl(url, includePrivateRegistr
    ies); | 18         return RoundedIconGenerator.getIconTextForUrl(url, includePrivateRegistr
    ies); | 
| 19     } | 19     } | 
| 20 | 20 | 
| 21     @Override | 21     @Override | 
| 22     protected void setUp() throws Exception { | 22     protected void setUp() throws Exception { | 
|  | 23         super.setUp(); | 
| 23         CommandLine.init(null); | 24         CommandLine.init(null); | 
| 24         loadNativeLibraryAndInitBrowserProcess(); | 25         loadNativeLibraryAndInitBrowserProcess(); | 
| 25     } | 26     } | 
| 26 | 27 | 
| 27     /** | 28     /** | 
| 28      * Verifies that RoundedIconGenerator's ability to generate icons based on U
    RLs considers the | 29      * Verifies that RoundedIconGenerator's ability to generate icons based on U
    RLs considers the | 
| 29      * appropriate parts of the URL for the icon to generate. | 30      * appropriate parts of the URL for the icon to generate. | 
| 30      */ | 31      */ | 
| 31     @SmallTest | 32     @SmallTest | 
| 32     @Feature({"Browser", "RoundedIconGenerator"}) | 33     @Feature({"Browser", "RoundedIconGenerator"}) | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 48         assertEquals("localhost", getIconTextForUrl("http://localhost/", false))
    ; | 49         assertEquals("localhost", getIconTextForUrl("http://localhost/", false))
    ; | 
| 49         assertEquals("google-chrome", getIconTextForUrl("https://google-chrome/"
    , false)); | 50         assertEquals("google-chrome", getIconTextForUrl("https://google-chrome/"
    , false)); | 
| 50         assertEquals("127.0.0.1", getIconTextForUrl("http://127.0.0.1/", false))
    ; | 51         assertEquals("127.0.0.1", getIconTextForUrl("http://127.0.0.1/", false))
    ; | 
| 51 | 52 | 
| 52         // Verify that the fallback is the the URL itself. | 53         // Verify that the fallback is the the URL itself. | 
| 53         assertEquals("file:///home/chrome/test.html", | 54         assertEquals("file:///home/chrome/test.html", | 
| 54                 getIconTextForUrl("file:///home/chrome/test.html", false)); | 55                 getIconTextForUrl("file:///home/chrome/test.html", false)); | 
| 55         assertEquals("data:image", getIconTextForUrl("data:image", false)); | 56         assertEquals("data:image", getIconTextForUrl("data:image", false)); | 
| 56     } | 57     } | 
| 57 } | 58 } | 
| OLD | NEW | 
|---|