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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java

Issue 1311613006: Update getColor calls that were deprecated in M. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/BrandColorTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java
index 492808e76a9536baf08c1885aff688e52898e1b7..a6efab1c19bc73fc2331f8fef437cbb7f9ae4b37 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizerTest.java
@@ -10,6 +10,7 @@ import android.test.suitebuilder.annotation.MediumTest;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
+import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CommandLine;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.Feature;
@@ -128,14 +129,14 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
EmphasizedUrlSpanHelper[] spans = EmphasizedUrlSpanHelper.getSpansForEmphasizedUrl(url);
assertEquals("Unexpected number of spans:", 4, spans.length);
- spans[0].assertIsColoredSpan("https", 0,
- mResources.getColor(R.color.url_emphasis_start_scheme_secure));
- spans[1].assertIsColoredSpan("://", 5,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[2].assertIsColoredSpan("www.google.com", 8,
- mResources.getColor(R.color.url_emphasis_domain_and_registry));
- spans[3].assertIsColoredSpan("/", 22,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
+ spans[0].assertIsColoredSpan("https", 0, ApiCompatibilityUtils.getColor(mResources,
newt (away) 2015/09/04 02:08:21 Did we ever consider naming this class "ApiCompat"
+ R.color.url_emphasis_start_scheme_secure));
+ spans[1].assertIsColoredSpan("://", 5, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[2].assertIsColoredSpan("www.google.com", 8, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_domain_and_registry));
+ spans[3].assertIsColoredSpan("/", 22, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
}
/**
@@ -152,14 +153,14 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
EmphasizedUrlSpanHelper[] spans = EmphasizedUrlSpanHelper.getSpansForEmphasizedUrl(url);
assertEquals("Unexpected number of spans:", 4, spans.length);
- spans[0].assertIsColoredSpan("https", 0,
- mResources.getColor(R.color.url_emphasis_light_non_emphasized_text));
- spans[1].assertIsColoredSpan("://", 5,
- mResources.getColor(R.color.url_emphasis_light_non_emphasized_text));
- spans[2].assertIsColoredSpan("www.google.com", 8,
- mResources.getColor(R.color.url_emphasis_light_domain_and_registry));
- spans[3].assertIsColoredSpan("/", 22,
- mResources.getColor(R.color.url_emphasis_light_non_emphasized_text));
+ spans[0].assertIsColoredSpan("https", 0, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_light_non_emphasized_text));
+ spans[1].assertIsColoredSpan("://", 5, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_light_non_emphasized_text));
+ spans[2].assertIsColoredSpan("www.google.com", 8, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_light_domain_and_registry));
+ spans[3].assertIsColoredSpan("/", 22, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_light_non_emphasized_text));
}
/**
@@ -178,14 +179,15 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
assertEquals("Unexpected number of spans:", 5, spans.length);
spans[0].assertIsStrikethroughSpan("https", 0);
- spans[1].assertIsColoredSpan("https", 0,
- mResources.getColor(R.color.url_emphasis_start_scheme_security_error));
- spans[2].assertIsColoredSpan("://", 5,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[3].assertIsColoredSpan("www.google.com", 8,
- mResources.getColor(R.color.url_emphasis_domain_and_registry));
+ spans[1].assertIsColoredSpan("https", 0, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_start_scheme_security_error));
+ spans[2].assertIsColoredSpan("://", 5, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[3].assertIsColoredSpan("www.google.com", 8, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_domain_and_registry));
spans[4].assertIsColoredSpan("/q?query=abc123&results=1", 22,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
+ ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
}
/**
@@ -203,12 +205,12 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
assertEquals("Unexpected number of spans:", 4, spans.length);
spans[0].assertIsStrikethroughSpan("https", 0);
- spans[1].assertIsColoredSpan("https", 0,
- mResources.getColor(R.color.url_emphasis_start_scheme_security_warning));
- spans[2].assertIsColoredSpan("://", 5,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[3].assertIsColoredSpan("www.dodgysite.com", 8,
- mResources.getColor(R.color.url_emphasis_domain_and_registry));
+ spans[1].assertIsColoredSpan("https", 0, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_start_scheme_security_warning));
+ spans[2].assertIsColoredSpan("://", 5, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[3].assertIsColoredSpan("www.dodgysite.com", 8, ApiCompatibilityUtils.getColor(
+ mResources, R.color.url_emphasis_domain_and_registry));
}
/**
@@ -225,12 +227,12 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
EmphasizedUrlSpanHelper[] spans = EmphasizedUrlSpanHelper.getSpansForEmphasizedUrl(url);
assertEquals("Unexpected number of spans:", 3, spans.length);
- spans[0].assertIsColoredSpan("about", 0,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[1].assertIsColoredSpan(":", 5,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[2].assertIsColoredSpan("blank", 6,
- mResources.getColor(R.color.url_emphasis_domain_and_registry));
+ spans[0].assertIsColoredSpan("about", 0, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[1].assertIsColoredSpan(":", 5, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[2].assertIsColoredSpan("blank", 6, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_domain_and_registry));
}
/**
@@ -248,8 +250,8 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
EmphasizedUrlSpanHelper[] spans = EmphasizedUrlSpanHelper.getSpansForEmphasizedUrl(url);
assertEquals("Unexpected number of spans:", 1, spans.length);
- spans[0].assertIsColoredSpan("data", 0,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
+ spans[0].assertIsColoredSpan("data", 0, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
}
/**
@@ -266,12 +268,12 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
EmphasizedUrlSpanHelper[] spans = EmphasizedUrlSpanHelper.getSpansForEmphasizedUrl(url);
assertEquals("Unexpected number of spans:", 3, spans.length);
- spans[0].assertIsColoredSpan("chrome", 0,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[1].assertIsColoredSpan("://", 6,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[2].assertIsColoredSpan("bookmarks", 9,
- mResources.getColor(R.color.url_emphasis_domain_and_registry));
+ spans[0].assertIsColoredSpan("chrome", 0, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[1].assertIsColoredSpan("://", 6, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[2].assertIsColoredSpan("bookmarks", 9, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_domain_and_registry));
}
/**
@@ -288,12 +290,12 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
EmphasizedUrlSpanHelper[] spans = EmphasizedUrlSpanHelper.getSpansForEmphasizedUrl(url);
assertEquals("Unexpected number of spans:", 3, spans.length);
- spans[0].assertIsColoredSpan("chrome-native", 0,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[1].assertIsColoredSpan("://", 13,
- mResources.getColor(R.color.url_emphasis_non_emphasized_text));
- spans[2].assertIsColoredSpan("bookmarks", 16,
- mResources.getColor(R.color.url_emphasis_domain_and_registry));
+ spans[0].assertIsColoredSpan("chrome-native", 0, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[1].assertIsColoredSpan("://", 13, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_non_emphasized_text));
+ spans[2].assertIsColoredSpan("bookmarks", 16, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_domain_and_registry));
}
/**
@@ -310,8 +312,8 @@ public class OmniboxUrlEmphasizerTest extends NativeLibraryTestBase {
EmphasizedUrlSpanHelper[] spans = EmphasizedUrlSpanHelper.getSpansForEmphasizedUrl(url);
assertEquals("Unexpected number of spans:", 1, spans.length);
- spans[0].assertIsColoredSpan("invalidurl", 0,
- mResources.getColor(R.color.url_emphasis_domain_and_registry));
+ spans[0].assertIsColoredSpan("invalidurl", 0, ApiCompatibilityUtils.getColor(mResources,
+ R.color.url_emphasis_domain_and_registry));
}
/**
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/toolbar/BrandColorTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698