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

Side by Side Diff: chrome/browser/android/vr_shell/textures/url_bar_texture_unittest.cc

Issue 2925053004: [vr] Exit to 2D when encountering URLs with strong RTL characters (Closed)
Patch Set: rebaes 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 unified diff | Download patch
OLDNEW
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 texture.DrawURL(GURL("https://foo.com")); 172 texture.DrawURL(GURL("https://foo.com"));
173 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); 173 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode());
174 texture.SetForceFontFallbackFailure(true); 174 texture.SetForceFontFallbackFailure(true);
175 texture.DrawURL(GURL("https://bar.com")); 175 texture.DrawURL(GURL("https://bar.com"));
176 EXPECT_EQ(UiUnsupportedMode::kUnhandledCodePoint, texture.unsupported_mode()); 176 EXPECT_EQ(UiUnsupportedMode::kUnhandledCodePoint, texture.unsupported_mode());
177 texture.SetForceFontFallbackFailure(false); 177 texture.SetForceFontFallbackFailure(false);
178 texture.DrawURL(GURL("https://baz.com")); 178 texture.DrawURL(GURL("https://baz.com"));
179 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); 179 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode());
180 } 180 }
181 181
182 TEST(UrlBarTextureTest, WillFailOnStrongRTLChar) {
183 TestUrlBarTexture texture;
184 texture.DrawURL(GURL("https://ש.com"));
185 EXPECT_EQ(UiUnsupportedMode::kURLWithStrongRTLChars,
186 texture.unsupported_mode());
187 }
188
182 TEST(UrlBarTexture, ElisionIsAnUnsupportedMode) { 189 TEST(UrlBarTexture, ElisionIsAnUnsupportedMode) {
183 TestUrlBarTexture texture; 190 TestUrlBarTexture texture;
184 texture.DrawURL(GURL( 191 texture.DrawURL(GURL(
185 "https://" 192 "https://"
186 "thereisnopossiblewaythatthishostnamecouldbecontainedinthelimitedspacetha" 193 "thereisnopossiblewaythatthishostnamecouldbecontainedinthelimitedspacetha"
187 "tweareaffordedtousitsreallynotsomethingweshouldconsiderorplanfororpinour" 194 "tweareaffordedtousitsreallynotsomethingweshouldconsiderorplanfororpinour"
188 "hopesonlestwegetdisappointedor.sad.com")); 195 "hopesonlestwegetdisappointedor.sad.com"));
189 EXPECT_EQ(UiUnsupportedMode::kCouldNotElideURL, texture.unsupported_mode()); 196 EXPECT_EQ(UiUnsupportedMode::kCouldNotElideURL, texture.unsupported_mode());
190 } 197 }
191 198
192 TEST(UrlBarTexture, ShortURLAreIndeedSupported) { 199 TEST(UrlBarTexture, ShortURLAreIndeedSupported) {
193 TestUrlBarTexture texture; 200 TestUrlBarTexture texture;
194 texture.DrawURL(GURL("https://short.com/")); 201 texture.DrawURL(GURL("https://short.com/"));
195 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); 202 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode());
196 } 203 }
197 204
198 TEST(UrlBarTexture, LongPathsDoNotRequireElisionAndAreSupported) { 205 TEST(UrlBarTexture, LongPathsDoNotRequireElisionAndAreSupported) {
199 TestUrlBarTexture texture; 206 TestUrlBarTexture texture;
200 texture.DrawURL(GURL( 207 texture.DrawURL(GURL(
201 "https://something.com/" 208 "https://something.com/"
202 "thereisnopossiblewaythatthishostnamecouldbecontainedinthelimitedspacetha" 209 "thereisnopossiblewaythatthishostnamecouldbecontainedinthelimitedspacetha"
203 "tweareaffordedtousitsreallynotsomethingweshouldconsiderorplanfororpinour" 210 "tweareaffordedtousitsreallynotsomethingweshouldconsiderorplanfororpinour"
204 "hopesonlestwegetdisappointedorsad.com")); 211 "hopesonlestwegetdisappointedorsad.com"));
205 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode()); 212 EXPECT_EQ(UiUnsupportedMode::kCount, texture.unsupported_mode());
206 } 213 }
207 214
208 } // namespace vr_shell 215 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/textures/url_bar_texture.cc ('k') | chrome/browser/android/vr_shell/ui_unsupported_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698