| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 texture.DrawURL(GURL("https://foo.com")); | 145 texture.DrawURL(GURL("https://foo.com")); |
| 146 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); | 146 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 147 texture.SetForceFontFallbackFailure(true); | 147 texture.SetForceFontFallbackFailure(true); |
| 148 texture.DrawURL(GURL("https://bar.com")); | 148 texture.DrawURL(GURL("https://bar.com")); |
| 149 EXPECT_EQ(UiUnsupportedMode::kUnhandledCodePoint, texture.unsupported_mode()); | 149 EXPECT_EQ(UiUnsupportedMode::kUnhandledCodePoint, texture.unsupported_mode()); |
| 150 texture.SetForceFontFallbackFailure(false); | 150 texture.SetForceFontFallbackFailure(false); |
| 151 texture.DrawURL(GURL("https://baz.com")); | 151 texture.DrawURL(GURL("https://baz.com")); |
| 152 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); | 152 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 TEST(UrlBarTexture, ElisionIsAnUnsupportedMode) { |
| 156 TestUrlBarTexture texture; |
| 157 texture.DrawURL(GURL( |
| 158 "https://" |
| 159 "thereisnopossiblewaythatthishostnamecouldbecontainedinthelimitedspacetha" |
| 160 "tweareaffordedtousitsreallynotsomethingweshouldconsiderorplanfororpinour" |
| 161 "hopesonlestwegetdisappointedor.sad.com")); |
| 162 EXPECT_EQ(UiUnsupportedMode::kCouldNotElideURL, texture.unsupported_mode()); |
| 163 } |
| 164 |
| 165 TEST(UrlBarTexture, ShortURLAreIndeedSupported) { |
| 166 TestUrlBarTexture texture; |
| 167 texture.DrawURL(GURL("https://short.com/")); |
| 168 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 169 } |
| 170 |
| 171 TEST(UrlBarTexture, LongPathsDoNotRequireElisionAndAreSupported) { |
| 172 TestUrlBarTexture texture; |
| 173 texture.DrawURL(GURL( |
| 174 "https://something.com/" |
| 175 "thereisnopossiblewaythatthishostnamecouldbecontainedinthelimitedspacetha" |
| 176 "tweareaffordedtousitsreallynotsomethingweshouldconsiderorplanfororpinour" |
| 177 "hopesonlestwegetdisappointedorsad.com")); |
| 178 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 179 } |
| 180 |
| 155 } // namespace vr_shell | 181 } // namespace vr_shell |
| OLD | NEW |