| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "chrome/browser/android/vr_shell/textures/url_bar_texture.h" | 5 #include "chrome/browser/android/vr_shell/textures/url_bar_texture.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 class TestUrlBarTexture : public UrlBarTexture { | 42 class TestUrlBarTexture : public UrlBarTexture { |
| 43 public: | 43 public: |
| 44 TestUrlBarTexture(); | 44 TestUrlBarTexture(); |
| 45 ~TestUrlBarTexture() override {} | 45 ~TestUrlBarTexture() override {} |
| 46 | 46 |
| 47 void DrawURL(const GURL& gurl) { | 47 void DrawURL(const GURL& gurl) { |
| 48 unsupported_mode_ = UiUnsupportedMode::kCount; | 48 unsupported_mode_ = UiUnsupportedMode::kCount; |
| 49 ToolbarState state(gurl, SecurityLevel::HTTP_SHOW_WARNING, | 49 ToolbarState state(gurl, SecurityLevel::HTTP_SHOW_WARNING, |
| 50 &toolbar::kHttpsInvalidIcon, | 50 &toolbar::kHttpsInvalidIcon, |
| 51 base::UTF8ToUTF16("Not secure"), true); | 51 base::UTF8ToUTF16("Not secure"), true, false); |
| 52 ASSERT_TRUE(state.should_display_url); | 52 ASSERT_TRUE(state.should_display_url); |
| 53 SetToolbarState(state); | 53 SetToolbarState(state); |
| 54 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul( | 54 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul( |
| 55 texture_size_.width(), texture_size_.height()); | 55 texture_size_.width(), texture_size_.height()); |
| 56 DrawAndLayout(surface->getCanvas(), texture_size_); | 56 DrawAndLayout(surface->getCanvas(), texture_size_); |
| 57 } | 57 } |
| 58 | 58 |
| 59 static void TestUrlStyling(const base::string16& formatted_url, | 59 static void TestUrlStyling(const base::string16& formatted_url, |
| 60 const url::Parsed& parsed, | 60 const url::Parsed& parsed, |
| 61 security_state::SecurityLevel security_level, | 61 security_state::SecurityLevel security_level, |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); | 286 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 TEST(UrlBarTexture, EmptyURL) { | 289 TEST(UrlBarTexture, EmptyURL) { |
| 290 TestUrlBarTexture texture; | 290 TestUrlBarTexture texture; |
| 291 texture.DrawURL(GURL()); | 291 texture.DrawURL(GURL()); |
| 292 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); | 292 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace vr_shell | 295 } // namespace vr_shell |
| OLD | NEW |