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

Unified Diff: chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc

Issue 2969623004: RenderText: Allow strike-through line thickness to be customized. (Closed)
Patch Set: Created 3 years, 6 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
Index: chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc
diff --git a/chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc b/chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc
index 452a5920256c97c84b9d29ba5ad56ac1ed6ba8a1..5a7a15c0e1b0ee715627b9409d3829be31526053 100644
--- a/chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc
+++ b/chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc
@@ -36,8 +36,7 @@ static const SkColor kIncognitoEmphasizedColor = 0xFFEDEDED;
static const SkColor kIncognitoSecureColor = 0xFFEDEDED;
static const SkColor kIncognitoWarningColor = 0xFFEDEDED;
-static constexpr int kUrlWidth = 400;
-static constexpr int kUrlHeight = 30;
+static constexpr int kUrlWidthPixels = 1024;
class TestUrlBarTexture : public UrlBarTexture {
public:
@@ -46,14 +45,15 @@ class TestUrlBarTexture : public UrlBarTexture {
void DrawURL(const GURL& gurl) {
unsupported_mode_ = UiUnsupportedMode::kCount;
- ToolbarState state(gurl, SecurityLevel::HTTP_SHOW_WARNING,
+ ToolbarState state(gurl, SecurityLevel::DANGEROUS,
&toolbar::kHttpsInvalidIcon,
base::UTF8ToUTF16("Not secure"), true);
ASSERT_TRUE(state.should_display_url);
SetToolbarState(state);
+ gfx::Size texture_size = GetPreferredTextureSize(kUrlWidthPixels);
sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(
- texture_size_.width(), texture_size_.height());
- DrawAndLayout(surface->getCanvas(), texture_size_);
+ texture_size.width(), texture_size.height());
+ DrawAndLayout(surface->getCanvas(), texture_size);
}
static void TestUrlStyling(const base::string16& formatted_url,
@@ -75,8 +75,9 @@ class TestUrlBarTexture : public UrlBarTexture {
gurl, url_formatter::kFormatUrlOmitAll, net::UnescapeRule::NORMAL,
&parsed, nullptr, nullptr);
+ gfx::Size texture_size = GetPreferredTextureSize(kUrlWidthPixels);
gfx::FontList font_list;
- if (!GetFontList(kUrlHeight, text, &font_list))
+ if (!GetFontList(texture_size.height(), text, &font_list))
return 0;
return font_list.GetFonts().size();
@@ -94,17 +95,13 @@ class TestUrlBarTexture : public UrlBarTexture {
unsupported_mode_ = mode;
}
- gfx::Size texture_size_;
- gfx::Rect bounds_;
UiUnsupportedMode unsupported_mode_ = UiUnsupportedMode::kCount;
};
TestUrlBarTexture::TestUrlBarTexture()
: UrlBarTexture(false,
base::Bind(&TestUrlBarTexture::OnUnsupportedFeature,
- base::Unretained(this))),
- texture_size_(kUrlWidth, kUrlHeight),
- bounds_(kUrlWidth, kUrlHeight) {
+ base::Unretained(this))) {
gfx::FontList::SetDefaultFontDescription("Arial, Times New Roman, 15px");
}
@@ -118,6 +115,7 @@ class MockRenderText : public RenderTextWrapper {
MOCK_METHOD2(SetStyle, void(gfx::TextStyle style, bool value));
MOCK_METHOD3(ApplyStyle,
void(gfx::TextStyle style, bool value, const gfx::Range& range));
+ MOCK_METHOD1(SetStrikeThicknessFactor, void(SkScalar));
private:
DISALLOW_COPY_AND_ASSIGN(MockRenderText);

Powered by Google App Engine
This is Rietveld 408576698