Index: ios/chrome/browser/ui/history/tab_history_popup_controller_egtest.mm |
diff --git a/ios/chrome/browser/ui/history/tab_history_popup_controller_egtest.mm b/ios/chrome/browser/ui/history/tab_history_popup_controller_egtest.mm |
index 1881fe8047aca2f67d18d3facb96dd8bf9bd924e..3ef29abaf01e962b7c67fcdaccb3837b7efcbdbf 100644 |
--- a/ios/chrome/browser/ui/history/tab_history_popup_controller_egtest.mm |
+++ b/ios/chrome/browser/ui/history/tab_history_popup_controller_egtest.mm |
@@ -6,6 +6,7 @@ |
#include "base/strings/sys_string_conversions.h" |
#include "components/strings/grit/components_strings.h" |
+#include "components/url_formatter/url_formatter.h" |
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
#import "ios/chrome/test/earl_grey/chrome_matchers.h" |
#import "ios/chrome/test/earl_grey/chrome_test_case.h" |
@@ -16,6 +17,13 @@ |
#error "This file requires ARC support." |
#endif |
+namespace { |
+// Formats |url| for display and returns an NSString representation. |
+NSString* GetFormattedURLString(const GURL& url) { |
+ return base::SysUTF16ToNSString(url_formatter::FormatUrl(url)); |
+} |
+} |
+ |
// Tests for tab history popup. |
@interface TabHistoryPopupControllerTestCase : ChromeTestCase |
@end |
@@ -31,10 +39,10 @@ - (void)testTabHistoryMenu { |
const GURL URL3 = web::test::HttpServer::MakeUrl("http://page3"); |
const GURL URL4 = web::test::HttpServer::MakeUrl("http://page4"); |
NSString* entry0 = @"New Tab"; |
- NSString* entry1 = base::SysUTF8ToNSString(URL1.spec()); |
- NSString* entry2 = base::SysUTF8ToNSString(URL2.spec()); |
- NSString* entry3 = base::SysUTF8ToNSString(URL3.spec()); |
- NSString* entry4 = base::SysUTF8ToNSString(URL4.spec()); |
+ NSString* entry1 = GetFormattedURLString(URL1); |
+ NSString* entry2 = GetFormattedURLString(URL2); |
+ NSString* entry3 = GetFormattedURLString(URL3); |
+ NSString* entry4 = GetFormattedURLString(URL4); |
// Create map of canned responses and set up the test HTML server. |
std::map<GURL, std::string> responses; |