| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 texture.DrawURL(GURL("https://foo.com")); | 170 texture.DrawURL(GURL("https://foo.com")); |
| 171 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); | 171 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 172 texture.SetForceFontFallbackFailure(true); | 172 texture.SetForceFontFallbackFailure(true); |
| 173 texture.DrawURL(GURL("https://bar.com")); | 173 texture.DrawURL(GURL("https://bar.com")); |
| 174 EXPECT_EQ(UiUnsupportedMode::kUnhandledCodePoint, texture.unsupported_mode()); | 174 EXPECT_EQ(UiUnsupportedMode::kUnhandledCodePoint, texture.unsupported_mode()); |
| 175 texture.SetForceFontFallbackFailure(false); | 175 texture.SetForceFontFallbackFailure(false); |
| 176 texture.DrawURL(GURL("https://baz.com")); | 176 texture.DrawURL(GURL("https://baz.com")); |
| 177 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); | 177 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 TEST(UrlBarTexture, ElisionIsAnUnsupportedMode) { |
| 181 TestUrlBarTexture texture; |
| 182 texture.DrawURL(GURL( |
| 183 "https://" |
| 184 "thereisnopossiblewaythatthishostnamecouldbecontainedinthelimitedspacetha" |
| 185 "tweareaffordedtousitsreallynotsomethingweshouldconsiderorplanfororpinour" |
| 186 "hopesonlestwegetdisappointedor.sad.com")); |
| 187 EXPECT_EQ(UiUnsupportedMode::kCouldNotElideURL, texture.unsupported_mode()); |
| 188 } |
| 189 |
| 190 TEST(UrlBarTexture, ShortURLAreIndeedSupported) { |
| 191 TestUrlBarTexture texture; |
| 192 texture.DrawURL(GURL("https://short.com/")); |
| 193 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 194 } |
| 195 |
| 196 TEST(UrlBarTexture, LongPathsDoNotRequireElisionAndAreSupported) { |
| 197 TestUrlBarTexture texture; |
| 198 texture.DrawURL(GURL( |
| 199 "https://something.com/" |
| 200 "thereisnopossiblewaythatthishostnamecouldbecontainedinthelimitedspacetha" |
| 201 "tweareaffordedtousitsreallynotsomethingweshouldconsiderorplanfororpinour" |
| 202 "hopesonlestwegetdisappointedorsad.com")); |
| 203 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); |
| 204 } |
| 205 |
| 180 } // namespace vr_shell | 206 } // namespace vr_shell |
| OLD | NEW |