diff --git a/android_webview/browser/state_serializer_unittest.cc b/android_webview/browser/state_serializer_unittest.cc index e02d30f7213ea6..9ea72eb54966b2 100644 --- a/android_webview/browser/state_serializer_unittest.cc +++ b/android_webview/browser/state_serializer_unittest.cc @@ -33,7 +33,7 @@ std::unique_ptr CreateNavigationEntry() { content::Referrer referrer; referrer.url = GURL("http://referrer_url"); referrer.policy = network::mojom::ReferrerPolicy::kOrigin; - const std::u16string title(base::UTF8ToUTF16("title")); + const std::u16string title(u"title"); const bool has_post_data = true; const GURL original_request_url("http://original_request_url"); const GURL base_url_for_data_url("http://base_url"); @@ -182,7 +182,7 @@ TEST_F(AndroidWebViewStateSerializerTest, GURL virtual_url("https://example.com/virtual_url"); content::Referrer referrer(GURL("https://example.com/referrer"), network::mojom::ReferrerPolicy::kDefault); - std::u16string title = base::UTF8ToUTF16("title"); + std::u16string title = u"title"; std::string empty_encoded_page_state = ""; bool has_post_data = false; GURL original_request_url("https://example.com/original"); diff --git a/ash/app_list/app_list_controller_impl_unittest.cc b/ash/app_list/app_list_controller_impl_unittest.cc index 1328102128cb27..31e3468b110491 100644 --- a/ash/app_list/app_list_controller_impl_unittest.cc +++ b/ash/app_list/app_list_controller_impl_unittest.cc @@ -462,8 +462,7 @@ TEST_F(AppListControllerImplTest, MAYBE_CloseNotificationWithAppListShown) { message_center::MessageCenter::Get()->AddNotification( std::make_unique( message_center::NOTIFICATION_TYPE_BASE_FORMAT, notification_id, - base::UTF8ToUTF16(notification_title), - base::UTF8ToUTF16("test message"), gfx::Image(), + base::UTF8ToUTF16(notification_title), u"test message", gfx::Image(), std::u16string() /* display_source */, GURL(), message_center::NotifierId(), message_center::RichNotificationData(), new message_center::NotificationDelegate())); diff --git a/ash/app_list/views/app_list_view_unittest.cc b/ash/app_list/views/app_list_view_unittest.cc index b64942c943efec..9a009656eac2ba 100644 --- a/ash/app_list/views/app_list_view_unittest.cc +++ b/ash/app_list/views/app_list_view_unittest.cc @@ -678,7 +678,7 @@ class AppListViewFocusTest : public views::ViewsTestBase, // Arabic word of "test". ? base::UTF8ToUTF16( "\xd8\xa7\xd8\xae\xd8\xaa\xd8\xa8\xd8\xa7\xd8\xb1") - : base::UTF8ToUTF16("test"); + : u"test"; textfield->InsertText( text, ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); @@ -749,7 +749,7 @@ class AppListViewFocusTest : public views::ViewsTestBase, // Clean up textfield->RequestFocus(); - textfield->SetText(base::UTF8ToUTF16("")); + textfield->SetText(u""); } AppListView* app_list_view() { return view_; } @@ -1002,7 +1002,7 @@ TEST_P(AppListViewFocusTest, LeftRightFocusTraversalInHalfState) { // Arabic word of "test". ? base::UTF8ToUTF16( "\xd8\xa7\xd8\xae\xd8\xaa\xd8\xa8\xd8\xa7\xd8\xb1") - : base::UTF8ToUTF16("test"); + : u"test"; search_box_view()->search_box()->InsertText( text, ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); @@ -1323,7 +1323,7 @@ TEST_F(AppListViewFocusTest, RedirectFocusToSearchBox) { GetAllSuggestions()[0]->RequestFocus(); SimulateKeyPress(ui::VKEY_A, false); EXPECT_EQ(search_box_view()->search_box(), focused_view()); - EXPECT_EQ(search_box_view()->search_box()->GetText(), base::UTF8ToUTF16("a")); + EXPECT_EQ(search_box_view()->search_box()->GetText(), u"a"); EXPECT_FALSE(search_box_view()->search_box()->HasSelection()); // Set focus to close button and type a character. @@ -1331,15 +1331,14 @@ TEST_F(AppListViewFocusTest, RedirectFocusToSearchBox) { EXPECT_NE(search_box_view()->search_box(), focused_view()); SimulateKeyPress(ui::VKEY_B, false); EXPECT_EQ(search_box_view()->search_box(), focused_view()); - EXPECT_EQ(search_box_view()->search_box()->GetText(), - base::UTF8ToUTF16("ab")); + EXPECT_EQ(search_box_view()->search_box()->GetText(), u"ab"); EXPECT_FALSE(search_box_view()->search_box()->HasSelection()); // Set focus to close button and hitting backspace. search_box_view()->close_button()->RequestFocus(); SimulateKeyPress(ui::VKEY_BACK, false); EXPECT_EQ(search_box_view()->search_box(), focused_view()); - EXPECT_EQ(search_box_view()->search_box()->GetText(), base::UTF8ToUTF16("a")); + EXPECT_EQ(search_box_view()->search_box()->GetText(), u"a"); EXPECT_FALSE(search_box_view()->search_box()->HasSelection()); } @@ -1360,18 +1359,18 @@ TEST_F(AppListViewFocusTest, SearchBoxTextUpdatesOnResultFocus) { // Change focus to the next result SimulateKeyPress(ui::VKEY_TAB, false); - EXPECT_EQ(search_box->GetText(), base::UTF8ToUTF16("TestResult2")); + EXPECT_EQ(search_box->GetText(), u"TestResult2"); SimulateKeyPress(ui::VKEY_TAB, true); - EXPECT_EQ(search_box->GetText(), base::UTF8ToUTF16("TestResult1")); + EXPECT_EQ(search_box->GetText(), u"TestResult1"); SimulateKeyPress(ui::VKEY_TAB, false); // Change focus to the final result SimulateKeyPress(ui::VKEY_TAB, false); - EXPECT_EQ(search_box->GetText(), base::UTF8ToUTF16("TestResult3")); + EXPECT_EQ(search_box->GetText(), u"TestResult3"); } // Tests that ctrl-A selects all text in the searchbox when the SearchBoxView is @@ -1474,7 +1473,7 @@ TEST_F(AppListViewFocusTest, HittingEnterWhenFocusOnSearchBox) { // Type something in search box to transition to HALF state and populate // fake list results. Then hit Enter key. search_box_view()->search_box()->InsertText( - base::UTF8ToUTF16("test"), + u"test", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); const int kListResults = 2; SetUpSearchResults(0, kListResults); @@ -1775,7 +1774,7 @@ TEST_F(AppListViewTest, TypingPeekingToHalf) { Show(); search_box->SetText(std::u16string()); search_box->InsertText( - base::UTF8ToUTF16("nice"), + u"nice", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); ASSERT_EQ(ash::AppListViewState::kHalf, view_->app_list_state()); @@ -1792,7 +1791,7 @@ TEST_F(AppListViewTest, TypingFullscreenToFullscreenSearch) { search_box->SetText(std::u16string()); search_box->InsertText( - base::UTF8ToUTF16("https://youtu.be/dQw4w9WgXcQ"), + u"https://youtu.be/dQw4w9WgXcQ", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); ASSERT_EQ(ash::AppListViewState::kFullscreenSearch, view_->app_list_state()); @@ -1807,7 +1806,7 @@ TEST_F(AppListViewTest, TypingTabletModeFullscreenSearch) { Show(); search_box->SetText(std::u16string()); search_box->InsertText( - base::UTF8ToUTF16("cool!"), + u"cool!", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); ASSERT_EQ(ash::AppListViewState::kFullscreenSearch, view_->app_list_state()); @@ -2220,7 +2219,7 @@ TEST_F(AppListViewTest, DISABLED_SearchResultsTest) { view_->Layout(); EXPECT_TRUE(IsStateShown(ash::AppListState::kStateApps)); - std::u16string search_text = base::UTF8ToUTF16("test"); + std::u16string search_text = u"test"; main_view->search_box_view()->search_box()->SetText(std::u16string()); main_view->search_box_view()->search_box()->InsertText( search_text, @@ -2241,7 +2240,7 @@ TEST_F(AppListViewTest, DISABLED_SearchResultsTest) { EXPECT_TRUE(CheckSearchBoxWidget( contents_view->GetSearchBoxBounds(ash::AppListState::kStateApps))); - std::u16string new_search_text = base::UTF8ToUTF16("apple"); + std::u16string new_search_text = u"apple"; main_view->search_box_view()->search_box()->SetText(std::u16string()); main_view->search_box_view()->search_box()->InsertText( new_search_text, @@ -2296,7 +2295,7 @@ TEST_F(AppListViewTest, DISABLED_BackTest) { EXPECT_EQ(1, delegate_->dismiss_count()); // Show the search results. - std::u16string new_search_text = base::UTF8ToUTF16("apple"); + std::u16string new_search_text = u"apple"; search_box_view->search_box()->SetText(std::u16string()); search_box_view->search_box()->InsertText( new_search_text, @@ -2407,7 +2406,7 @@ TEST_F(AppListViewTest, BackAction) { // Select the second page and open search results page. apps_grid_view()->pagination_model()->SelectPage(1, false); search_box_view()->search_box()->InsertText( - base::UTF8ToUTF16("A"), + u"A", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); EXPECT_EQ(ash::AppListViewState::kFullscreenSearch, view_->app_list_state()); EXPECT_EQ(1, apps_grid_view()->pagination_model()->selected_page()); @@ -2485,7 +2484,7 @@ TEST_F(AppListViewFocusTest, ShowEmbeddedAssistantUI) { // Type something in search box to transition to HALF state and populate // fake list results. Then hit Enter key. search_box_view()->search_box()->InsertText( - base::UTF8ToUTF16("test"), + u"test", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); const int kListResults = 2; const int kIndexOpenAssistantUi = 1; diff --git a/ash/app_list/views/assistant/assistant_page_view_unittest.cc b/ash/app_list/views/assistant/assistant_page_view_unittest.cc index 24dd73950a745b..5b831020380fce 100644 --- a/ash/app_list/views/assistant/assistant_page_view_unittest.cc +++ b/ash/app_list/views/assistant/assistant_page_view_unittest.cc @@ -837,23 +837,23 @@ TEST_F(AssistantPageViewTest, RememberAndShowHistory) { EXPECT_TRUE(input_text_field()->GetText().empty()); PressKey(ui::VKEY_UP); - EXPECT_EQ(input_text_field()->GetText(), base::UTF8ToUTF16("query 2")); + EXPECT_EQ(input_text_field()->GetText(), u"query 2"); PressKey(ui::VKEY_UP); - EXPECT_EQ(input_text_field()->GetText(), base::UTF8ToUTF16("query 1")); + EXPECT_EQ(input_text_field()->GetText(), u"query 1"); PressKey(ui::VKEY_UP); - EXPECT_EQ(input_text_field()->GetText(), base::UTF8ToUTF16("query 1")); + EXPECT_EQ(input_text_field()->GetText(), u"query 1"); PressKey(ui::VKEY_DOWN); - EXPECT_EQ(input_text_field()->GetText(), base::UTF8ToUTF16("query 2")); + EXPECT_EQ(input_text_field()->GetText(), u"query 2"); PressKey(ui::VKEY_DOWN); EXPECT_TRUE(input_text_field()->GetText().empty()); } TEST_F(AssistantPageViewTest, ShouldNotClearQueryWhenSwitchingToTabletMode) { - const std::u16string query_text = base::UTF8ToUTF16("unsubmitted query"); + const std::u16string query_text = u"unsubmitted query"; ShowAssistantUiInTextMode(); input_text_field()->SetText(query_text); diff --git a/ash/app_list/views/search_result_list_view_unittest.cc b/ash/app_list/views/search_result_list_view_unittest.cc index 506ddb3bb696b8..84c1a540ef6729 100644 --- a/ash/app_list/views/search_result_list_view_unittest.cc +++ b/ash/app_list/views/search_result_list_view_unittest.cc @@ -80,7 +80,7 @@ class SearchResultListViewTest : public views::test::WidgetTest { assistant_result->set_result_type( ash::AppListSearchResultType::kAssistantText); assistant_result->set_display_type(ash::SearchResultDisplayType::kList); - assistant_result->set_title(base::UTF8ToUTF16("assistant result")); + assistant_result->set_title(u"assistant result"); results->Add(std::move(assistant_result)); RunPendingMessages(); @@ -189,7 +189,7 @@ TEST_F(SearchResultListViewTest, HidesAssistantResultWhenTilesVisible) { // Assistant result should be set and visible. for (const auto* view : GetAssistantResultViews()) { EXPECT_TRUE(view->GetVisible()); - EXPECT_EQ(view->result()->title(), base::UTF8ToUTF16("assistant result")); + EXPECT_EQ(view->result()->title(), u"assistant result"); } // Add a tile result diff --git a/ash/assistant/ui/main_stage/assistant_onboarding_view_unittest.cc b/ash/assistant/ui/main_stage/assistant_onboarding_view_unittest.cc index 8d9a867f007bf9..da9c2915ec454b 100644 --- a/ash/assistant/ui/main_stage/assistant_onboarding_view_unittest.cc +++ b/ash/assistant/ui/main_stage/assistant_onboarding_view_unittest.cc @@ -424,8 +424,7 @@ TEST_F(AssistantOnboardingViewTest, ShouldHandleSuggestionUpdates) { // Verify view state is updated to reflect model state. auto suggestion_views = GetOnboardingSuggestionViews(); ASSERT_EQ(suggestion_views.size(), 1u); - EXPECT_EQ(suggestion_views.at(0)->GetText(), - base::UTF8ToUTF16("Forced suggestion")); + EXPECT_EQ(suggestion_views.at(0)->GetText(), u"Forced suggestion"); } TEST_F(AssistantOnboardingViewTest, ShouldHandleLocalIcons) { diff --git a/ash/clipboard/clipboard_history_resource_manager.cc b/ash/clipboard/clipboard_history_resource_manager.cc index c8bdb90eeacea7..bcef0bf580a0a3 100644 --- a/ash/clipboard/clipboard_history_resource_manager.cc +++ b/ash/clipboard/clipboard_history_resource_manager.cc @@ -105,12 +105,12 @@ std::u16string GetLabelForCustomData(const ui::ClipboardData& data) { // Strip path information, so all that's left are file names. for (auto it = source_list.begin(); it != source_list.end(); ++it) - *it = it->substr(it->find_last_of(base::UTF8ToUTF16("/")) + 1); + *it = it->substr(it->find_last_of(u"/") + 1); // Join file names, unescaping encoded character sequences for display. This // ensures that "My%20File.txt" will display as "My File.txt". return base::UTF8ToUTF16(base::UnescapeURLComponent( - base::UTF16ToUTF8(base::JoinString(source_list, base::UTF8ToUTF16(", "))), + base::UTF16ToUTF8(base::JoinString(source_list, u", ")), base::UnescapeRule::SPACES)); } diff --git a/ash/clipboard/clipboard_history_resource_manager_unittest.cc b/ash/clipboard/clipboard_history_resource_manager_unittest.cc index e675cdb6c14fd5..b8214f2428d825 100644 --- a/ash/clipboard/clipboard_history_resource_manager_unittest.cc +++ b/ash/clipboard/clipboard_history_resource_manager_unittest.cc @@ -135,60 +135,53 @@ TEST_F(ClipboardHistoryResourceManagerTest, GetLabel) { .SetWebSmartPaste(true); // Bitmap data always take precedence. - EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("Image")); + EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"Image"); builder.ClearBitmap(); // In the absence of bitmap data, HTML data takes precedence, but we use // plain-text format for the label. - EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("Text")); + EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"Text"); builder.ClearText(); // If plan-text does not exist, we show a placeholder label. - EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("HTML Content")); + EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"HTML Content"); builder.SetText("Text"); builder.ClearMarkup(); // In the absence of markup data, text data takes precedence. - EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("Text")); + EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"Text"); builder.ClearText(); // In the absence of HTML data, RTF data takes precedence. - EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("RTF Content")); + EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"RTF Content"); builder.ClearRtf(); // In the absence of RTF data, Filenames data takes precedence. - EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("filename")); + EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"filename"); builder.ClearFilenames(); // In the absence of RTF data, bookmark data takes precedence. - EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("Bookmark Title")); + EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), u"Bookmark Title"); builder.ClearBookmarkTitle(); // In the absence of bookmark data, web smart paste data takes precedence. EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("Web Smart Paste Content")); + u"Web Smart Paste Content"); builder.ClearWebSmartPaste(); // In the absence of web smart paste data, file system data takes precedence. // NOTE: File system data is the only kind of custom data currently supported. EXPECT_EQ(resource_manager()->GetLabel(builder.Build()), - base::UTF8ToUTF16("File.txt, Other File.txt")); + u"File.txt, Other File.txt"); } // Tests that Render is called once when an eligible is added @@ -206,7 +199,7 @@ TEST_F(ClipboardHistoryResourceManagerTest, BasicImgCachedImageModel) { // Write a basic ClipboardData which is eligible to render HTML. { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteHTML(base::UTF8ToUTF16(""), "source_url"); + scw.WriteHTML(u"", "source_url"); } FlushMessageLoop(); @@ -230,7 +223,7 @@ TEST_F(ClipboardHistoryResourceManagerTest, BasicTableCachedImageModel) { // Write a basic ClipboardData which is eligible to render HTML. { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteHTML(base::UTF8ToUTF16(""), "source_url"); + scw.WriteHTML(u"
", "source_url"); } FlushMessageLoop(); @@ -254,8 +247,7 @@ TEST_F(ClipboardHistoryResourceManagerTest, BasicIneligibleCachedImageModel) { // Write a basic ClipboardData which is eligible to render HTML. { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteHTML(base::UTF8ToUTF16("html with no img or table tag"), - "source_url"); + scw.WriteHTML(u"html with no img or table tag", "source_url"); } FlushMessageLoop(); @@ -279,12 +271,12 @@ TEST_F(ClipboardHistoryResourceManagerTest, DuplicateHTML) { // to the clipboard history. { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteHTML(base::UTF8ToUTF16(""), "source_url_1"); + scw.WriteHTML(u"", "source_url_1"); } FlushMessageLoop(); { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteHTML(base::UTF8ToUTF16(""), "source_url_2"); + scw.WriteHTML(u"", "source_url_2"); } FlushMessageLoop(); @@ -312,12 +304,12 @@ TEST_F(ClipboardHistoryResourceManagerTest, DifferentHTML) { EXPECT_CALL(*mock_image_factory(), CancelRequest).Times(0); { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteHTML(base::UTF8ToUTF16(""), "source_url"); + scw.WriteHTML(u"", "source_url"); } FlushMessageLoop(); { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteHTML(base::UTF8ToUTF16(""), "source_url"); + scw.WriteHTML(u"", "source_url"); } FlushMessageLoop(); @@ -338,7 +330,7 @@ TEST_F(ClipboardHistoryResourceManagerTest, IneligibleItem) { EXPECT_CALL(*mock_image_factory(), CancelRequest).Times(0); { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteHTML(base::UTF8ToUTF16("test"), "source_url"); + scw.WriteHTML(u"test", "source_url"); scw.WriteImage(GetRandomBitmap()); } FlushMessageLoop(); @@ -350,11 +342,11 @@ TEST_F(ClipboardHistoryResourceManagerTest, IneligibleItem) { { ui::ScopedClipboardWriter scw(ui::ClipboardBuffer::kCopyPaste); - scw.WriteText(base::UTF8ToUTF16("test")); + scw.WriteText(u"test"); scw.WriteRTF("rtf"); - scw.WriteBookmark(base::UTF8ToUTF16("bookmark_title"), "test_url"); + scw.WriteBookmark(u"bookmark_title", "test_url"); } FlushMessageLoop(); diff --git a/ash/clipboard/clipboard_history_unittest.cc b/ash/clipboard/clipboard_history_unittest.cc index 73994eb5c3ca5a..a1b237b92bac67 100644 --- a/ash/clipboard/clipboard_history_unittest.cc +++ b/ash/clipboard/clipboard_history_unittest.cc @@ -162,7 +162,7 @@ TEST_F(ClipboardHistoryTest, NothingCopiedNothingSaved) { // Tests that if one thing is copied, one thing is saved. TEST_F(ClipboardHistoryTest, OneThingCopiedOneThingSaved) { - std::vector input_strings{base::UTF8ToUTF16("test")}; + std::vector input_strings{u"test"}; std::vector expected_strings = input_strings; // Test that only one string is in history. @@ -172,9 +172,8 @@ TEST_F(ClipboardHistoryTest, OneThingCopiedOneThingSaved) { // Tests that if the same (non bitmap) thing is copied, only one of the // duplicates is in the list. TEST_F(ClipboardHistoryTest, DuplicateBasic) { - std::vector input_strings{base::UTF8ToUTF16("test"), - base::UTF8ToUTF16("test")}; - std::vector expected_strings{base::UTF8ToUTF16("test")}; + std::vector input_strings{u"test", u"test"}; + std::vector expected_strings{u"test"}; // Test that both things are saved. WriteAndEnsureTextHistory(input_strings, expected_strings); @@ -183,12 +182,10 @@ TEST_F(ClipboardHistoryTest, DuplicateBasic) { // Tests that if multiple things are copied in the same task sequence, only the // most recent thing is saved. TEST_F(ClipboardHistoryTest, InSameSequenceBasic) { - std::vector input_strings{base::UTF8ToUTF16("test1"), - base::UTF8ToUTF16("test2"), - base::UTF8ToUTF16("test3")}; + std::vector input_strings{u"test1", u"test2", u"test3"}; // Because |input_strings| will be copied in the same task sequence, history // should only retain the most recent thing. - std::vector expected_strings{base::UTF8ToUTF16("test3")}; + std::vector expected_strings{u"test3"}; // Test that only the most recent thing is saved. WriteAndEnsureTextHistory(input_strings, expected_strings, @@ -197,9 +194,8 @@ TEST_F(ClipboardHistoryTest, InSameSequenceBasic) { // Tests the ordering of history is in reverse chronological order. TEST_F(ClipboardHistoryTest, HistoryIsReverseChronological) { - std::vector input_strings{ - base::UTF8ToUTF16("test1"), base::UTF8ToUTF16("test2"), - base::UTF8ToUTF16("test3"), base::UTF8ToUTF16("test4")}; + std::vector input_strings{u"test1", u"test2", u"test3", + u"test4"}; std::vector expected_strings = input_strings; // Reverse the vector, history should match this ordering. std::reverse(std::begin(expected_strings), std::end(expected_strings)); @@ -210,15 +206,12 @@ TEST_F(ClipboardHistoryTest, HistoryIsReverseChronological) { // to the front of the clipboard history. TEST_F(ClipboardHistoryTest, DuplicatePrecedesPreviousRecord) { // Input holds a unique string sandwiched by a copy. - std::vector input_strings{ - base::UTF8ToUTF16("test1"), base::UTF8ToUTF16("test2"), - base::UTF8ToUTF16("test1"), base::UTF8ToUTF16("test3")}; + std::vector input_strings{u"test1", u"test2", u"test1", + u"test3"}; // The result should be a reversal of the copied elements. When a duplicate // is copied, history will have that item moved to the front instead of adding // a new item. - std::vector expected_strings{base::UTF8ToUTF16("test3"), - base::UTF8ToUTF16("test1"), - base::UTF8ToUTF16("test2")}; + std::vector expected_strings{u"test3", u"test1", u"test2"}; WriteAndEnsureTextHistory(input_strings, expected_strings); } @@ -226,9 +219,7 @@ TEST_F(ClipboardHistoryTest, DuplicatePrecedesPreviousRecord) { // Tests that nothing is saved after history is cleared. TEST_F(ClipboardHistoryTest, ClearHistoryBasic) { // Input holds a unique string sandwhiched by a copy. - std::vector input_strings{base::UTF8ToUTF16("test1"), - base::UTF8ToUTF16("test2"), - base::UTF8ToUTF16("test1")}; + std::vector input_strings{u"test1", u"test2", u"test1"}; // The result should be a reversal of the last two elements. When a duplicate // is copied, history will show the most recent version of that duplicate. std::vector expected_strings{}; @@ -250,11 +241,9 @@ TEST_F(ClipboardHistoryTest, ClearHistoryFromClipboardNoHistory) { // Tests that clipboard history is cleared when the clipboard is cleared. TEST_F(ClipboardHistoryTest, ClearHistoryFromClipboardWithHistory) { - std::vector input_strings{base::UTF8ToUTF16("test1"), - base::UTF8ToUTF16("test2")}; + std::vector input_strings{u"test1", u"test2"}; - std::vector expected_strings_before_clear{ - base::UTF8ToUTF16("test2"), base::UTF8ToUTF16("test1")}; + std::vector expected_strings_before_clear{u"test2", u"test1"}; std::vector expected_strings_after_clear{}; for (const auto& input_string : input_strings) { @@ -274,10 +263,8 @@ TEST_F(ClipboardHistoryTest, ClearHistoryFromClipboardWithHistory) { // Tests that the limit of clipboard history is respected. TEST_F(ClipboardHistoryTest, HistoryLimit) { - std::vector input_strings{ - base::UTF8ToUTF16("test1"), base::UTF8ToUTF16("test2"), - base::UTF8ToUTF16("test3"), base::UTF8ToUTF16("test4"), - base::UTF8ToUTF16("test5"), base::UTF8ToUTF16("test6")}; + std::vector input_strings{u"test1", u"test2", u"test3", + u"test4", u"test5", u"test6"}; // The result should be a reversal of the last five elements. std::vector expected_strings{input_strings.begin() + 1, @@ -288,9 +275,7 @@ TEST_F(ClipboardHistoryTest, HistoryLimit) { // Tests that pausing clipboard history results in no history collected. TEST_F(ClipboardHistoryTest, PauseHistory) { - std::vector input_strings{base::UTF8ToUTF16("test1"), - base::UTF8ToUTF16("test2"), - base::UTF8ToUTF16("test1")}; + std::vector input_strings{u"test1", u"test2", u"test1"}; // Because history is paused, there should be nothing stored. std::vector expected_strings{}; @@ -328,10 +313,8 @@ TEST_F(ClipboardHistoryTest, DuplicateBitmap) { // Tests that unrecognized custom data is omitted from clipboard history. TEST_F(ClipboardHistoryTest, BasicCustomData) { const std::unordered_map input_data = { - {base::UTF8ToUTF16("custom-format-1"), - base::UTF8ToUTF16("custom-data-1")}, - {base::UTF8ToUTF16("custom-format-2"), - base::UTF8ToUTF16("custom-data-2")}}; + {u"custom-format-1", u"custom-data-1"}, + {u"custom-format-2", u"custom-data-2"}}; // Custom data which is not recognized is omitted from history. WriteAndEnsureCustomDataHistory(input_data, /*expected_data=*/{}); @@ -340,8 +323,7 @@ TEST_F(ClipboardHistoryTest, BasicCustomData) { // Tests that file system data is recorded in clipboard history. TEST_F(ClipboardHistoryTest, BasicFileSystemData) { const std::unordered_map input_data = { - {base::UTF8ToUTF16("fs/sources"), - base::UTF8ToUTF16("/path/to/My%20File.txt")}}; + {u"fs/sources", u"/path/to/My%20File.txt"}}; const std::unordered_map expected_data = input_data; diff --git a/ash/clipboard/clipboard_history_util_unittest.cc b/ash/clipboard/clipboard_history_util_unittest.cc index 19cb86bc967fa7..4f86410865f354 100644 --- a/ash/clipboard/clipboard_history_util_unittest.cc +++ b/ash/clipboard/clipboard_history_util_unittest.cc @@ -100,7 +100,7 @@ TEST_F(ClipboardHistoryUtilTest, GetFileSystemSources) { builder.SetFileSystemData({"/path/to/My%20File.txt"}); EXPECT_EQ(GetFileSystemSources(builder.Build().data()), - base::UTF8ToUTF16("/path/to/My%20File.txt")); + u"/path/to/My%20File.txt"); } TEST_F(ClipboardHistoryUtilTest, GetSplitFileSystemData) { diff --git a/ash/display/display_util_unittest.cc b/ash/display/display_util_unittest.cc index 05fab342239bef..45a20133663a56 100644 --- a/ash/display/display_util_unittest.cc +++ b/ash/display/display_util_unittest.cc @@ -91,12 +91,12 @@ TEST_F(DisplayUtilTest, RotatedDisplay) { TEST_F(DisplayUtilTest, ConvertRefreshRateToString16) { // Decimal numbers are rounded to two digits. - EXPECT_EQ(base::UTF8ToUTF16("65.98"), ConvertRefreshRateToString16(65.98379)); - EXPECT_EQ(base::UTF8ToUTF16("65.99"), ConvertRefreshRateToString16(65.98779)); + EXPECT_EQ(u"65.98", ConvertRefreshRateToString16(65.98379)); + EXPECT_EQ(u"65.99", ConvertRefreshRateToString16(65.98779)); // Mantissa is removed for whole numbers. - EXPECT_EQ(base::UTF8ToUTF16("58"), ConvertRefreshRateToString16(58.00000)); - EXPECT_EQ(base::UTF8ToUTF16("58"), ConvertRefreshRateToString16(57.99999)); + EXPECT_EQ(u"58", ConvertRefreshRateToString16(58.00000)); + EXPECT_EQ(u"58", ConvertRefreshRateToString16(57.99999)); } } // namespace ash diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 7abaf7240c2e8b..8e4bb407a6a27c 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -95,7 +95,7 @@ class DragTestView : public views::View { } void WriteDragData(const gfx::Point& p, OSExchangeData* data) override { - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); gfx::ImageSkiaRep image_rep(gfx::Size(10, 20), 1.0f); gfx::ImageSkia image_skia(image_rep); data->provider().SetDragImage(image_skia, gfx::Vector2d()); @@ -425,8 +425,7 @@ class DragDropControllerTest : public AshTestBase { void UpdateDragData() { drag_drop_controller_->drag_data_ = std::make_unique(); - drag_drop_controller_->drag_data_->SetString( - base::UTF8ToUTF16("I am being dragged")); + drag_drop_controller_->drag_data_->SetString(u"I am being dragged"); } aura::Window* GetDragWindow() { return drag_drop_controller_->drag_window_; } @@ -512,8 +511,7 @@ TEST_F(DragDropControllerTest, DragDropInSingleViewTest) { EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), drag_drop_controller_->num_drag_updates_); EXPECT_TRUE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view->num_drag_enters_); EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), @@ -591,8 +589,7 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsSingleWidgetTest) { EXPECT_EQ(num_drags - 1 - drag_view1->HorizontalDragThreshold(), drag_drop_controller_->num_drag_updates_); EXPECT_TRUE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view1->num_drag_enters_); int num_expected_updates = @@ -648,8 +645,7 @@ TEST_F(DragDropControllerTest, DragDropInMultipleViewsMultipleWidgetsTest) { EXPECT_EQ(num_drags - 1 - drag_view1->HorizontalDragThreshold(), drag_drop_controller_->num_drag_updates_); EXPECT_TRUE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view1->num_drag_enters_); int num_expected_updates = @@ -708,8 +704,7 @@ TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) { EXPECT_EQ(num_drags_1 + num_drags_2 - 1 - drag_view->VerticalDragThreshold(), drag_drop_controller_->num_drag_updates_); EXPECT_TRUE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view->num_drag_enters_); EXPECT_EQ(num_drags_1 - 1 - drag_view->VerticalDragThreshold(), @@ -837,8 +832,7 @@ TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) { EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), drag_drop_controller_->num_drag_updates_); EXPECT_TRUE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view->num_drag_enters_); EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), @@ -877,8 +871,7 @@ TEST_F(DragDropControllerTest, PressingEscapeCancelsDragDrop) { drag_drop_controller_->num_drag_updates_); EXPECT_FALSE(drag_drop_controller_->drop_received_); EXPECT_TRUE(drag_drop_controller_->drag_canceled_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view->num_drag_enters_); EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), @@ -923,8 +916,7 @@ TEST_F(DragDropControllerTest, CaptureLostCancelsDragDrop) { drag_drop_controller_->num_drag_updates_); EXPECT_FALSE(drag_drop_controller_->drop_received_); EXPECT_TRUE(drag_drop_controller_->drag_canceled_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view->num_drag_enters_); EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), @@ -974,8 +966,7 @@ TEST_F(DragDropControllerTest, TouchDragDropInMultipleWindows) { EXPECT_TRUE(drag_drop_controller_->drag_start_received_); EXPECT_EQ(num_drags, drag_drop_controller_->num_drag_updates_); EXPECT_TRUE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view1->num_drag_enters_); int num_expected_updates = @@ -1011,8 +1002,7 @@ TEST_F(DragDropControllerTest, TouchDragDropCancelsOnLongTap) { EXPECT_TRUE(drag_drop_controller_->drag_canceled_); EXPECT_EQ(0, drag_drop_controller_->num_drag_updates_); EXPECT_FALSE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(0, drag_view->num_drag_enters_); EXPECT_EQ(0, drag_view->num_drops_); EXPECT_EQ(0, drag_view->num_drag_exits_); @@ -1092,8 +1082,7 @@ TEST_F(DragDropControllerTest, DragDropWithChangingIcon) { EXPECT_EQ(num_drags - 1 - drag_view1->HorizontalDragThreshold(), drag_drop_controller_->num_drag_updates_); EXPECT_TRUE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view1->num_drag_enters_); int num_expected_updates = @@ -1142,7 +1131,7 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { { auto data(std::make_unique()); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); std::unique_ptr widget = CreateFramelessWidget(); aura::Window* window = widget->GetNativeWindow(); drag_drop_controller_->StartDragAndDrop( @@ -1176,7 +1165,7 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) { { auto data(std::make_unique()); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); std::unique_ptr widget = CreateFramelessWidget(); aura::Window* window = widget->GetNativeWindow(); drag_drop_controller_->StartDragAndDrop( @@ -1220,7 +1209,7 @@ TEST_F(DragDropControllerTest, DragCancelOnDisplayDisconnect) { } auto data(std::make_unique()); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); std::unique_ptr widget = CreateFramelessWidget(); aura::Window* window = widget->GetNativeWindow(); drag_drop_controller_->StartDragAndDrop( @@ -1290,8 +1279,7 @@ TEST_F(DragDropControllerTest, TouchDragDropCompletesOnFling) { EXPECT_FALSE(drag_drop_controller_->drag_canceled_); EXPECT_EQ(2, drag_drop_controller_->num_drag_updates_); EXPECT_TRUE(drag_drop_controller_->drop_received_); - EXPECT_EQ(base::UTF8ToUTF16("I am being dragged"), - drag_drop_controller_->drag_string_); + EXPECT_EQ(u"I am being dragged", drag_drop_controller_->drag_string_); EXPECT_EQ(1, drag_view->num_drag_enters_); EXPECT_EQ(2, drag_view->num_drag_updates_); EXPECT_EQ(1, drag_view->num_drops_); @@ -1305,7 +1293,7 @@ TEST_F(DragDropControllerTest, DragObserverEvents) { { auto data(std::make_unique()); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); ui::OSExchangeData* data_ptr = data.get(); std::unique_ptr widget = CreateFramelessWidget(); @@ -1348,7 +1336,7 @@ TEST_F(DragDropControllerTest, SetEnabled) { // Data for the drag. auto data(std::make_unique()); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); std::unique_ptr widget = CreateFramelessWidget(); aura::Window* window = widget->GetNativeWindow(); @@ -1387,7 +1375,7 @@ TEST_F(DragDropControllerTest, EventTarget) { drag_drop_controller_->set_should_block_during_drag_drop(true); auto data(std::make_unique()); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); drag_drop_controller_->StartDragAndDrop( std::move(data), window->GetRootWindow(), window.get(), gfx::Point(5, 5), ui::DragDropTypes::DRAG_MOVE, ui::mojom::DragEventSource::kMouse); @@ -1543,7 +1531,7 @@ TEST_F(DragDropControllerTest, DlpAllowDragDrop) { generator.PressLeftButton(); auto data(std::make_unique()); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); // Drag update. EXPECT_CALL(dlp_contoller, IsDragDropAllowed(_, _, /*is_drop=*/false)) @@ -1581,7 +1569,7 @@ TEST_F(DragDropControllerTest, DlpDisallowDragDrop) { generator.PressLeftButton(); auto data(std::make_unique()); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); // Drag update. EXPECT_CALL(dlp_contoller, IsDragDropAllowed(_, _, /*is_drop=*/false)) diff --git a/ash/drag_drop/drag_drop_unittest.cc b/ash/drag_drop/drag_drop_unittest.cc index d6ca769c9e30e0..3f179acaf8232d 100644 --- a/ash/drag_drop/drag_drop_unittest.cc +++ b/ash/drag_drop/drag_drop_unittest.cc @@ -34,7 +34,7 @@ class DraggableView : public views::View { } void WriteDragData(const gfx::Point& press_pt, OSExchangeData* data) override { - data->SetString(base::UTF8ToUTF16("test")); + data->SetString(u"test"); } private: diff --git a/ash/login/ui/lock_contents_view.cc b/ash/login/ui/lock_contents_view.cc index cac31ae5893ff7..21115a29e5a186 100644 --- a/ash/login/ui/lock_contents_view.cc +++ b/ash/login/ui/lock_contents_view.cc @@ -651,7 +651,7 @@ LockContentsView::LockContentsView( detachable_base_error_bubble_->set_persistent(true); tooltip_bubble_ = AddChildView(std::make_unique( - base::UTF8ToUTF16("") /*message*/, nullptr /*anchor_view*/)); + u"" /*message*/, nullptr /*anchor_view*/)); tooltip_bubble_->set_positioning_strategy( LoginBaseBubbleView::PositioningStrategy::kTryBeforeThenAfter); tooltip_bubble_->SetPadding(kHorizontalPaddingLoginTooltipViewDp, diff --git a/ash/login/ui/lock_screen_sanity_unittest.cc b/ash/login/ui/lock_screen_sanity_unittest.cc index eccd4436794217..31f1afd598b41f 100644 --- a/ash/login/ui/lock_screen_sanity_unittest.cc +++ b/ash/login/ui/lock_screen_sanity_unittest.cc @@ -412,7 +412,7 @@ TEST_F(LockScreenSanityTest, RemoveUser) { TEST_F(LockScreenSanityTest, LockScreenKillsPreventsClipboardPaste) { { ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); - writer.WriteText(base::UTF8ToUTF16("password")); + writer.WriteText(u"password"); } ShowLockScreen(); @@ -430,7 +430,7 @@ TEST_F(LockScreenSanityTest, LockScreenKillsPreventsClipboardPaste) { text_input->RequestFocus(); generator->PressKey(ui::KeyboardCode::VKEY_V, ui::EF_CONTROL_DOWN); - EXPECT_EQ(base::UTF8ToUTF16("password"), text_input->GetText()); + EXPECT_EQ(u"password", text_input->GetText()); } } // namespace ash diff --git a/ash/login/ui/login_base_bubble_view_unittest.cc b/ash/login/ui/login_base_bubble_view_unittest.cc index cbd31a68ee7d6a..111c314652a5f9 100644 --- a/ash/login/ui/login_base_bubble_view_unittest.cc +++ b/ash/login/ui/login_base_bubble_view_unittest.cc @@ -37,8 +37,7 @@ class LoginBaseBubbleViewTest : public LoginTestBase { SetWidget(CreateWidgetWithContent(container_)); bubble_ = new LoginBaseBubbleView(anchor_, widget()->GetNativeView()); - auto* label = new views::Label(base::UTF8ToUTF16("A message"), - views::style::CONTEXT_LABEL, + auto* label = new views::Label(u"A message", views::style::CONTEXT_LABEL, views::style::STYLE_PRIMARY); bubble_->SetLayoutManager(std::make_unique( views::BoxLayout::Orientation::kVertical)); diff --git a/ash/login/ui/login_error_bubble_unittest.cc b/ash/login/ui/login_error_bubble_unittest.cc index 8cb5ffb893a8b0..fc210f2884fc9f 100644 --- a/ash/login/ui/login_error_bubble_unittest.cc +++ b/ash/login/ui/login_error_bubble_unittest.cc @@ -22,8 +22,7 @@ TEST_F(LoginErrorBubbleTest, PersistentEventHandling) { auto* anchor_view = new views::View; container->AddChildView(anchor_view); - auto* label = new views::Label(base::UTF8ToUTF16("A message"), - views::style::CONTEXT_LABEL, + auto* label = new views::Label(u"A message", views::style::CONTEXT_LABEL, views::style::STYLE_PRIMARY); auto* bubble = new LoginErrorBubble(label /*content*/, anchor_view); diff --git a/ash/login/ui/login_pin_input_view.cc b/ash/login/ui/login_pin_input_view.cc index 42fd4aa2d4fb61..e4a79d87acacfc 100644 --- a/ash/login/ui/login_pin_input_view.cc +++ b/ash/login/ui/login_pin_input_view.cc @@ -266,7 +266,7 @@ bool LoginPinInputView::OnKeyPressed(const ui::KeyEvent& event) { // when the last digit is inserted. if (event.key_code() == ui::KeyboardCode::VKEY_RETURN && !is_read_only_ && authenticate_with_empty_pin_on_return_key_) { - SubmitPin(base::UTF8ToUTF16("")); + SubmitPin(u""); return true; } diff --git a/ash/projector/projector_controller_unittest.cc b/ash/projector/projector_controller_unittest.cc index 7fa769f1227837..43282b2dd8cee0 100644 --- a/ash/projector/projector_controller_unittest.cc +++ b/ash/projector/projector_controller_unittest.cc @@ -32,7 +32,7 @@ using testing::ElementsAre; void NotifyControllerForFinalSpeechResult(ProjectorControllerImpl* controller) { controller->OnTranscription( - base::UTF8ToUTF16("transcript text 1"), + u"transcript text 1", base::TimeDelta::FromMilliseconds(0) /* audio_start_time */, base::TimeDelta::FromMilliseconds(3000) /* audio_end_time */, {{base::TimeDelta::FromMilliseconds(1000), @@ -44,7 +44,7 @@ void NotifyControllerForFinalSpeechResult(ProjectorControllerImpl* controller) { void NotifyControllerForPartialSpeechResult( ProjectorControllerImpl* controller) { controller->OnTranscription( - base::UTF8ToUTF16("transcript partial text 1"), + u"transcript partial text 1", base::TimeDelta::FromMilliseconds(0) /* audio_start_time */, base::TimeDelta::FromMilliseconds(3000) /* audio_end_time */, {{base::TimeDelta::FromMilliseconds(1000), diff --git a/ash/public/cpp/external_arc/message_center/arc_notification_content_view_unittest.cc b/ash/public/cpp/external_arc/message_center/arc_notification_content_view_unittest.cc index 48ce5c9e964642..f54485c34b09ec 100644 --- a/ash/public/cpp/external_arc/message_center/arc_notification_content_view_unittest.cc +++ b/ash/public/cpp/external_arc/message_center/arc_notification_content_view_unittest.cc @@ -224,9 +224,8 @@ class ArcNotificationContentViewTest : public AshTestBase { message_center::SettingsButtonHandler::DELEGATE; Notification notification( message_center::NOTIFICATION_TYPE_CUSTOM, - notification_item->GetNotificationId(), base::UTF8ToUTF16("title"), - base::UTF8ToUTF16("message"), gfx::Image(), base::UTF8ToUTF16("arc"), - GURL(), + notification_item->GetNotificationId(), u"title", u"message", + gfx::Image(), u"arc", GURL(), message_center::NotifierId( message_center::NotifierType::ARC_APPLICATION, "ARC_NOTIFICATION"), optional_fields, @@ -325,9 +324,8 @@ TEST_F(ArcNotificationContentViewTest, CloseButton) { // ARC to avoid surface shutdown issues. auto mc_notification = std::make_unique( message_center::NOTIFICATION_TYPE_SIMPLE, - notification_item->GetNotificationId(), base::UTF8ToUTF16("title"), - base::UTF8ToUTF16("message"), gfx::Image(), base::UTF8ToUTF16("arc"), - GURL(), + notification_item->GetNotificationId(), u"title", u"message", + gfx::Image(), u"arc", GURL(), message_center::NotifierId(message_center::NotifierType::ARC_APPLICATION, "ARC_NOTIFICATION"), message_center::RichNotificationData(), nullptr); diff --git a/ash/public/cpp/external_arc/message_center/arc_notification_item_impl.cc b/ash/public/cpp/external_arc/message_center/arc_notification_item_impl.cc index 185cae9984fdfd..7d1a5646f52c5a 100644 --- a/ash/public/cpp/external_arc/message_center/arc_notification_item_impl.cc +++ b/ash/public/cpp/external_arc/message_center/arc_notification_item_impl.cc @@ -120,8 +120,8 @@ void ArcNotificationItemImpl::OnUpdatedFromAndroid( message_center::NOTIFICATION_TYPE_CUSTOM, notification_id_, base::UTF8ToUTF16(data->title), base::UTF8ToUTF16(data->message), gfx::Image(), - base::UTF8ToUTF16("arc"), // display source - GURL(), // empty origin url, for system component + u"arc", // display source + GURL(), // empty origin url, for system component notifier_id, rich_data, new ArcNotificationDelegate(weak_ptr_factory_.GetWeakPtr())); notification->set_timestamp(base::Time::FromJavaTime(data->time)); diff --git a/ash/public/cpp/external_arc/message_center/arc_notification_view_unittest.cc b/ash/public/cpp/external_arc/message_center/arc_notification_view_unittest.cc index 7ef35cd32e5942..4841cc49a96b2a 100644 --- a/ash/public/cpp/external_arc/message_center/arc_notification_view_unittest.cc +++ b/ash/public/cpp/external_arc/message_center/arc_notification_view_unittest.cc @@ -105,8 +105,7 @@ class ArcNotificationViewTest : public AshTestBase { std::unique_ptr CreateSimpleNotification() { std::unique_ptr notification = std::make_unique( message_center::NOTIFICATION_TYPE_CUSTOM, kDefaultNotificationId, - base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), gfx::Image(), - base::UTF8ToUTF16("display source"), GURL(), + u"title", u"message", gfx::Image(), u"display source", GURL(), message_center::NotifierId( message_center::NotifierType::ARC_APPLICATION, "test_app_id"), message_center::RichNotificationData(), nullptr); @@ -301,8 +300,7 @@ TEST_F(ArcNotificationViewTest, SnoozeButton) { rich_data.should_show_snooze_button = true; std::unique_ptr notification = std::make_unique( message_center::NOTIFICATION_TYPE_CUSTOM, kDefaultNotificationId, - base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), gfx::Image(), - base::UTF8ToUTF16("display source"), GURL(), + u"title", u"message", gfx::Image(), u"display source", GURL(), message_center::NotifierId(message_center::NotifierType::ARC_APPLICATION, "test_app_id"), rich_data, nullptr); diff --git a/ash/system/ime_menu/ime_menu_tray.cc b/ash/system/ime_menu/ime_menu_tray.cc index 87b9df9f1b89c0..ad1198c1d8ea20 100644 --- a/ash/system/ime_menu/ime_menu_tray.cc +++ b/ash/system/ime_menu/ime_menu_tray.cc @@ -548,7 +548,7 @@ void ImeMenuTray::UpdateTrayLabel() { AshColorProvider::ContentLayerType::kIconColorPrimary)); if (current_ime.third_party) - label_->SetText(current_ime.short_name + base::UTF8ToUTF16("*")); + label_->SetText(current_ime.short_name + u"*"); else label_->SetText(current_ime.short_name); } diff --git a/ash/system/ime_menu/ime_menu_tray_unittest.cc b/ash/system/ime_menu/ime_menu_tray_unittest.cc index 03f3be0a0d842b..04f6cac0ef1742 100644 --- a/ash/system/ime_menu/ime_menu_tray_unittest.cc +++ b/ash/system/ime_menu/ime_menu_tray_unittest.cc @@ -134,23 +134,23 @@ TEST_F(ImeMenuTrayTest, TrayLabelTest) { ImeInfo info1; info1.id = "ime1"; - info1.name = UTF8ToUTF16("English"); - info1.short_name = UTF8ToUTF16("US"); + info1.name = u"English"; + info1.short_name = u"US"; info1.third_party = false; ImeInfo info2; info2.id = "ime2"; - info2.name = UTF8ToUTF16("English UK"); - info2.short_name = UTF8ToUTF16("UK"); + info2.name = u"English UK"; + info2.short_name = u"UK"; info2.third_party = true; // Changes the input method to "ime1". SetCurrentIme("ime1", {info1, info2}); - EXPECT_EQ(UTF8ToUTF16("US"), GetTrayText()); + EXPECT_EQ(u"US", GetTrayText()); // Changes the input method to a third-party IME extension. SetCurrentIme("ime2", {info1, info2}); - EXPECT_EQ(UTF8ToUTF16("UK*"), GetTrayText()); + EXPECT_EQ(u"UK*", GetTrayText()); } // Tests that IME menu tray changes background color when tapped/clicked. And @@ -202,30 +202,30 @@ TEST_F(ImeMenuTrayTest, RefreshImeWithListViewCreated) { ImeInfo info1, info2, info3; info1.id = "ime1"; - info1.name = UTF8ToUTF16("English"); - info1.short_name = UTF8ToUTF16("US"); + info1.name = u"English"; + info1.short_name = u"US"; info1.third_party = false; info2.id = "ime2"; - info2.name = UTF8ToUTF16("English UK"); - info2.short_name = UTF8ToUTF16("UK"); + info2.name = u"English UK"; + info2.short_name = u"UK"; info2.third_party = true; info3.id = "ime3"; - info3.name = UTF8ToUTF16("Pinyin"); - info3.short_name = UTF8ToUTF16("拼"); + info3.name = u"Pinyin"; + info3.short_name = u"拼"; info3.third_party = false; std::vector ime_info_list{info1, info2, info3}; // Switch to ime1. SetCurrentIme("ime1", ime_info_list); - EXPECT_EQ(UTF8ToUTF16("US"), GetTrayText()); + EXPECT_EQ(u"US", GetTrayText()); ExpectValidImeList(ime_info_list, info1); // Switch to ime3. SetCurrentIme("ime3", ime_info_list); - EXPECT_EQ(UTF8ToUTF16("拼"), GetTrayText()); + EXPECT_EQ(u"拼", GetTrayText()); ExpectValidImeList(ime_info_list, info3); // Closes the menu before quitting. diff --git a/ash/system/locale/locale_feature_pod_controller_unittest.cc b/ash/system/locale/locale_feature_pod_controller_unittest.cc index de9ae214c63ccb..ff7d40cf7e4598 100644 --- a/ash/system/locale/locale_feature_pod_controller_unittest.cc +++ b/ash/system/locale/locale_feature_pod_controller_unittest.cc @@ -66,8 +66,7 @@ TEST_F(LocaleFeaturePodControllerTest, ButtonVisibility) { // The button is visible if the locale list is non-empty. std::vector locale_list; - locale_list.emplace_back(kDefaultLocaleIsoCode, - base::UTF8ToUTF16("English (United States)")); + locale_list.emplace_back(kDefaultLocaleIsoCode, u"English (United States)"); Shell::Get()->system_tray_model()->SetLocaleList(std::move(locale_list), kDefaultLocaleIsoCode); button.reset(controller_->CreateButton()); diff --git a/ash/system/message_center/ash_message_popup_collection_unittest.cc b/ash/system/message_center/ash_message_popup_collection_unittest.cc index 92f87d4310a26b..9e5f5e67cc69ab 100644 --- a/ash/system/message_center/ash_message_popup_collection_unittest.cc +++ b/ash/system/message_center/ash_message_popup_collection_unittest.cc @@ -127,10 +127,10 @@ class AshMessagePopupCollectionTest : public AshTestBase { std::unique_ptr CreateNotification( const std::string& id) { return std::make_unique( - message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, - base::UTF8ToUTF16("test_title"), base::UTF8ToUTF16("test message"), - gfx::Image(), std::u16string() /* display_source */, GURL(), - message_center::NotifierId(), message_center::RichNotificationData(), + message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, u"test_title", + u"test message", gfx::Image(), std::u16string() /* display_source */, + GURL(), message_center::NotifierId(), + message_center::RichNotificationData(), new message_center::NotificationDelegate()); } diff --git a/ash/system/message_center/inactive_user_notification_blocker_unittest.cc b/ash/system/message_center/inactive_user_notification_blocker_unittest.cc index 2f542d28662a7c..de307a12a503b3 100644 --- a/ash/system/message_center/inactive_user_notification_blocker_unittest.cc +++ b/ash/system/message_center/inactive_user_notification_blocker_unittest.cc @@ -75,10 +75,9 @@ class InactiveUserNotificationBlockerTest id_with_profile.profile_id = profile_id; message_center::Notification notification( - message_center::NOTIFICATION_TYPE_SIMPLE, "popup-id", - UTF8ToUTF16("popup-title"), UTF8ToUTF16("popup-message"), gfx::Image(), - UTF8ToUTF16("popup-source"), GURL(), id_with_profile, - message_center::RichNotificationData(), nullptr); + message_center::NOTIFICATION_TYPE_SIMPLE, "popup-id", u"popup-title", + u"popup-message", gfx::Image(), u"popup-source", GURL(), + id_with_profile, message_center::RichNotificationData(), nullptr); if (notifier_id.id == kNotifierSystemPriority) notification.set_priority(message_center::SYSTEM_PRIORITY); @@ -93,9 +92,9 @@ class InactiveUserNotificationBlockerTest message_center::Notification notification( message_center::NOTIFICATION_TYPE_SIMPLE, "notification-id", - UTF8ToUTF16("notification-title"), UTF8ToUTF16("notification-message"), - gfx::Image(), UTF8ToUTF16("notification-source"), GURL(), - id_with_profile, message_center::RichNotificationData(), nullptr); + u"notification-title", u"notification-message", gfx::Image(), + u"notification-source", GURL(), id_with_profile, + message_center::RichNotificationData(), nullptr); if (notifier_id.id == kNotifierSystemPriority) notification.set_priority(message_center::SYSTEM_PRIORITY); diff --git a/ash/system/message_center/message_center_utils_unittest.cc b/ash/system/message_center/message_center_utils_unittest.cc index caac335bdee06c..d9dd375c57888b 100644 --- a/ash/system/message_center/message_center_utils_unittest.cc +++ b/ash/system/message_center/message_center_utils_unittest.cc @@ -21,8 +21,8 @@ void AddNotification(const std::string& notification_id, message_center::MessageCenter::Get()->AddNotification( std::make_unique( message_center::NOTIFICATION_TYPE_BASE_FORMAT, notification_id, - base::UTF8ToUTF16("test_title"), base::UTF8ToUTF16("test message"), - gfx::Image(), /*display_source=*/std::u16string(), GURL(), + u"test_title", u"test message", gfx::Image(), + /*display_source=*/std::u16string(), GURL(), message_center::NotifierId(message_center::NotifierType::APPLICATION, app_id), message_center::RichNotificationData(), diff --git a/ash/system/message_center/notification_swipe_control_view_unittest.cc b/ash/system/message_center/notification_swipe_control_view_unittest.cc index 6a0ac1b85fd84a..03a3240f623033 100644 --- a/ash/system/message_center/notification_swipe_control_view_unittest.cc +++ b/ash/system/message_center/notification_swipe_control_view_unittest.cc @@ -72,9 +72,8 @@ class NotificationSwipeControlViewTest : public testing::Test { message_center::SettingsButtonHandler::DELEGATE; rich_data.should_show_snooze_button = true; message_center::Notification notification( - message_center::NOTIFICATION_TYPE_SIMPLE, "id", - base::UTF8ToUTF16("title"), base::UTF8ToUTF16("id"), gfx::Image(), - std::u16string(), GURL(), + message_center::NOTIFICATION_TYPE_SIMPLE, "id", u"title", u"id", + gfx::Image(), std::u16string(), GURL(), message_center::NotifierId(message_center::NotifierType::APPLICATION, "notifier_id"), rich_data, nullptr); diff --git a/ash/system/message_center/session_state_notification_blocker_unittest.cc b/ash/system/message_center/session_state_notification_blocker_unittest.cc index 7806a1ea01928e..a60efefaf37cf4 100644 --- a/ash/system/message_center/session_state_notification_blocker_unittest.cc +++ b/ash/system/message_center/session_state_notification_blocker_unittest.cc @@ -60,8 +60,8 @@ class SessionStateNotificationBlockerTest const message_center::NotifierId& notifier_id) { message_center::Notification notification( message_center::NOTIFICATION_TYPE_SIMPLE, "chromeos-id", - UTF8ToUTF16("chromeos-title"), UTF8ToUTF16("chromeos-message"), - gfx::Image(), UTF8ToUTF16("chromeos-source"), GURL(), notifier_id, + u"chromeos-title", u"chromeos-message", gfx::Image(), + u"chromeos-source", GURL(), notifier_id, message_center::RichNotificationData(), nullptr); if (notifier_id.id == kNotifierSystemPriority) notification.set_priority(message_center::SYSTEM_PRIORITY); diff --git a/ash/system/message_center/unified_message_center_bubble_unittest.cc b/ash/system/message_center/unified_message_center_bubble_unittest.cc index 70b447cf2a087b..747f10134135c6 100644 --- a/ash/system/message_center/unified_message_center_bubble_unittest.cc +++ b/ash/system/message_center/unified_message_center_bubble_unittest.cc @@ -38,10 +38,10 @@ class UnifiedMessageCenterBubbleTest : public AshTestBase { std::string AddNotification() { std::string id = base::NumberToString(id_++); MessageCenter::Get()->AddNotification(std::make_unique( - message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, - base::UTF8ToUTF16("test title"), base::UTF8ToUTF16("test message"), - gfx::Image(), std::u16string() /* display_source */, GURL(), - message_center::NotifierId(), message_center::RichNotificationData(), + message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, u"test title", + u"test message", gfx::Image(), std::u16string() /* display_source */, + GURL(), message_center::NotifierId(), + message_center::RichNotificationData(), new message_center::NotificationDelegate())); return id; } diff --git a/ash/system/message_center/unified_message_center_view_unittest.cc b/ash/system/message_center/unified_message_center_view_unittest.cc index 37e028c9fa797c..9ea06e210619fd 100644 --- a/ash/system/message_center/unified_message_center_view_unittest.cc +++ b/ash/system/message_center/unified_message_center_view_unittest.cc @@ -90,10 +90,9 @@ class UnifiedMessageCenterViewTest : public AshTestBase, message_center::RichNotificationData data; data.pinned = pinned; MessageCenter::Get()->AddNotification(std::make_unique( - message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, - base::UTF8ToUTF16("test title"), base::UTF8ToUTF16("test message"), - gfx::Image(), std::u16string() /* display_source */, GURL(), - message_center::NotifierId(), data, + message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, u"test title", + u"test message", gfx::Image(), std::u16string() /* display_source */, + GURL(), message_center::NotifierId(), data, new message_center::NotificationDelegate())); return id; } diff --git a/ash/system/message_center/unified_message_list_view_unittest.cc b/ash/system/message_center/unified_message_list_view_unittest.cc index eab55fd078c5bf..31fb2afc17630e 100644 --- a/ash/system/message_center/unified_message_list_view_unittest.cc +++ b/ash/system/message_center/unified_message_list_view_unittest.cc @@ -65,10 +65,10 @@ class TestUnifiedMessageListView : public UnifiedMessageListView { for (int i = 0; i < stacked_notification_count; i++) { std::string id = base::NumberToString(0); auto notification = std::make_unique( - message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, - base::UTF8ToUTF16("test title"), base::UTF8ToUTF16("test message"), - gfx::Image(), std::u16string() /* display_source */, GURL(), - message_center::NotifierId(), message_center::RichNotificationData(), + message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, u"test title", + u"test message", gfx::Image(), std::u16string() /* display_source */, + GURL(), message_center::NotifierId(), + message_center::RichNotificationData(), new message_center::NotificationDelegate()); stacked_notifications_.push_back(notification.get()); @@ -125,10 +125,10 @@ class UnifiedMessageListViewTest : public AshTestBase, std::string AddNotification(bool pinned = false) { std::string id = base::NumberToString(id_++); auto notification = std::make_unique( - message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, - base::UTF8ToUTF16("test title"), base::UTF8ToUTF16("test message"), - gfx::Image(), std::u16string() /* display_source */, GURL(), - message_center::NotifierId(), message_center::RichNotificationData(), + message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, u"test title", + u"test message", gfx::Image(), std::u16string() /* display_source */, + GURL(), message_center::NotifierId(), + message_center::RichNotificationData(), new message_center::NotificationDelegate()); notification->set_pinned(pinned); MessageCenter::Get()->AddNotification(std::move(notification)); diff --git a/ash/system/phonehub/phone_hub_notification_controller_unittest.cc b/ash/system/phonehub/phone_hub_notification_controller_unittest.cc index 7e5523959ac382..4571c3598540b1 100644 --- a/ash/system/phonehub/phone_hub_notification_controller_unittest.cc +++ b/ash/system/phonehub/phone_hub_notification_controller_unittest.cc @@ -179,8 +179,8 @@ TEST_F(PhoneHubNotificationControllerTest, CloseByUser) { TEST_F(PhoneHubNotificationControllerTest, InlineReply) { notification_manager_->SetNotificationsInternal(fake_notifications_); - const std::u16string kInlineReply0 = base::UTF8ToUTF16("inline reply 0"); - const std::u16string kInlineReply1 = base::UTF8ToUTF16("inline reply 1"); + const std::u16string kInlineReply0 = u"inline reply 0"; + const std::u16string kInlineReply1 = u"inline reply 1"; message_center_->ClickOnNotificationButtonWithReply(kCrOSNotificationId0, 0, kInlineReply0); message_center_->ClickOnNotificationButtonWithReply(kCrOSNotificationId1, 0, @@ -267,7 +267,7 @@ TEST_F(PhoneHubNotificationControllerTest, NotificationHasPhoneName) { notification_manager_->SetNotificationsInternal(fake_notifications_); auto* notification = FindNotification(kCrOSNotificationId0); - const std::u16string expected_phone_name = base::UTF8ToUTF16("Phone name"); + const std::u16string expected_phone_name = u"Phone name"; phone_hub_manager_.mutable_phone_model()->SetPhoneName(expected_phone_name); auto notification_view = @@ -297,7 +297,7 @@ TEST_F(PhoneHubNotificationControllerTest, ReplyBrieflyDisabled) { views::View* reply_button = action_buttons_row->children()[0]; // Initially, reply button should be disabled after replied. - const std::u16string kInlineReply0 = base::UTF8ToUTF16("inline reply 0"); + const std::u16string kInlineReply0 = u"inline reply 0"; notification_view_md->OnNotificationInputSubmit(0, kInlineReply0); EXPECT_FALSE(reply_button->GetEnabled()); @@ -367,7 +367,7 @@ TEST_F(PhoneHubNotificationControllerTest, DoNotReshowPopupNotification) { base::Time::Now(), chromeos::phonehub::Notification::Importance::kHigh, /*inline_reply_id=*/0, chromeos::phonehub::Notification::InteractionBehavior::kNone, - base::UTF8ToUTF16(kTitle), base::UTF8ToUTF16("New text")); + base::UTF8ToUTF16(kTitle), u"New text"); // Update the existingt notification; the priority should be MAX_PRIORITY, and // renotify should be true. diff --git a/ash/system/phonehub/phone_status_view_unittest.cc b/ash/system/phonehub/phone_status_view_unittest.cc index 328beb4e206c65..330c7109ae0689 100644 --- a/ash/system/phonehub/phone_status_view_unittest.cc +++ b/ash/system/phonehub/phone_status_view_unittest.cc @@ -61,9 +61,9 @@ class PhoneStatusViewTest : public AshTestBase, }; TEST_F(PhoneStatusViewTest, PhoneStatusLabelsContent) { - std::u16string expected_name_text = base::UTF8ToUTF16("Test Phone Name"); - std::u16string expected_provider_text = base::UTF8ToUTF16("Test Provider"); - std::u16string expected_battery_text = base::UTF8ToUTF16("10%"); + std::u16string expected_name_text = u"Test Phone Name"; + std::u16string expected_provider_text = u"Test Provider"; + std::u16string expected_battery_text = u"10%"; phone_model_.SetPhoneName(expected_name_text); @@ -81,9 +81,9 @@ TEST_F(PhoneStatusViewTest, PhoneStatusLabelsContent) { EXPECT_EQ(expected_name_text, status_view_->phone_name_label_->GetText()); EXPECT_EQ(expected_battery_text, status_view_->battery_label_->GetText()); - expected_name_text = base::UTF8ToUTF16("New Phone Name"); - expected_provider_text = base::UTF8ToUTF16("New Provider"); - expected_battery_text = base::UTF8ToUTF16("20%"); + expected_name_text = u"New Phone Name"; + expected_provider_text = u"New Provider"; + expected_battery_text = u"20%"; phone_model_.SetPhoneName(expected_name_text); metadata.mobile_provider = expected_provider_text; diff --git a/ash/system/screen_layout_observer.cc b/ash/system/screen_layout_observer.cc index 2ff5f9ec704dd7..eae1e70a0a3c08 100644 --- a/ash/system/screen_layout_observer.cc +++ b/ash/system/screen_layout_observer.cc @@ -147,7 +147,7 @@ std::u16string GetEnterMirrorModeMessage() { for (auto& id : GetDisplayManager()->GetMirroringDestinationDisplayIdList()) { if (!display_names.empty()) - display_names.append(base::UTF8ToUTF16(",")); + display_names.append(u","); display_names.append(GetDisplayName(id)); } return l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_MIRRORING, diff --git a/ash/system/screen_layout_observer_unittest.cc b/ash/system/screen_layout_observer_unittest.cc index 418b49e630d372..0553c642108267 100644 --- a/ash/system/screen_layout_observer_unittest.cc +++ b/ash/system/screen_layout_observer_unittest.cc @@ -123,7 +123,7 @@ std::u16string ScreenLayoutObserverTest::GetMirroringDisplayNames() { std::u16string display_names; for (auto& id : display_manager()->GetMirroringDestinationDisplayIdList()) { if (!display_names.empty()) - display_names.append(base::UTF8ToUTF16(",")); + display_names.append(u","); display_names.append( base::UTF8ToUTF16(display_manager()->GetDisplayNameForId(id))); } @@ -377,20 +377,20 @@ TEST_F(ScreenLayoutObserverTest, ZoomingInUnifiedModeNotification) { CloseNotification(); int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id(); EXPECT_TRUE(display_manager()->ZoomDisplay(display_id, false /* up */)); - EXPECT_EQ(l10n_util::GetStringFUTF16( - IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, - GetUnifiedDisplayName(), base::UTF8ToUTF16("400x200")), - GetDisplayNotificationAdditionalText()); + EXPECT_EQ( + l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, + GetUnifiedDisplayName(), u"400x200"), + GetDisplayNotificationAdditionalText()); EXPECT_EQ(l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED_TITLE), GetDisplayNotificationText()); CloseNotification(); EXPECT_TRUE(display_manager()->ZoomDisplay(display_id, true /* up */)); - EXPECT_EQ(l10n_util::GetStringFUTF16( - IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, - GetUnifiedDisplayName(), base::UTF8ToUTF16("800x400")), - GetDisplayNotificationAdditionalText()); + EXPECT_EQ( + l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED, + GetUnifiedDisplayName(), u"800x400"), + GetDisplayNotificationAdditionalText()); EXPECT_EQ(l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_DISPLAY_RESOLUTION_CHANGED_TITLE), GetDisplayNotificationText()); @@ -426,8 +426,7 @@ TEST_F(ScreenLayoutObserverTest, DisplayConfigurationChangedTwice) { UpdateDisplay("400x400"); EXPECT_TRUE(base::StartsWith( GetDisplayNotificationText(), - l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_REMOVED, - base::UTF8ToUTF16("")), + l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_REMOVED, u""), base::CompareCase::SENSITIVE)); } @@ -530,8 +529,7 @@ TEST_F(ScreenLayoutObserverTest, AddingRemovingDisplayExtendedModeMessage) { UpdateDisplay("400x400"); EXPECT_TRUE(base::StartsWith( GetDisplayNotificationText(), - l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_REMOVED, - base::UTF8ToUTF16("")), + l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_REMOVED, u""), base::CompareCase::SENSITIVE)); } diff --git a/ash/system/tray/tray_event_filter_unittest.cc b/ash/system/tray/tray_event_filter_unittest.cc index 77c643f52cb4cd..3df2f2d1f06426 100644 --- a/ash/system/tray/tray_event_filter_unittest.cc +++ b/ash/system/tray/tray_event_filter_unittest.cc @@ -62,8 +62,8 @@ class TrayEventFilterTest : public AshTestBase { std::string notification_id = base::NumberToString(notification_id_++); MessageCenter::Get()->AddNotification(std::make_unique( message_center::NOTIFICATION_TYPE_BASE_FORMAT, notification_id, - base::UTF8ToUTF16("test title"), base::UTF8ToUTF16("test message"), - gfx::Image(), std::u16string() /* display_source */, GURL(), + u"test title", u"test message", gfx::Image(), + std::u16string() /* display_source */, GURL(), message_center::NotifierId(), message_center::RichNotificationData(), new message_center::NotificationDelegate())); return notification_id; diff --git a/ash/system/unified/notification_counter_view_unittest.cc b/ash/system/unified/notification_counter_view_unittest.cc index 08b9c4f66060f6..e0544bead4e8fd 100644 --- a/ash/system/unified/notification_counter_view_unittest.cc +++ b/ash/system/unified/notification_counter_view_unittest.cc @@ -29,8 +29,8 @@ void AddNotification(const std::string& notification_id, message_center::MessageCenter::Get()->AddNotification( std::make_unique( message_center::NOTIFICATION_TYPE_BASE_FORMAT, notification_id, - base::UTF8ToUTF16("test_title"), base::UTF8ToUTF16("test message"), - gfx::Image(), /*display_source=*/std::u16string(), GURL(), + u"test_title", u"test message", gfx::Image(), + /*display_source=*/std::u16string(), GURL(), message_center::NotifierId(message_center::NotifierType::APPLICATION, "app"), rich_notification_data, new message_center::NotificationDelegate())); diff --git a/ash/system/unified/notification_icons_controller_unittest.cc b/ash/system/unified/notification_icons_controller_unittest.cc index cf6c22c1bdaee4..920d1b03de63a6 100644 --- a/ash/system/unified/notification_icons_controller_unittest.cc +++ b/ash/system/unified/notification_icons_controller_unittest.cc @@ -68,9 +68,9 @@ class NotificationIconsControllerTest message_center::MessageCenter::Get()->AddNotification( CreateSystemNotification( - message_center::NOTIFICATION_TYPE_SIMPLE, id, - base::UTF8ToUTF16("test_title"), base::UTF8ToUTF16("test message"), - std::u16string() /*display_source */, GURL() /* origin_url */, + message_center::NOTIFICATION_TYPE_SIMPLE, id, u"test_title", + u"test message", std::u16string() /*display_source */, + GURL() /* origin_url */, message_center::NotifierId( message_center::NotifierType::SYSTEM_COMPONENT, app_id), rich_notification_data, nullptr /* delegate */, gfx::VectorIcon(), diff --git a/ash/wm/desks/desks_unittests.cc b/ash/wm/desks/desks_unittests.cc index e30b2440b0842a..240098329c5441 100644 --- a/ash/wm/desks/desks_unittests.cc +++ b/ash/wm/desks/desks_unittests.cc @@ -1998,8 +1998,8 @@ TEST_F(DesksEditableNamesTest, NamesSetByUsersAreNotOverwritten) { // Extra whitespace should be trimmed. auto* desk_1 = controller()->desks()[0].get(); auto* desk_2 = controller()->desks()[1].get(); - EXPECT_EQ(base::UTF8ToUTF16("code"), desk_1->name()); - EXPECT_EQ(base::UTF8ToUTF16("Desk 2"), desk_2->name()); + EXPECT_EQ(u"code", desk_1->name()); + EXPECT_EQ(u"Desk 2", desk_2->name()); EXPECT_TRUE(desk_1->is_name_set_by_user()); EXPECT_FALSE(desk_2->is_name_set_by_user()); @@ -2012,7 +2012,7 @@ TEST_F(DesksEditableNamesTest, NamesSetByUsersAreNotOverwritten) { // the user-modified desk names. NewDesk(); auto* desk_3 = controller()->desks()[2].get(); - EXPECT_EQ(base::UTF8ToUTF16("Desk 3"), desk_3->name()); + EXPECT_EQ(u"Desk 3", desk_3->name()); EXPECT_TRUE(desk_1->is_name_set_by_user()); EXPECT_FALSE(desk_2->is_name_set_by_user()); EXPECT_FALSE(desk_3->is_name_set_by_user()); @@ -2025,7 +2025,7 @@ TEST_F(DesksEditableNamesTest, NamesSetByUsersAreNotOverwritten) { EXPECT_TRUE(desk_1->is_name_set_by_user()); EXPECT_FALSE(desk_3->is_name_set_by_user()); // Desk 3 will now be renamed to "Desk 2". - EXPECT_EQ(base::UTF8ToUTF16("Desk 2"), desk_3->name()); + EXPECT_EQ(u"Desk 2", desk_3->name()); VerifyDesksRestoreData(GetPrimaryUserPrefService(), {std::string("code"), std::string()}); @@ -2033,8 +2033,8 @@ TEST_F(DesksEditableNamesTest, NamesSetByUsersAreNotOverwritten) { overview_controller->StartOverview(); EXPECT_TRUE(desk_1->is_name_set_by_user()); EXPECT_FALSE(desk_3->is_name_set_by_user()); - EXPECT_EQ(base::UTF8ToUTF16("code"), desk_1->name()); - EXPECT_EQ(base::UTF8ToUTF16("Desk 2"), desk_3->name()); + EXPECT_EQ(u"code", desk_1->name()); + EXPECT_EQ(u"Desk 2", desk_3->name()); } TEST_F(DesksEditableNamesTest, DontAllowEmptyNames) { @@ -2055,7 +2055,7 @@ TEST_F(DesksEditableNamesTest, DontAllowEmptyNames) { // The name should now revert back to the default value. EXPECT_FALSE(desk_1->name().empty()); EXPECT_FALSE(desk_1->is_name_set_by_user()); - EXPECT_EQ(base::UTF8ToUTF16("Desk 1"), desk_1->name()); + EXPECT_EQ(u"Desk 1", desk_1->name()); VerifyDesksRestoreData(GetPrimaryUserPrefService(), {std::string(), std::string()}); } @@ -3360,9 +3360,9 @@ TEST_P(DesksRestoreMultiUserTest, DesksRestoredFromPrimaryUserPrefsOnly) { auto verify_desks = [&](const std::string& trace_name) { SCOPED_TRACE(trace_name); EXPECT_EQ(3u, desks.size()); - EXPECT_EQ(base::UTF8ToUTF16("Desk 1"), desks[0]->name()); - EXPECT_EQ(base::UTF8ToUTF16("Desk 2"), desks[1]->name()); - EXPECT_EQ(base::UTF8ToUTF16("code"), desks[2]->name()); + EXPECT_EQ(u"Desk 1", desks[0]->name()); + EXPECT_EQ(u"Desk 2", desks[1]->name()); + EXPECT_EQ(u"code", desks[2]->name()); // Restored non-default names should be marked as `set_by_user`. EXPECT_FALSE(desks[0]->is_name_set_by_user()); EXPECT_FALSE(desks[1]->is_name_set_by_user()); @@ -4652,7 +4652,7 @@ TEST_F(DesksBentoTest, ZeroStateDeskButtonText) { ASSERT_TRUE(desks_bar_view->IsZeroState()); // Show the default name "Desk 1" while initializing the desks bar at the // first time. - EXPECT_EQ(base::UTF8ToUTF16("Desk 1"), + EXPECT_EQ(u"Desk 1", desks_bar_view->zero_state_default_desk_button()->GetText()); auto* event_generator = GetEventGenerator(); @@ -4672,21 +4672,20 @@ TEST_F(DesksBentoTest, ZeroStateDeskButtonText) { desks_bar_view = GetOverviewGridForRoot(root_window)->desks_bar_view(); EXPECT_TRUE(desks_bar_view->IsZeroState()); // Should show the desk's current name "test" instead of the default name. - EXPECT_EQ(base::UTF8ToUTF16("test"), + EXPECT_EQ(u"test", desks_bar_view->zero_state_default_desk_button()->GetText()); // Create 'Desk 2'. ClickOnView(desks_bar_view->zero_state_new_desk_button(), event_generator); EXPECT_FALSE(desks_bar_view->IsZeroState()); SendKey(ui::VKEY_RETURN); - EXPECT_EQ(base::UTF8ToUTF16("Desk 2"), - DesksController::Get()->desks()[1].get()->name()); + EXPECT_EQ(u"Desk 2", DesksController::Get()->desks()[1].get()->name()); // Close desk 'test' should return to zero state and the zero state default // desk button should show current desk's name, which is 'Desk 1'. CloseDeskFromMiniView(desks_bar_view->mini_views()[0], event_generator); EXPECT_TRUE(desks_bar_view->IsZeroState()); - EXPECT_EQ(base::UTF8ToUTF16("Desk 1"), + EXPECT_EQ(u"Desk 1", desks_bar_view->zero_state_default_desk_button()->GetText()); // Set a super long desk name. diff --git a/ash/wm/overview/overview_highlight_controller_unittest.cc b/ash/wm/overview/overview_highlight_controller_unittest.cc index 0d669ca48e6e79..ca32de19041754 100644 --- a/ash/wm/overview/overview_highlight_controller_unittest.cc +++ b/ash/wm/overview/overview_highlight_controller_unittest.cc @@ -710,7 +710,7 @@ TEST_F(DesksOverviewHighlightControllerTest, ActivateDeskNameView) { EXPECT_FALSE(desk_name_view_1->HasFocus()); EXPECT_EQ(desk_bar_view->mini_views()[1], GetHighlightedView()); - EXPECT_EQ(base::UTF8ToUTF16("code"), desk_1->name()); + EXPECT_EQ(u"code", desk_1->name()); EXPECT_TRUE(desk_1->is_name_set_by_user()); } diff --git a/ash/wm/overview/overview_session_unittest.cc b/ash/wm/overview/overview_session_unittest.cc index 4702b84a63334f..f2c47d9182455e 100644 --- a/ash/wm/overview/overview_session_unittest.cc +++ b/ash/wm/overview/overview_session_unittest.cc @@ -1614,7 +1614,7 @@ TEST_F(OverviewSessionTest, DragWindowShadow) { // Test that a label is created under the window on entering overview mode. TEST_F(OverviewSessionTest, CreateLabelUnderWindow) { std::unique_ptr window(CreateTestWindow(gfx::Rect(300, 500))); - const std::u16string window_title = base::UTF8ToUTF16("My window"); + const std::u16string window_title = u"My window"; window->SetTitle(window_title); ToggleOverview(); OverviewItem* window_item = GetOverviewItemsForRoot(0).back().get(); @@ -1625,7 +1625,7 @@ TEST_F(OverviewSessionTest, CreateLabelUnderWindow) { EXPECT_EQ(window_title, label->GetText()); // Update the window title and check that the label is updated, too. - const std::u16string updated_title = base::UTF8ToUTF16("Updated title"); + const std::u16string updated_title = u"Updated title"; window->SetTitle(updated_title); EXPECT_EQ(updated_title, label->GetText()); diff --git a/base/android/jni_string_unittest.cc b/base/android/jni_string_unittest.cc index 79d0fb1e3fdc8c..852a175993472b 100644 --- a/base/android/jni_string_unittest.cc +++ b/base/android/jni_string_unittest.cc @@ -21,7 +21,7 @@ TEST(JniString, BasicConversionsUTF8) { } TEST(JniString, BasicConversionsUTF16) { - const std::u16string kSimpleString = UTF8ToUTF16("SimpleTest16"); + const std::u16string kSimpleString = u"SimpleTest16"; JNIEnv* env = AttachCurrentThread(); std::u16string result = ConvertJavaStringToUTF16(ConvertUTF16ToJavaString(env, kSimpleString)); diff --git a/base/i18n/break_iterator_unittest.cc b/base/i18n/break_iterator_unittest.cc index 9925f38a7806ea..e48f5f167d3499 100644 --- a/base/i18n/break_iterator_unittest.cc +++ b/base/i18n/break_iterator_unittest.cc @@ -30,7 +30,7 @@ TEST(BreakIteratorTest, BreakWordEmpty) { } TEST(BreakIteratorTest, BreakWord) { - std::u16string space(UTF8ToUTF16(" ")); + std::u16string space(u" "); std::u16string str(UTF8ToUTF16(" foo bar! \npouet boom")); BreakIterator iter(str, BreakIterator::BREAK_WORD); ASSERT_TRUE(iter.Init()); @@ -39,16 +39,16 @@ TEST(BreakIteratorTest, BreakWord) { EXPECT_EQ(space, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("foo"), iter.GetString()); + EXPECT_EQ(u"foo", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_EQ(space, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("bar"), iter.GetString()); + EXPECT_EQ(u"bar", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("!"), iter.GetString()); + EXPECT_EQ(u"!", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_EQ(space, iter.GetString()); @@ -57,13 +57,13 @@ TEST(BreakIteratorTest, BreakWord) { EXPECT_EQ(UTF8ToUTF16("\n"), iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("pouet"), iter.GetString()); + EXPECT_EQ(u"pouet", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_EQ(space, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("boom"), iter.GetString()); + EXPECT_EQ(u"boom", iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. @@ -84,7 +84,7 @@ TEST(BreakIteratorTest, BreakWordWide16) { EXPECT_EQ(word1, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); EXPECT_EQ(word2, iter.GetString()); @@ -108,10 +108,10 @@ TEST(BreakIteratorTest, BreakWordWide32) { EXPECT_EQ(very_wide_word, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("a"), iter.GetString()); + EXPECT_EQ(u"a", iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. @@ -190,7 +190,7 @@ TEST(BreakIteratorTest, BreakWordJapanese) { TEST(BreakIteratorTest, BreakWordChineseEnglish) { // Terms in Simplified Chinese mixed with English and wide punctuations. - std::u16string space(UTF8ToUTF16(" ")); + std::u16string space(u" "); const char token1[] = "下载"; const char token2[] = "Chrome"; const char token3[] = "("; @@ -257,19 +257,19 @@ TEST(BreakIteratorTest, BreakSpace) { ASSERT_TRUE(iter.Init()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("foo "), iter.GetString()); + EXPECT_EQ(u"foo ", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_EQ(UTF8ToUTF16("bar! \n"), iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("pouet "), iter.GetString()); + EXPECT_EQ(u"pouet ", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("boom"), iter.GetString()); + EXPECT_EQ(u"boom", iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. @@ -282,19 +282,19 @@ TEST(BreakIteratorTest, BreakSpaceSP) { ASSERT_TRUE(iter.Init()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("foo "), iter.GetString()); + EXPECT_EQ(u"foo ", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_EQ(UTF8ToUTF16("bar! \n"), iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("pouet "), iter.GetString()); + EXPECT_EQ(u"pouet ", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("boom "), iter.GetString()); + EXPECT_EQ(u"boom ", iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. @@ -336,7 +336,7 @@ TEST(BreakIteratorTest, BreakSpaceWide32) { EXPECT_EQ(very_wide_word, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("a"), iter.GetString()); + EXPECT_EQ(u"a", iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. @@ -369,7 +369,7 @@ TEST(BreakIteratorTest, BreakLine) { EXPECT_EQ(nl, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("pouet boom"), iter.GetString()); + EXPECT_EQ(u"pouet boom", iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. @@ -399,7 +399,7 @@ TEST(BreakIteratorTest, BreakSentence) { EXPECT_EQ(UTF8ToUTF16("\tAnother sentence?"), iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("One more thing"), iter.GetString()); + EXPECT_EQ(u"One more thing", iter.GetString()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. EXPECT_FALSE(iter.IsWord()); } @@ -482,7 +482,7 @@ TEST(BreakIteratorTest, BreakLineWide32) { EXPECT_EQ(very_wide_line, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(UTF8ToUTF16("a"), iter.GetString()); + EXPECT_EQ(u"a", iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. @@ -570,7 +570,7 @@ TEST(BreakIteratorTest, GetWordBreakStatusBreakLine) { EXPECT_TRUE(iter.Advance()); // Finds "foo" and the space. - EXPECT_EQ(base::UTF8ToUTF16("foo "), iter.GetString()); + EXPECT_EQ(u"foo ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_LINE_OR_CHAR_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the Khmer characters, the next space, and the newline. @@ -578,7 +578,7 @@ TEST(BreakIteratorTest, GetWordBreakStatusBreakLine) { EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_LINE_OR_CHAR_BREAK); EXPECT_TRUE(iter.Advance()); // Finds "Can" and the space. - EXPECT_EQ(base::UTF8ToUTF16("Can "), iter.GetString()); + EXPECT_EQ(u"Can ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_LINE_OR_CHAR_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the Russian characters and periods. @@ -601,42 +601,42 @@ TEST(BreakIteratorTest, GetWordBreakStatusBreakWord) { EXPECT_TRUE(iter.Advance()); // Finds "foo". - EXPECT_EQ(base::UTF8ToUTF16("foo"), iter.GetString()); + EXPECT_EQ(u"foo", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_WORD_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the space, and the Khmer characters. - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); EXPECT_EQ(u"\x1791\x17C1", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_WORD_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the space and the newline. - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); EXPECT_EQ(base::UTF8ToUTF16("\n"), iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); // Finds "Can". - EXPECT_EQ(base::UTF8ToUTF16("Can"), iter.GetString()); + EXPECT_EQ(u"Can", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_WORD_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the space and the Russian characters. - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); EXPECT_EQ(u"\x041C\x0438", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_WORD_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the trailing periods. - EXPECT_EQ(base::UTF8ToUTF16("."), iter.GetString()); + EXPECT_EQ(u".", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("."), iter.GetString()); + EXPECT_EQ(u".", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("."), iter.GetString()); + EXPECT_EQ(u".", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_FALSE(iter.Advance()); } diff --git a/base/i18n/time_formatting_unittest.cc b/base/i18n/time_formatting_unittest.cc index 13af9ee04a5170..51e36e37446d88 100644 --- a/base/i18n/time_formatting_unittest.cc +++ b/base/i18n/time_formatting_unittest.cc @@ -179,7 +179,7 @@ TEST(TimeFormattingTest, TimeFormatTimeOfDayDE) { Time time; EXPECT_TRUE(Time::FromUTCExploded(kTestDateTimeExploded, &time)); std::u16string clock24h(ASCIIToUTF16("15:42")); - std::u16string clock12h_pm(UTF8ToUTF16("3:42 PM")); + std::u16string clock12h_pm(u"3:42 PM"); std::u16string clock12h(ASCIIToUTF16("3:42")); // The default is 24h clock. diff --git a/base/stl_util_unittest.cc b/base/stl_util_unittest.cc index 775530e493cc82..42cec062347648 100644 --- a/base/stl_util_unittest.cc +++ b/base/stl_util_unittest.cc @@ -545,11 +545,11 @@ TEST(Erase, String) { TEST(Erase, String16) { std::pair test_data[] = { {std::u16string(), std::u16string()}, - {UTF8ToUTF16("abc"), UTF8ToUTF16("bc")}, - {UTF8ToUTF16("abca"), UTF8ToUTF16("bc")}, + {u"abc", u"bc"}, + {u"abca", u"bc"}, }; - const std::u16string letters = UTF8ToUTF16("ab"); + const std::u16string letters = u"ab"; for (auto test_case : test_data) { Erase(test_case.first, letters[0]); EXPECT_EQ(test_case.second, test_case.first); diff --git a/base/strings/pattern_unittest.cc b/base/strings/pattern_unittest.cc index 8ec54954caf3e0..b2773145107a9b 100644 --- a/base/strings/pattern_unittest.cc +++ b/base/strings/pattern_unittest.cc @@ -37,10 +37,8 @@ TEST(StringUtilTest, MatchPatternTest) { EXPECT_FALSE(MatchPattern("\xf4\x90\x80\x80", "\xf4\x90\x80\x80")); // Test UTF16 character matching. - EXPECT_TRUE(MatchPattern(UTF8ToUTF16("www.google.com"), - UTF8ToUTF16("*.com"))); - EXPECT_TRUE(MatchPattern(UTF8ToUTF16("Hello*1234"), - UTF8ToUTF16("He??o\\*1*"))); + EXPECT_TRUE(MatchPattern(u"www.google.com", u"*.com")); + EXPECT_TRUE(MatchPattern(u"Hello*1234", UTF8ToUTF16("He??o\\*1*"))); // Some test cases that might cause naive implementations to exhibit // exponential run time or fail. diff --git a/base/values_unittest.cc b/base/values_unittest.cc index 53d5e9bb507994..18abe261f0fa51 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc @@ -1245,7 +1245,7 @@ TEST(ValuesTest, SetStringPath) { ASSERT_TRUE(root.SetStringPath("foo.bar", StringPiece("rah rah"))); ASSERT_TRUE(root.SetStringPath("foo.bar", std::string("temp string"))); - ASSERT_TRUE(root.SetStringPath("foo.bar", UTF8ToUTF16("temp string"))); + ASSERT_TRUE(root.SetStringPath("foo.bar", u"temp string")); // Can't change existing non-dictionary keys. ASSERT_FALSE(root.SetStringPath("foo.bar.zoo", "ola mundo")); diff --git a/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc b/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc index 953c9839df301a..c1eca4d37d5562 100644 --- a/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc +++ b/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc @@ -84,7 +84,7 @@ class ContextualSearchDelegateTest : public testing::Test { } void CreateDefaultSearchContextAndRequestSearchTerm() { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; CreateSearchContextAndRequestSearchTerm("Barack Obama", surrounding, 0, 6); } @@ -401,7 +401,7 @@ TEST_F(ContextualSearchDelegateTest, InvalidResponse) { } TEST_F(ContextualSearchDelegateTest, ExpandSelectionToEnd) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Barack"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 0, 6); SetResponseStringAndSimulateResponse(selected_text, "0", "12"); @@ -411,7 +411,7 @@ TEST_F(ContextualSearchDelegateTest, ExpandSelectionToEnd) { } TEST_F(ContextualSearchDelegateTest, ExpandSelectionToStart) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Obama"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 7, 12); SetResponseStringAndSimulateResponse(selected_text, "0", "12"); @@ -421,7 +421,7 @@ TEST_F(ContextualSearchDelegateTest, ExpandSelectionToStart) { } TEST_F(ContextualSearchDelegateTest, ExpandSelectionBothDirections) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Ob"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 7, 9); SetResponseStringAndSimulateResponse(selected_text, "0", "12"); @@ -431,7 +431,7 @@ TEST_F(ContextualSearchDelegateTest, ExpandSelectionBothDirections) { } TEST_F(ContextualSearchDelegateTest, ExpandSelectionInvalidRange) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Ob"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 7, 9); SetResponseStringAndSimulateResponse(selected_text, "0", "1001"); @@ -441,7 +441,7 @@ TEST_F(ContextualSearchDelegateTest, ExpandSelectionInvalidRange) { } TEST_F(ContextualSearchDelegateTest, ExpandSelectionInvalidDistantStart) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Ob"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 0xffffffff, 0xffffffff - 2); @@ -452,7 +452,7 @@ TEST_F(ContextualSearchDelegateTest, ExpandSelectionInvalidDistantStart) { } TEST_F(ContextualSearchDelegateTest, ExpandSelectionInvalidNoOverlap) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Ob"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 0, 12); SetResponseStringAndSimulateResponse(selected_text, "12", "14"); @@ -462,7 +462,7 @@ TEST_F(ContextualSearchDelegateTest, ExpandSelectionInvalidNoOverlap) { } TEST_F(ContextualSearchDelegateTest, ExpandSelectionInvalidDistantEndAndRange) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Ob"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 0xffffffff, 0xffffffff - 2); @@ -473,7 +473,7 @@ TEST_F(ContextualSearchDelegateTest, ExpandSelectionInvalidDistantEndAndRange) { } TEST_F(ContextualSearchDelegateTest, ExpandSelectionLargeNumbers) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Ob"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 268435450, 268435455); @@ -484,7 +484,7 @@ TEST_F(ContextualSearchDelegateTest, ExpandSelectionLargeNumbers) { } TEST_F(ContextualSearchDelegateTest, ContractSelectionValid) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Barack Obama just"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 0, 17); SetResponseStringAndSimulateResponse(selected_text, "0", "12"); @@ -494,7 +494,7 @@ TEST_F(ContextualSearchDelegateTest, ContractSelectionValid) { } TEST_F(ContextualSearchDelegateTest, ContractSelectionInvalid) { - std::u16string surrounding = base::UTF8ToUTF16("Barack Obama just spoke."); + std::u16string surrounding = u"Barack Obama just spoke."; std::string selected_text = "Barack Obama just"; CreateSearchContextAndRequestSearchTerm(selected_text, surrounding, 0, 17); SetResponseStringAndSimulateResponse(selected_text, "5", "5"); diff --git a/chrome/browser/android/history_report/delta_file_commons.cc b/chrome/browser/android/history_report/delta_file_commons.cc index 712e2ba06bf9fd..6e478a2230ea85 100644 --- a/chrome/browser/android/history_report/delta_file_commons.cc +++ b/chrome/browser/android/history_report/delta_file_commons.cc @@ -115,7 +115,8 @@ std::string DeltaFileEntryWithData::Url() const { } std::u16string DeltaFileEntryWithData::Title() const { - if (!Valid()) return base::UTF8ToUTF16(""); + if (!Valid()) + return u""; if (is_bookmark_ && !bookmark_title_.empty()) return bookmark_title_; if (data_.title().empty()) return base::UTF8ToUTF16(data_.url().host_piece()); return data_.title(); diff --git a/chrome/browser/android/history_report/delta_file_commons_unittest.cc b/chrome/browser/android/history_report/delta_file_commons_unittest.cc index 6bb00a824884ac..5210bdeb3ea4a6 100644 --- a/chrome/browser/android/history_report/delta_file_commons_unittest.cc +++ b/chrome/browser/android/history_report/delta_file_commons_unittest.cc @@ -98,32 +98,32 @@ TEST_F(DeltaFileEntryWithDataTest, BookmarkScore) { TEST_F(DeltaFileEntryWithDataTest, NoBookmarkEmptyTitle) { history::URLRow row(GURL("http://www.host.org/path?query=param")); - row.set_title(base::UTF8ToUTF16("")); + row.set_title(u""); row.set_hidden(false); data_.SetData(row); EXPECT_TRUE(data_.Valid()); - EXPECT_EQ(base::UTF8ToUTF16("www.host.org"), data_.Title()); + EXPECT_EQ(u"www.host.org", data_.Title()); } TEST_F(DeltaFileEntryWithDataTest, NoBookmarkNonEmptyTitle) { history::URLRow row(GURL("http://host.org/path?query=param")); - row.set_title(base::UTF8ToUTF16("title")); + row.set_title(u"title"); row.set_hidden(false); data_.SetData(row); EXPECT_TRUE(data_.Valid()); - EXPECT_EQ(base::UTF8ToUTF16("title"), data_.Title()); + EXPECT_EQ(u"title", data_.Title()); } TEST_F(DeltaFileEntryWithDataTest, BookmarkTitle) { UrlAndTitle bookmark; - bookmark.title = base::UTF8ToUTF16("bookmark_title"); + bookmark.title = u"bookmark_title"; history::URLRow row(GURL("http://host.org/path?query=param")); - row.set_title(base::UTF8ToUTF16("title")); + row.set_title(u"title"); row.set_hidden(false); data_.SetData(row); data_.MarkAsBookmark(bookmark); EXPECT_TRUE(data_.Valid()); - EXPECT_EQ(base::UTF8ToUTF16("bookmark_title"), data_.Title()); + EXPECT_EQ(u"bookmark_title", data_.Title()); } TEST_F(DeltaFileEntryWithDataTest, TrimWWWPrefix) { diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc index 4e48f90cfbea82..5216f08898ab84 100644 --- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc @@ -1130,7 +1130,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, MAYBE_Focus_InputMethod) { // user input via IME. { ui::CompositionText composition; - composition.text = base::UTF8ToUTF16("InputTest123"); + composition.text = u"InputTest123"; text_input_client->SetCompositionText(composition); EXPECT_TRUE(content::ExecuteScript( embedder_web_contents, @@ -1145,7 +1145,7 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, MAYBE_Focus_InputMethod) { next_step_listener.Reset(); ui::CompositionText composition; - composition.text = base::UTF8ToUTF16("InputTest456"); + composition.text = u"InputTest456"; text_input_client->SetCompositionText(composition); text_input_client->ConfirmCompositionText(/* keep_selection */ false); EXPECT_TRUE(content::ExecuteScript( @@ -1526,9 +1526,9 @@ IN_PROC_BROWSER_TEST_F(WebViewImeInteractiveTest, false); content::RenderWidgetHost* target_rwh_for_input = target_web_contents->GetRenderWidgetHostView()->GetRenderWidgetHost(); - content::SendImeCommitTextToWidget( - target_rwh_for_input, base::UTF8ToUTF16("C"), - std::vector(), gfx::Range(4, 5), 0); + content::SendImeCommitTextToWidget(target_rwh_for_input, u"C", + std::vector(), + gfx::Range(4, 5), 0); EXPECT_TRUE(input_listener.WaitUntilSatisfied()); // Get the input value from the guest. @@ -1593,8 +1593,7 @@ IN_PROC_BROWSER_TEST_F(WebViewImeInteractiveTest, CompositionRangeUpdates) { CompositionRangeUpdateObserver observer(embedder_web_contents); content::SendImeSetCompositionTextToWidget( target_web_contents->GetRenderWidgetHostView()->GetRenderWidgetHost(), - base::UTF8ToUTF16("ABC"), std::vector(), - gfx::Range::InvalidRange(), 0, 3); + u"ABC", std::vector(), gfx::Range::InvalidRange(), 0, 3); observer.WaitForCompositionRangeLength(3U); } diff --git a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc index 742d48822417ff..bf52c9342d0ebe 100644 --- a/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc +++ b/chrome/browser/ash/arc/accessibility/arc_accessibility_helper_bridge_unittest.cc @@ -208,9 +208,8 @@ class ArcAccessibilityHelperBridgeTest : public ChromeViewsTestBase { std::unique_ptr CreateNotification() { auto notification = std::make_unique( - message_center::NOTIFICATION_TYPE_CUSTOM, kNotificationKey, - base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), gfx::Image(), - base::UTF8ToUTF16("display_source"), GURL(), + message_center::NOTIFICATION_TYPE_CUSTOM, kNotificationKey, u"title", + u"message", gfx::Image(), u"display_source", GURL(), message_center::NotifierId( message_center::NotifierType::ARC_APPLICATION, "test_app_id"), message_center::RichNotificationData(), nullptr); diff --git a/chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_menu_builder_unittest.cc b/chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_menu_builder_unittest.cc index 9c0d4cc765ec5a..db9bb118b9b8e8 100644 --- a/chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_menu_builder_unittest.cc +++ b/chrome/browser/ash/arc/app_shortcuts/arc_app_shortcuts_menu_builder_unittest.cc @@ -62,7 +62,7 @@ TEST_F(ArcAppShortcutsMenuBuilderTest, Basic) { base::RunLoop run_loop; std::unique_ptr menu; auto simple_menu_model = std::make_unique(nullptr); - const std::u16string first_item_label = base::UTF8ToUTF16("FirstItemLabel"); + const std::u16string first_item_label = u"FirstItemLabel"; simple_menu_model->AddItem(1, first_item_label); auto arc_app_shortcuts_menu_builder = std::make_unique( diff --git a/chrome/browser/ash/login/demo_mode/demo_session.cc b/chrome/browser/ash/login/demo_mode/demo_session.cc index a9cb92d260a678..e78600411adc28 100644 --- a/chrome/browser/ash/login/demo_mode/demo_session.cc +++ b/chrome/browser/ash/login/demo_mode/demo_session.cc @@ -196,8 +196,7 @@ std::vector GetSupportedLocales() { l10n_util::GetDisplayNameForLocale(locale, locale, true /* is_for_ui */); if (locale_info.display_name != native_display_name) { - locale_info.display_name += - base::UTF8ToUTF16(" - ") + native_display_name; + locale_info.display_name += u" - " + native_display_name; } supported_locales.push_back(std::move(locale_info)); } diff --git a/chrome/browser/ash/login/saml/saml_browsertest.cc b/chrome/browser/ash/login/saml/saml_browsertest.cc index e4db6fbaa73979..48526dff1e4c10 100644 --- a/chrome/browser/ash/login/saml/saml_browsertest.cc +++ b/chrome/browser/ash/login/saml/saml_browsertest.cc @@ -420,7 +420,7 @@ IN_PROC_BROWSER_TEST_F(SamlTest, IdpRequiresHttpAuth) { LoginHandler* handler = *login_prompt_observer.handlers().begin(); // Note that the actual credentials don't matter because `fake_saml_idp()` // doesn't check those (only that something has been provided). - handler->SetAuth(base::UTF8ToUTF16("user"), base::UTF8ToUTF16("pwd")); + handler->SetAuth(u"user", u"pwd"); // Now the SAML sign-in form should actually load. std::string message; diff --git a/chrome/browser/ash/web_applications/diagnostics_system_web_app_info.cc b/chrome/browser/ash/web_applications/diagnostics_system_web_app_info.cc index bdca38de8da10d..89f618318dce3c 100644 --- a/chrome/browser/ash/web_applications/diagnostics_system_web_app_info.cc +++ b/chrome/browser/ash/web_applications/diagnostics_system_web_app_info.cc @@ -22,7 +22,7 @@ CreateWebAppInfoForDiagnosticsSystemWebApp() { info->scope = GURL(chromeos::kChromeUIDiagnosticsAppUrl); // TODO(jimmyxgong): Update the title with finalized i18n copy. - info->title = base::UTF8ToUTF16("Diagnostics"); + info->title = u"Diagnostics"; web_app::CreateIconInfoForSystemWebApp( info->start_url, {{"app_icon_192.png", 192, IDR_DIAGNOSTICS_APP_ICON}}, *info); diff --git a/chrome/browser/ash/web_applications/eche_app_info.cc b/chrome/browser/ash/web_applications/eche_app_info.cc index e19958b7f15d04..8cb07c83580391 100644 --- a/chrome/browser/ash/web_applications/eche_app_info.cc +++ b/chrome/browser/ash/web_applications/eche_app_info.cc @@ -21,7 +21,7 @@ std::unique_ptr CreateWebAppInfoForEcheApp() { info->scope = GURL(chromeos::eche_app::kChromeUIEcheAppURL); // |title| should come from a resource string, but this is the Eche app, and // doesn't have one. - info->title = base::UTF8ToUTF16("Eche App"); + info->title = u"Eche App"; web_app::CreateIconInfoForSystemWebApp( info->start_url, {{"app_icon_256.png", 256, IDR_CHROMEOS_ECHE_APP_ICON_256_PNG}}, *info); diff --git a/chrome/browser/ash/web_applications/file_manager_web_app_info.cc b/chrome/browser/ash/web_applications/file_manager_web_app_info.cc index 2b83ca2296c2e8..8dbcf43c81afb2 100644 --- a/chrome/browser/ash/web_applications/file_manager_web_app_info.cc +++ b/chrome/browser/ash/web_applications/file_manager_web_app_info.cc @@ -19,7 +19,7 @@ std::unique_ptr CreateWebAppInfoForFileManager() { info->start_url = GURL(chromeos::file_manager::kChromeUIFileManagerURL); info->scope = GURL(chromeos::file_manager::kChromeUIFileManagerURL); // TODO(majewski): Fetch from a resource. - info->title = base::UTF8ToUTF16("File Manager"); + info->title = u"File Manager"; web_app::CreateIconInfoForSystemWebApp( info->start_url, {{"icon192.png", 192, IDR_FILE_MANAGER_SWA_ICON_192}}, *info); diff --git a/chrome/browser/ash/web_applications/media_web_app_info.cc b/chrome/browser/ash/web_applications/media_web_app_info.cc index 66550ed7dc238f..6eb721be4a9474 100644 --- a/chrome/browser/ash/web_applications/media_web_app_info.cc +++ b/chrome/browser/ash/web_applications/media_web_app_info.cc @@ -78,7 +78,7 @@ std::unique_ptr CreateWebAppInfoForMediaWebApp() { blink::Manifest::FileHandler file_handler; file_handler.action = GURL(chromeos::kChromeUIMediaAppURL); - file_handler.name = base::UTF8ToUTF16("Media File"); + file_handler.name = u"Media File"; file_handler.accept = MakeHandlerAccept(); info->file_handlers.push_back(std::move(file_handler)); return info; diff --git a/chrome/browser/ash/web_applications/sample_system_web_app_info.cc b/chrome/browser/ash/web_applications/sample_system_web_app_info.cc index ff43d3f9f81bed..1b7e7b9be97c78 100644 --- a/chrome/browser/ash/web_applications/sample_system_web_app_info.cc +++ b/chrome/browser/ash/web_applications/sample_system_web_app_info.cc @@ -21,7 +21,7 @@ std::unique_ptr CreateWebAppInfoForSampleSystemWebApp() { info->scope = GURL(chromeos::kChromeUISampleSystemWebAppURL); // |title| should come from a resource string, but this is the sample app, and // doesn't have one. - info->title = base::UTF8ToUTF16("Sample System Web App"); + info->title = u"Sample System Web App"; web_app::CreateIconInfoForSystemWebApp( info->start_url, {{"app_icon_192.png", 192, diff --git a/chrome/browser/ash/web_applications/telemetry_extension_integration_browsertest.cc b/chrome/browser/ash/web_applications/telemetry_extension_integration_browsertest.cc index 22cd9c2549a777..231df0391a69a3 100644 --- a/chrome/browser/ash/web_applications/telemetry_extension_integration_browsertest.cc +++ b/chrome/browser/ash/web_applications/telemetry_extension_integration_browsertest.cc @@ -112,8 +112,7 @@ IN_PROC_BROWSER_TEST_P(TelemetryExtensionWithDirIntegrationTest, content::NavigateToURL(web_contents, load_from_disk_resource_gurl)); // Verify that the file loaded from disk has the expected title. - EXPECT_EQ(base::UTF8ToUTF16("TelemetryExtension - Loaded From Disk"), - web_contents->GetTitle()); + EXPECT_EQ(u"TelemetryExtension - Loaded From Disk", web_contents->GetTitle()); } // Tests that TelemetryExtensionUntrustedSource fails to load non-existing diff --git a/chrome/browser/ash/web_applications/telemetry_extension_web_app_info.cc b/chrome/browser/ash/web_applications/telemetry_extension_web_app_info.cc index 86652606025c8b..6ab1e57b963330 100644 --- a/chrome/browser/ash/web_applications/telemetry_extension_web_app_info.cc +++ b/chrome/browser/ash/web_applications/telemetry_extension_web_app_info.cc @@ -17,7 +17,7 @@ std::unique_ptr CreateWebAppInfoForTelemetryExtension() { auto info = std::make_unique(); info->start_url = GURL(chromeos::kChromeUITelemetryExtensionURL); info->scope = GURL(chromeos::kChromeUITelemetryExtensionURL); - info->title = base::UTF8ToUTF16("Telemetry Extension"); + info->title = u"Telemetry Extension"; web_app::CreateIconInfoForSystemWebApp( info->start_url, {{"app_icon_96.png", 96, IDR_TELEMETRY_EXTENSION_ICON_96}}, *info); diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc index d03133c697df34..45d580fb53fa0b 100644 --- a/chrome/browser/background/background_mode_manager_unittest.cc +++ b/chrome/browser/background/background_mode_manager_unittest.cc @@ -205,9 +205,8 @@ class BackgroundModeManagerTest : public testing::Test { std::vector{&policy_provider_}); profile_manager_ = CreateTestingProfileManager(); profile_ = profile_manager_->CreateTestingProfile( - "p1", nullptr, base::UTF8ToUTF16("p1"), 0, "", - TestingProfile::TestingFactories(), base::nullopt, - std::move(policy_service)); + "p1", nullptr, u"p1", 0, "", TestingProfile::TestingFactories(), + base::nullopt, std::move(policy_service)); } protected: diff --git a/chrome/browser/certificate_manager_model_unittest.cc b/chrome/browser/certificate_manager_model_unittest.cc index 755648c56f0d39..27c08cf9eabb84 100644 --- a/chrome/browser/certificate_manager_model_unittest.cc +++ b/chrome/browser/certificate_manager_model_unittest.cc @@ -194,7 +194,7 @@ TEST_F(CertificateManagerModelTest, ListsClientCertsFromPlatform) { ASSERT_TRUE(platform_cert_info); EXPECT_EQ(net::CertType::USER_CERT, platform_cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("Client Cert A"), platform_cert_info->name()); + EXPECT_EQ(u"Client Cert A", platform_cert_info->name()); EXPECT_TRUE(platform_cert_info->can_be_deleted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kPlatform, platform_cert_info->source()); @@ -368,7 +368,7 @@ TEST_F(CertificateManagerModelChromeOSTest, ListsWebTrustedCertsFromPolicy) { ASSERT_TRUE(cert_info); EXPECT_EQ(net::CertType::CA_CERT, cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("pywebsocket"), cert_info->name()); + EXPECT_EQ(u"pywebsocket", cert_info->name()); EXPECT_FALSE(cert_info->can_be_deleted()); EXPECT_FALSE(cert_info->untrusted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kPolicy, @@ -395,7 +395,7 @@ TEST_F(CertificateManagerModelChromeOSTest, ListsNotWebTrustedCertsFromPolicy) { ASSERT_TRUE(cert_info); EXPECT_EQ(net::CertType::CA_CERT, cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("pywebsocket"), cert_info->name()); + EXPECT_EQ(u"pywebsocket", cert_info->name()); EXPECT_FALSE(cert_info->can_be_deleted()); EXPECT_FALSE(cert_info->untrusted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kPolicy, @@ -439,7 +439,7 @@ TEST_F(CertificateManagerModelChromeOSTest, EXPECT_EQ(platform_cert_info, policy_cert_info); EXPECT_EQ(net::CertType::CA_CERT, policy_cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("pywebsocket"), policy_cert_info->name()); + EXPECT_EQ(u"pywebsocket", policy_cert_info->name()); EXPECT_FALSE(policy_cert_info->can_be_deleted()); EXPECT_FALSE(policy_cert_info->untrusted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kPolicy, @@ -462,7 +462,7 @@ TEST_F(CertificateManagerModelChromeOSTest, ASSERT_TRUE(platform_cert_info); EXPECT_EQ(net::CertType::CA_CERT, platform_cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("pywebsocket"), platform_cert_info->name()); + EXPECT_EQ(u"pywebsocket", platform_cert_info->name()); EXPECT_TRUE(platform_cert_info->can_be_deleted()); EXPECT_TRUE(platform_cert_info->untrusted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kPlatform, @@ -507,7 +507,7 @@ TEST_F(CertificateManagerModelChromeOSTest, EXPECT_EQ(platform_cert_info, policy_cert_info); EXPECT_EQ(net::CertType::CA_CERT, platform_cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("pywebsocket"), platform_cert_info->name()); + EXPECT_EQ(u"pywebsocket", platform_cert_info->name()); EXPECT_TRUE(platform_cert_info->can_be_deleted()); EXPECT_TRUE(platform_cert_info->untrusted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kPlatform, @@ -532,7 +532,7 @@ TEST_F(CertificateManagerModelChromeOSTest, ASSERT_TRUE(policy_cert_info); EXPECT_EQ(net::CertType::CA_CERT, policy_cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("pywebsocket"), policy_cert_info->name()); + EXPECT_EQ(u"pywebsocket", policy_cert_info->name()); EXPECT_FALSE(policy_cert_info->can_be_deleted()); EXPECT_FALSE(policy_cert_info->untrusted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kPolicy, @@ -594,8 +594,7 @@ TEST_F(CertificateManagerModelChromeOSTest, ListsExtensionCerts) { ASSERT_TRUE(extension_cert_info); EXPECT_EQ(net::CertType::USER_CERT, extension_cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("Client Cert A (extension provided)"), - extension_cert_info->name()); + EXPECT_EQ(u"Client Cert A (extension provided)", extension_cert_info->name()); EXPECT_FALSE(extension_cert_info->can_be_deleted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kExtension, extension_cert_info->source()); @@ -632,7 +631,7 @@ TEST_F(CertificateManagerModelChromeOSTest, EXPECT_EQ(platform_cert_info, extension_cert_info); EXPECT_EQ(net::CertType::USER_CERT, platform_cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("Client Cert A"), platform_cert_info->name()); + EXPECT_EQ(u"Client Cert A", platform_cert_info->name()); EXPECT_TRUE(platform_cert_info->can_be_deleted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kPlatform, platform_cert_info->source()); @@ -656,7 +655,7 @@ TEST_F(CertificateManagerModelChromeOSTest, ASSERT_TRUE(extension_cert_info); EXPECT_EQ(net::CertType::USER_CERT, extension_cert_info->type()); - EXPECT_EQ(base::UTF8ToUTF16("Client Cert A (extension provided)"), + EXPECT_EQ(u"Client Cert A (extension provided)", extension_cert_info->name()); EXPECT_FALSE(extension_cert_info->can_be_deleted()); EXPECT_EQ(CertificateManagerModel::CertInfo::Source::kExtension, diff --git a/chrome/browser/chrome_service_worker_browsertest.cc b/chrome/browser/chrome_service_worker_browsertest.cc index 69a14d7cb24c7b..a75e2cc85f8446 100644 --- a/chrome/browser/chrome_service_worker_browsertest.cc +++ b/chrome/browser/chrome_service_worker_browsertest.cc @@ -238,7 +238,7 @@ IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerTest, StartServiceWorkerAndDispatchMessage) { base::RunLoop run_loop; blink::TransferableMessage msg; - const std::u16string message_data = base::UTF8ToUTF16("testMessage"); + const std::u16string message_data = u"testMessage"; WriteFile(FILE_PATH_LITERAL("sw.js"), "self.onfetch = function(e) {};"); WriteFile(FILE_PATH_LITERAL("test.html"), kInstallAndWaitForActivatedPage); diff --git a/chrome/browser/chromeos/child_accounts/screen_time_controller_browsertest.cc b/chrome/browser/chromeos/child_accounts/screen_time_controller_browsertest.cc index 2d1a353b381dcc..482d4c415149fa 100644 --- a/chrome/browser/chromeos/child_accounts/screen_time_controller_browsertest.cc +++ b/chrome/browser/chromeos/child_accounts/screen_time_controller_browsertest.cc @@ -178,8 +178,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, UnlockBedtime) { LogInChildAndSetupClockWithTime("5 Jan 2018 22:00:00 BRT"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("BRT")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"BRT"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 BRT"); @@ -219,8 +218,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, OverrideBedtimeWithDuration) { LogInChildAndSetupClockWithTime("5 Jan 2018 20:45:00 PST"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("PST")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"PST"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 PST"); @@ -278,8 +276,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, LogInChildAndSetupClockWithTime("1 Jan 2018 10:00:00 BRT"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("BRT")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"BRT"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 BRT"); @@ -331,8 +328,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, UnlockBedtimeWithDuration) { LogInChildAndSetupClockWithTime("5 Jan 2018 22:00:00 GMT"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 GMT"); @@ -386,8 +382,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, UnlockDailyLimitWithDuration) { LogInChildAndSetupClockWithTime("1 Jan 2018 10:00:00 PST"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("PST")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"PST"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 PST"); @@ -439,8 +434,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, DefaultBedtime) { LogInChildAndSetupClockWithTime("1 Jan 2018 10:00:00 GMT"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 GMT"); @@ -497,8 +491,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, DISABLED_DefaultDailyLimit) { LogInChildAndSetupClockWithTime("1 Jan 2018 10:00:00 GMT"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 GMT"); @@ -558,8 +551,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, DISABLED_ActiveSessionBedtime) { LogInChildAndSetupClockWithTime("1 Jan 2018 10:00:00 PST"); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("PST")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"PST"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 PST"); @@ -592,8 +584,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, DISABLED_ActiveSessionDailyLimit) { LogInChildAndSetupClockWithTime("1 Jan 2018 10:00:00 PST"); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("PST")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"PST"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 PST"); @@ -623,8 +614,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, BedtimeOnTimezoneChange) { LogInChildAndSetupClockWithTime("3 Jan 2018 10:00:00 GMT-0600"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT-0600")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT-0600"); // Set new policy. base::Time last_updated = utils::TimeFromString("3 Jan 2018 0:00 GMT-0600"); @@ -648,8 +638,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, BedtimeOnTimezoneChange) { // Change timezone, so that local time goes back to 6 PM and check that auth // is enabled since bedtime has not started yet. - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT-0700")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT-0700"); EXPECT_TRUE(IsAuthEnabled()); // Verify that auth is disabled at 7 PM (start of bedtime). @@ -658,8 +647,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, BedtimeOnTimezoneChange) { // Change timezone, so that local time goes forward to 7 AM and check that // auth is enabled since bedtime has ended in the new local time. - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT+0500")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT+0500"); EXPECT_TRUE(IsAuthEnabled()); } @@ -671,8 +659,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, BedtimeLockScreen24HourClock) { ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT"); // Set new policy. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 GMT"); @@ -686,7 +673,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, BedtimeLockScreen24HourClock) { // Check that auth is disabled, since the bedtime has already started. EXPECT_FALSE(IsAuthEnabled()); - EXPECT_EQ(base::UTF8ToUTF16("Come back at 17:00."), + EXPECT_EQ(u"Come back at 17:00.", ash::LoginScreenTestApi::GetDisabledAuthMessage(GetAccountId())); } @@ -696,8 +683,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, LogInChildAndSetupClockWithTime("3 Jan 2018 8:00:00 GMT+1300"); ScreenLockerTester().Lock(); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT+1300")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT+1300"); // Set new policy. base::Time last_updated = utils::TimeFromString("3 Jan 2018 0:00 GMT+1300"); @@ -713,15 +699,13 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, // Change timezone so that local time goes back to 6 AM and check that auth is // disable, since the tuesday's bedtime is not over yet. - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT+1100")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT+1100"); EXPECT_FALSE(IsAuthEnabled()); // Change timezone so that local time goes back to 7 PM on Tuesday and check // that auth is enabled, because the bedtime has not started yet in the // new local time. - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("GMT")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"GMT"); EXPECT_TRUE(IsAuthEnabled()); // Verify that auth is disabled at 8 PM (start of bedtime). @@ -734,8 +718,7 @@ IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, IN_PROC_BROWSER_TEST_F(ScreenTimeControllerTest, DISABLED_CallObservers) { LogInChildAndSetupClockWithTime("1 Jan 2018 10:00:00 PST"); - system::TimezoneSettings::GetInstance()->SetTimezoneFromID( - base::UTF8ToUTF16("PST")); + system::TimezoneSettings::GetInstance()->SetTimezoneFromID(u"PST"); // Set new policy with 3 hours of time usage limit. base::Time last_updated = utils::TimeFromString("1 Jan 2018 0:00 PST"); diff --git a/chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_enforcer_browsertest.cc b/chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_enforcer_browsertest.cc index aff526293ce9a5..d558517a25e076 100644 --- a/chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_enforcer_browsertest.cc +++ b/chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_enforcer_browsertest.cc @@ -180,7 +180,7 @@ content::WebContents* WebTimeLimitEnforcerThrottleTest::InstallAndLaunchWebApp( bool allowlisted_app) { auto web_app_info = std::make_unique(); web_app_info->title = base::UTF8ToUTF16(url.host()); - web_app_info->description = base::UTF8ToUTF16("Web app"); + web_app_info->description = u"Web app"; web_app_info->start_url = url; web_app_info->scope = url; web_app_info->open_as_window = true; diff --git a/chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.cc b/chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.cc index 49aeaa2a9d78c3..2b8e7fc5f6f20c 100644 --- a/chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.cc +++ b/chrome/browser/chromeos/child_accounts/time_limits/web_time_limit_error_page/web_time_limit_error_page.cc @@ -48,7 +48,7 @@ std::string GetWebTimeLimitErrorPage( strings.SetString("blockPageHeader", block_header); strings.SetString( "blockPageMessage", - base::StrCat({block_message, base::UTF8ToUTF16(" "), + base::StrCat({block_message, u" ", l10n_util::GetStringFUTF16( IDS_WEB_TIME_LIMIT_ERROR_PAGE_NEXT_ACCESS_TIME, GetTimeLimitMessage(time_limit))})); diff --git a/chrome/browser/chromeos/file_manager/url_util_unittest.cc b/chrome/browser/chromeos/file_manager/url_util_unittest.cc index 0810093ec8d52b..bfbc3e28c86032 100644 --- a/chrome/browser/chromeos/file_manager/url_util_unittest.cc +++ b/chrome/browser/chromeos/file_manager/url_util_unittest.cc @@ -50,7 +50,7 @@ TEST(FileManagerUrlUtilTest, GetFileManagerMainPageUrl) { TEST(FileManagerUrlUtilTest, GetFileManagerMainPageUrlWithParams_NoFileTypes) { const GURL url = GetFileManagerMainPageUrlWithParams( - ui::SelectFileDialog::SELECT_OPEN_FILE, base::UTF8ToUTF16("some title"), + ui::SelectFileDialog::SELECT_OPEN_FILE, u"some title", GURL("filesystem:chrome-extension://abc/Downloads/"), GURL("filesystem:chrome-extension://abc/Downloads/foo.txt"), "foo.txt", nullptr, // No file types @@ -96,15 +96,13 @@ TEST(FileManagerUrlUtilTest, file_types.extensions[0].push_back(FILE_PATH_LITERAL("html")); file_types.extensions.emplace_back(); file_types.extensions[1].push_back(FILE_PATH_LITERAL("txt")); - file_types.extension_description_overrides.push_back( - base::UTF8ToUTF16("HTML")); - file_types.extension_description_overrides.push_back( - base::UTF8ToUTF16("TEXT")); + file_types.extension_description_overrides.push_back(u"HTML"); + file_types.extension_description_overrides.push_back(u"TEXT"); // "shouldReturnLocalPath" will be false if drive is supported. file_types.allowed_paths = ui::SelectFileDialog::FileTypeInfo::ANY_PATH; const GURL url = GetFileManagerMainPageUrlWithParams( - ui::SelectFileDialog::SELECT_OPEN_FILE, base::UTF8ToUTF16("some title"), + ui::SelectFileDialog::SELECT_OPEN_FILE, u"some title", GURL("filesystem:chrome-extension://abc/Downloads/"), GURL("filesystem:chrome-extension://abc/Downloads/foo.txt"), "foo.txt", &file_types, diff --git a/chrome/browser/chromeos/file_manager/volume_manager_unittest.cc b/chrome/browser/chromeos/file_manager/volume_manager_unittest.cc index 6a7ee6522edd6d..2c759e8432aaaf 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager_unittest.cc +++ b/chrome/browser/chromeos/file_manager/volume_manager_unittest.cc @@ -1079,16 +1079,14 @@ TEST_F(VolumeManagerTest, MTPPlugAndUnplug) { storage_monitor::StorageInfo info( storage_monitor::StorageInfo::MakeDeviceId( storage_monitor::StorageInfo::MTP_OR_PTP, "dummy-device-id"), - FILE_PATH_LITERAL("/dummy/device/location"), base::UTF8ToUTF16("label"), - base::UTF8ToUTF16("vendor"), base::UTF8ToUTF16("model"), - 12345 /* size */); + FILE_PATH_LITERAL("/dummy/device/location"), u"label", u"vendor", + u"model", 12345 /* size */); storage_monitor::StorageInfo non_mtp_info( storage_monitor::StorageInfo::MakeDeviceId( storage_monitor::StorageInfo::FIXED_MASS_STORAGE, "dummy-device-id2"), - FILE_PATH_LITERAL("/dummy/device/location2"), base::UTF8ToUTF16("label2"), - base::UTF8ToUTF16("vendor2"), base::UTF8ToUTF16("model2"), - 12345 /* size */); + FILE_PATH_LITERAL("/dummy/device/location2"), u"label2", u"vendor2", + u"model2", 12345 /* size */); // Attach volume_manager()->OnRemovableStorageAttached(info); diff --git a/chrome/browser/chromeos/input_method/assistive_window_controller_unittest.cc b/chrome/browser/chromeos/input_method/assistive_window_controller_unittest.cc index b16956729fbef7..4ee3a121a6146a 100644 --- a/chrome/browser/chromeos/input_method/assistive_window_controller_unittest.cc +++ b/chrome/browser/chromeos/input_method/assistive_window_controller_unittest.cc @@ -93,7 +93,7 @@ class AssistiveWindowControllerTest : public ChromeAshTestBase { std::unique_ptr controller_; std::unique_ptr delegate_ = std::make_unique(); std::unique_ptr profile_; - const std::u16string suggestion_ = base::UTF8ToUTF16("test"); + const std::u16string suggestion_ = u"test"; ui::ime::AssistiveWindowButton emoji_button_; chromeos::AssistiveWindowProperties emoji_window_; TestTtsHandler* tts_handler_; @@ -166,8 +166,7 @@ TEST_F(AssistiveWindowControllerTest, AssistiveWindowProperties properties; properties.type = ui::ime::AssistiveWindowType::kEmojiSuggestion; properties.visible = true; - properties.candidates = - std::vector({base::UTF8ToUTF16("candidate")}); + properties.candidates = std::vector({u"candidate"}); ui::IMEBridge::Get() ->GetAssistiveWindowHandler() ->SetAssistiveWindowProperties(properties); diff --git a/chrome/browser/chromeos/input_method/emoji_suggester.cc b/chrome/browser/chromeos/input_method/emoji_suggester.cc index ecea1511b23140..571c04bbadfcfa 100644 --- a/chrome/browser/chromeos/input_method/emoji_suggester.cc +++ b/chrome/browser/chromeos/input_method/emoji_suggester.cc @@ -133,9 +133,8 @@ void EmojiSuggester::OnEmojiDataLoaded(const std::string& emoji_data) { std::string word = line.substr(0, comma_pos); std::u16string emojis = base::UTF8ToUTF16(line.substr(comma_pos + 1)); // Build emoji_map_ from splitting the string of emojis. - emoji_map_[word] = - base::SplitString(emojis, base::UTF8ToUTF16(";"), base::TRIM_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); + emoji_map_[word] = base::SplitString(emojis, u";", base::TRIM_WHITESPACE, + base::SPLIT_WANT_NONEMPTY); // TODO(crbug/1093179): Implement arrow to indicate more emojis available. // Only loads 5 emojis for now until arrow is implemented. if (emoji_map_[word].size() > kMaxCandidateSize) diff --git a/chrome/browser/chromeos/input_method/emoji_suggester_unittest.cc b/chrome/browser/chromeos/input_method/emoji_suggester_unittest.cc index 5ef340a9c4734a..527ea154a80e1d 100644 --- a/chrome/browser/chromeos/input_method/emoji_suggester_unittest.cc +++ b/chrome/browser/chromeos/input_method/emoji_suggester_unittest.cc @@ -135,15 +135,15 @@ class EmojiSuggesterTest : public testing::Test { }; TEST_F(EmojiSuggesterTest, SuggestWhenStringEndsWithSpace) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); } TEST_F(EmojiSuggesterTest, SuggestWhenStringStartsWithOpenBracket) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("(happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"(happy ")); } TEST_F(EmojiSuggesterTest, SuggestWhenStringEndsWithSpaceAndIsUppercase) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("HAPPY "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"HAPPY ")); } TEST_F(EmojiSuggesterTest, DoNotSuggestWhenStringEndsWithNewLine) { @@ -151,42 +151,42 @@ TEST_F(EmojiSuggesterTest, DoNotSuggestWhenStringEndsWithNewLine) { } TEST_F(EmojiSuggesterTest, DoNotSuggestWhenStringDoesNotEndWithSpace) { - EXPECT_FALSE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy"))); + EXPECT_FALSE(emoji_suggester_->Suggest(u"happy")); } TEST_F(EmojiSuggesterTest, DoNotSuggestWhenWordNotInMap) { - EXPECT_FALSE(emoji_suggester_->Suggest(base::UTF8ToUTF16("hapy "))); + EXPECT_FALSE(emoji_suggester_->Suggest(u"hapy ")); } TEST_F(EmojiSuggesterTest, DoNotShowSuggestionWhenVirtualKeyboardEnabled) { chrome_keyboard_controller_client_->set_keyboard_visible_for_test(true); - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); EXPECT_FALSE(emoji_suggester_->GetSuggestionShownForTesting()); } TEST_F(EmojiSuggesterTest, ReturnkBrowsingWhenPressingDown) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); ui::KeyEvent event = CreateKeyEventFromCode(ui::DomCode::ARROW_DOWN); EXPECT_EQ(SuggestionStatus::kBrowsing, emoji_suggester_->HandleKeyEvent(event)); } TEST_F(EmojiSuggesterTest, ReturnkBrowsingWhenPressingUp) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); ui::KeyEvent event = CreateKeyEventFromCode(ui::DomCode::ARROW_UP); EXPECT_EQ(SuggestionStatus::kBrowsing, emoji_suggester_->HandleKeyEvent(event)); } TEST_F(EmojiSuggesterTest, ReturnkDismissWhenPressingEsc) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); ui::KeyEvent event = CreateKeyEventFromCode(ui::DomCode::ESCAPE); EXPECT_EQ(SuggestionStatus::kDismiss, emoji_suggester_->HandleKeyEvent(event)); } TEST_F(EmojiSuggesterTest, ReturnkNotHandledWhenPressDownThenValidNumber) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); ui::KeyEvent event1 = CreateKeyEventFromCode(ui::DomCode::ARROW_DOWN); emoji_suggester_->HandleKeyEvent(event1); ui::KeyEvent event2 = CreateKeyEventFromCode(ui::DomCode::DIGIT1); @@ -195,7 +195,7 @@ TEST_F(EmojiSuggesterTest, ReturnkNotHandledWhenPressDownThenValidNumber) { } TEST_F(EmojiSuggesterTest, ReturnkNotHandledWhenPressDownThenNotANumber) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); ui::KeyEvent event1 = CreateKeyEventFromCode(ui::DomCode::ARROW_DOWN); emoji_suggester_->HandleKeyEvent(event1); ui::KeyEvent event2 = CreateKeyEventFromCode(ui::DomCode::US_A); @@ -205,7 +205,7 @@ TEST_F(EmojiSuggesterTest, ReturnkNotHandledWhenPressDownThenNotANumber) { TEST_F(EmojiSuggesterTest, ReturnkNotHandledWhenPressingEnterAndACandidateHasNotBeenChosen) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); ui::KeyEvent event = CreateKeyEventFromCode(ui::DomCode::ENTER); EXPECT_EQ(SuggestionStatus::kNotHandled, emoji_suggester_->HandleKeyEvent(event)); @@ -213,7 +213,7 @@ TEST_F(EmojiSuggesterTest, TEST_F(EmojiSuggesterTest, ReturnkAcceptWhenPressingEnterAndACandidateHasBeenChosenByPressingDown) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); // Press ui::DomCode::ARROW_DOWN to choose a candidate. ui::KeyEvent event1 = CreateKeyEventFromCode(ui::DomCode::ARROW_DOWN); emoji_suggester_->HandleKeyEvent(event1); @@ -223,13 +223,13 @@ TEST_F(EmojiSuggesterTest, } TEST_F(EmojiSuggesterTest, HighlightFirstCandidateWhenPressingDown) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); Press(ui::DomCode::ARROW_DOWN); engine_->VerifyCandidateHighlighted(0, true); } TEST_F(EmojiSuggesterTest, HighlightButtonCorrectlyWhenPressingUp) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); // Go into the window. Press(ui::DomCode::ARROW_DOWN); @@ -255,7 +255,7 @@ TEST_F(EmojiSuggesterTest, HighlightButtonCorrectlyWhenPressingUp) { } TEST_F(EmojiSuggesterTest, HighlightButtonCorrectlyWhenPressingDown) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); // Press ui::DomCode::ARROW_DOWN to go through candidates. for (size_t i = 0; i < emoji_suggester_->GetCandidatesSizeForTesting(); i++) { @@ -281,7 +281,7 @@ TEST_F(EmojiSuggesterTest, HighlightButtonCorrectlyWhenPressingDown) { TEST_F(EmojiSuggesterTest, OpenSettingWhenPressingEnterAndLearnMoreButtonIsChosen) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); // Go into the window. Press(ui::DomCode::ARROW_DOWN); @@ -293,42 +293,42 @@ TEST_F(EmojiSuggesterTest, } TEST_F(EmojiSuggesterTest, DoesNotShowIndicesWhenFirstSuggesting) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); engine_->VerifyShowIndices(false); } TEST_F(EmojiSuggesterTest, DoesNotShowIndexAfterPressingDown) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); Press(ui::DomCode::ARROW_DOWN); engine_->VerifyShowIndices(false); } TEST_F(EmojiSuggesterTest, DoesNotShowIndicesAfterGettingSuggestionsTwice) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); engine_->VerifyShowIndices(false); } TEST_F(EmojiSuggesterTest, DoesNotShowIndicesAfterPressingDownThenGetNewSuggestions) { - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); Press(ui::DomCode::ARROW_DOWN); - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); engine_->VerifyShowIndices(false); } TEST_F(EmojiSuggesterTest, ShowSettingLinkCorrectly) { for (int i = 0; i < kEmojiSuggesterShowSettingMaxCount; i++) { - emoji_suggester_->Suggest(base::UTF8ToUTF16("happy ")); + emoji_suggester_->Suggest(u"happy "); // Dismiss suggestion. Press(ui::DomCode::ESCAPE); engine_->VerifyShowSettingLink(true); } - emoji_suggester_->Suggest(base::UTF8ToUTF16("happy ")); + emoji_suggester_->Suggest(u"happy "); engine_->VerifyShowSettingLink(false); } @@ -336,7 +336,7 @@ TEST_F(EmojiSuggesterTest, RecordsTimeToAccept) { base::HistogramTester histogram_tester; histogram_tester.ExpectTotalCount("InputMethod.Assistive.TimeToAccept.Emoji", 0); - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); // Press ui::DomCode::ARROW_DOWN to choose and accept a candidate. Press(ui::DomCode::ARROW_DOWN); Press(ui::DomCode::ENTER); @@ -348,7 +348,7 @@ TEST_F(EmojiSuggesterTest, RecordsTimeToDismiss) { base::HistogramTester histogram_tester; histogram_tester.ExpectTotalCount("InputMethod.Assistive.TimeToDismiss.Emoji", 0); - EXPECT_TRUE(emoji_suggester_->Suggest(base::UTF8ToUTF16("happy "))); + EXPECT_TRUE(emoji_suggester_->Suggest(u"happy ")); // Press ui::DomCode::ESCAPE to dismiss. Press(ui::DomCode::ESCAPE); histogram_tester.ExpectTotalCount("InputMethod.Assistive.TimeToDismiss.Emoji", diff --git a/chrome/browser/chromeos/input_method/grammar_service_client_unittest.cc b/chrome/browser/chromeos/input_method/grammar_service_client_unittest.cc index 786f702eeaf0bd..d1e6111249833d 100644 --- a/chrome/browser/chromeos/input_method/grammar_service_client_unittest.cc +++ b/chrome/browser/chromeos/input_method/grammar_service_client_unittest.cc @@ -44,7 +44,7 @@ TEST_F(GrammarServiceClientTest, ReturnsEmptyResultWhenSpellCheckIsDiabled) { base::RunLoop().RunUntilIdle(); client.RequestTextCheck( - profile.get(), base::UTF8ToUTF16("cat"), + profile.get(), u"cat", base::BindOnce( [](bool success, const std::vector& results) { EXPECT_FALSE(success); @@ -86,7 +86,7 @@ TEST_F(GrammarServiceClientTest, ParsesResults) { base::RunLoop().RunUntilIdle(); client.RequestTextCheck( - profile.get(), base::UTF8ToUTF16("fake input"), + profile.get(), u"fake input", base::BindOnce( [](bool success, const std::vector& results) { EXPECT_TRUE(success); @@ -95,8 +95,7 @@ TEST_F(GrammarServiceClientTest, ParsesResults) { EXPECT_EQ(results[0].location, 3); EXPECT_EQ(results[0].length, 5); ASSERT_EQ(results[0].replacements.size(), 1U); - EXPECT_EQ(results[0].replacements[0], - base::UTF8ToUTF16("fake replacement")); + EXPECT_EQ(results[0].replacements[0], u"fake replacement"); })); base::RunLoop().RunUntilIdle(); diff --git a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc index c7b3b8e41f41d9..1a2dfcd21dcb34 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc @@ -235,11 +235,10 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, // onSurroundingTextChange should be fired if SetSurroundingText is called. ExtensionTestMessageListener surrounding_text_listener( "onSurroundingTextChanged", false); - engine_handler->SetSurroundingText( - base::UTF8ToUTF16("text"), // Surrounding text. - 0, // focused position. - 1, // anchor position. - 0); // offset position. + engine_handler->SetSurroundingText(u"text", // Surrounding text. + 0, // focused position. + 1, // anchor position. + 0); // offset position. ASSERT_TRUE(surrounding_text_listener.WaitUntilSatisfied()); ASSERT_TRUE(surrounding_text_listener.was_satisfied()); @@ -625,7 +624,7 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, const ui::CompositionText& composition_text = mock_input_context->last_update_composition_arg().composition_text; - EXPECT_EQ(base::UTF8ToUTF16("COMPOSITION_TEXT"), composition_text.text); + EXPECT_EQ(u"COMPOSITION_TEXT", composition_text.text); const ui::ImeTextSpans ime_text_spans = composition_text.ime_text_spans; ASSERT_EQ(2U, ime_text_spans.size()); @@ -1063,28 +1062,20 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, ASSERT_EQ(4U, table.candidates().size()); - EXPECT_EQ(base::UTF8ToUTF16("CANDIDATE_1"), - table.candidates().at(0).value); - - EXPECT_EQ(base::UTF8ToUTF16("CANDIDATE_2"), - table.candidates().at(1).value); - EXPECT_EQ(base::UTF8ToUTF16("LABEL_2"), table.candidates().at(1).label); - - EXPECT_EQ(base::UTF8ToUTF16("CANDIDATE_3"), - table.candidates().at(2).value); - EXPECT_EQ(base::UTF8ToUTF16("LABEL_3"), table.candidates().at(2).label); - EXPECT_EQ(base::UTF8ToUTF16("ANNOTACTION_3"), - table.candidates().at(2).annotation); - - EXPECT_EQ(base::UTF8ToUTF16("CANDIDATE_4"), - table.candidates().at(3).value); - EXPECT_EQ(base::UTF8ToUTF16("LABEL_4"), table.candidates().at(3).label); - EXPECT_EQ(base::UTF8ToUTF16("ANNOTACTION_4"), - table.candidates().at(3).annotation); - EXPECT_EQ(base::UTF8ToUTF16("TITLE_4"), - table.candidates().at(3).description_title); - EXPECT_EQ(base::UTF8ToUTF16("BODY_4"), - table.candidates().at(3).description_body); + EXPECT_EQ(u"CANDIDATE_1", table.candidates().at(0).value); + + EXPECT_EQ(u"CANDIDATE_2", table.candidates().at(1).value); + EXPECT_EQ(u"LABEL_2", table.candidates().at(1).label); + + EXPECT_EQ(u"CANDIDATE_3", table.candidates().at(2).value); + EXPECT_EQ(u"LABEL_3", table.candidates().at(2).label); + EXPECT_EQ(u"ANNOTACTION_3", table.candidates().at(2).annotation); + + EXPECT_EQ(u"CANDIDATE_4", table.candidates().at(3).value); + EXPECT_EQ(u"LABEL_4", table.candidates().at(3).label); + EXPECT_EQ(u"ANNOTACTION_4", table.candidates().at(3).annotation); + EXPECT_EQ(u"TITLE_4", table.candidates().at(3).description_title); + EXPECT_EQ(u"BODY_4", table.candidates().at(3).description_body); } { SCOPED_TRACE("setCursorPosition test"); @@ -1289,7 +1280,7 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, const ui::CompositionText& composition_text = mock_input_context->last_update_composition_arg().composition_text; - EXPECT_EQ(base::UTF8ToUTF16("us"), composition_text.text); + EXPECT_EQ(u"us", composition_text.text); const ui::ImeTextSpans ime_text_spans = composition_text.ime_text_spans; ASSERT_EQ(1U, ime_text_spans.size()); @@ -1514,7 +1505,7 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, MojoInteractionTest) { ASSERT_TRUE( content::ExecuteScript(host->host_contents(), commit_text_test_script)); tic.WaitUntilCalled(); - EXPECT_EQ(base::UTF8ToUTF16("COMMIT_TEXT"), tic.inserted_text()); + EXPECT_EQ(u"COMMIT_TEXT", tic.inserted_text()); } { diff --git a/chrome/browser/chromeos/input_method/native_input_method_engine_browsertest.cc b/chrome/browser/chromeos/input_method/native_input_method_engine_browsertest.cc index d866da5ade2ce6..8f603b263c1c14 100644 --- a/chrome/browser/chromeos/input_method/native_input_method_engine_browsertest.cc +++ b/chrome/browser/chromeos/input_method/native_input_method_engine_browsertest.cc @@ -361,9 +361,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserEmail) { TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string prefix_text = base::UTF8ToUTF16("my email is "); - const std::u16string expected_result_text = - base::UTF8ToUTF16("my email is johnwayne@me.xyz"); + const std::u16string prefix_text = u"my email is "; + const std::u16string expected_result_text = u"my email is johnwayne@me.xyz"; helper.GetTextInputClient()->InsertText( prefix_text, @@ -404,9 +403,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string prefix_text = base::UTF8ToUTF16("my email is "); - const std::u16string expected_result_text = - base::UTF8ToUTF16("my email is john@abc.com"); + const std::u16string prefix_text = u"my email is "; + const std::u16string expected_result_text = u"my email is john@abc.com"; helper.GetTextInputClient()->InsertText( prefix_text, @@ -420,7 +418,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, DispatchKeyPress(ui::VKEY_DOWN, false); DispatchKeyPress(ui::VKEY_RETURN, false); helper.GetTextInputClient()->InsertText( - base::UTF8ToUTF16("john@abc.com"), + u"john@abc.com", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); helper.WaitForSurroundingTextChanged(expected_result_text); @@ -440,7 +438,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) { autofill::AutofillProfile autofill_profile(base::GenerateGUID(), autofill::test::kEmptyOrigin); autofill_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, - base::UTF8ToUTF16("John Wayne")); + u"John Wayne"); autofill::PersonalDataManagerFactory::GetForProfile(profile_)->AddProfile( autofill_profile); personal_data_observer.Wait(); @@ -450,9 +448,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) { TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string prefix_text = base::UTF8ToUTF16("my name is "); - const std::u16string expected_result_text = - base::UTF8ToUTF16("my name is John Wayne"); + const std::u16string prefix_text = u"my name is "; + const std::u16string expected_result_text = u"my name is John Wayne"; helper.GetTextInputClient()->InsertText( prefix_text, @@ -467,9 +464,9 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestUserName) { // Keep typing helper.GetTextInputClient()->InsertText( - base::UTF8ToUTF16("jo"), + u"jo", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); - helper.WaitForSurroundingTextChanged(base::UTF8ToUTF16("my name is jo")); + helper.WaitForSurroundingTextChanged(u"my name is jo"); DispatchKeyPress(ui::VKEY_DOWN, false); DispatchKeyPress(ui::VKEY_RETURN, false); @@ -526,8 +523,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, SuggestEmoji) { engine_->Enable(kEngineIdUs); TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string prefix_text = base::UTF8ToUTF16("happy "); - const std::u16string expected_result_text = base::UTF8ToUTF16("happy 😀"); + const std::u16string prefix_text = u"happy "; + const std::u16string expected_result_text = u"happy 😀"; helper.GetTextInputClient()->InsertText( prefix_text, @@ -559,8 +556,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, engine_->Enable(kEngineIdUs); TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string prefix_text = base::UTF8ToUTF16("happy "); - const std::u16string expected_result_text = base::UTF8ToUTF16("happy a"); + const std::u16string prefix_text = u"happy "; + const std::u16string expected_result_text = u"happy a"; helper.GetTextInputClient()->InsertText( prefix_text, @@ -568,7 +565,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, helper.WaitForSurroundingTextChanged(prefix_text); // Types something random to dismiss emoji helper.GetTextInputClient()->InsertText( - base::UTF8ToUTF16("a"), + u"a", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); helper.WaitForSurroundingTextChanged(expected_result_text); @@ -711,7 +708,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, engine_->Enable(kEngineIdUs); TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string prefix_text = base::UTF8ToUTF16("corrected "); + const std::u16string prefix_text = u"corrected "; helper.GetTextInputClient()->InsertText( prefix_text, ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); @@ -728,7 +725,7 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, // Move cursor back into the autocorrected word to show the window. helper.GetTextInputClient()->ExtendSelectionAndDelete(1, 0); - helper.WaitForSurroundingTextChanged(base::UTF8ToUTF16("corrected")); + helper.WaitForSurroundingTextChanged(u"corrected"); EXPECT_TRUE(controller->GetUndoWindowForTesting()); EXPECT_TRUE(controller->GetUndoWindowForTesting()->GetVisible()); @@ -740,9 +737,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, RevertsAutocorrect) { engine_->Enable(kEngineIdUs); TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string corrected_text = - base::UTF8ToUTF16("hello corrected world"); - const std::u16string typed_text = base::UTF8ToUTF16("hello typed world"); + const std::u16string corrected_text = u"hello corrected world"; + const std::u16string typed_text = u"hello typed world"; helper.GetTextInputClient()->InsertText( corrected_text, ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); @@ -782,8 +778,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string corrected_text = base::UTF8ToUTF16("corrected"); - const std::u16string typed_text = base::UTF8ToUTF16("typed"); + const std::u16string corrected_text = u"corrected"; + const std::u16string typed_text = u"typed"; helper.GetTextInputClient()->InsertText( corrected_text, ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); @@ -823,8 +819,8 @@ IN_PROC_BROWSER_TEST_F(NativeInputMethodEngineTest, TextInputTestHelper helper(GetBrowserInputMethod()); SetUpTextInput(helper); - const std::u16string corrected_text = base::UTF8ToUTF16("corrected"); - const std::u16string typed_text = base::UTF8ToUTF16("typed"); + const std::u16string corrected_text = u"corrected"; + const std::u16string typed_text = u"typed"; helper.GetTextInputClient()->InsertText( corrected_text, ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); diff --git a/chrome/browser/chromeos/input_method/personal_info_suggester_unittest.cc b/chrome/browser/chromeos/input_method/personal_info_suggester_unittest.cc index 62b83ed80ab4a3..debd0760d15634 100644 --- a/chrome/browser/chromeos/input_method/personal_info_suggester_unittest.cc +++ b/chrome/browser/chromeos/input_method/personal_info_suggester_unittest.cc @@ -179,13 +179,12 @@ class PersonalInfoSuggesterTest : public testing::Test { autofill::TestAutofillClient autofill_client_; std::unique_ptr personal_data_; - const std::u16string email_ = base::UTF8ToUTF16("johnwayne@me.xyz"); - const std::u16string first_name_ = base::UTF8ToUTF16("John"); - const std::u16string last_name_ = base::UTF8ToUTF16("Wayne"); - const std::u16string full_name_ = base::UTF8ToUTF16("John Wayne"); - const std::u16string address_ = - base::UTF8ToUTF16("1 Dream Road, Hollywood, CA 12345"); - const std::u16string phone_number_ = base::UTF8ToUTF16("16505678910"); + const std::u16string email_ = u"johnwayne@me.xyz"; + const std::u16string first_name_ = u"John"; + const std::u16string last_name_ = u"Wayne"; + const std::u16string full_name_ = u"John Wayne"; + const std::u16string address_ = u"1 Dream Road, Hollywood, CA 12345"; + const std::u16string phone_number_ = u"16505678910"; }; TEST_F(PersonalInfoSuggesterTest, SuggestEmail) { @@ -196,15 +195,15 @@ TEST_F(PersonalInfoSuggesterTest, SuggestEmail) { profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); suggestion_handler_->VerifySuggestion(email_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("My email is: ")); + suggester_->Suggest(u"My email is: "); suggestion_handler_->VerifySuggestion(email_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("hi, my email: ")); + suggester_->Suggest(u"hi, my email: "); suggestion_handler_->VerifySuggestion(email_, 0); } @@ -216,7 +215,7 @@ TEST_F(PersonalInfoSuggesterTest, DoNotSuggestEmailWhenFlagIsDisabled) { profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -228,10 +227,10 @@ TEST_F(PersonalInfoSuggesterTest, DoNotSuggestEmailWhenPrefixDoesNotMatch) { profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is John")); + suggester_->Suggest(u"my email is John"); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("our email is: ")); + suggester_->Suggest(u"our email is: "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -244,7 +243,7 @@ TEST_F(PersonalInfoSuggesterTest, DoNotSuggestWhenVirtualKeyboardEnabled) { chrome_keyboard_controller_client_->set_keyboard_visible_for_test(true); profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -258,7 +257,7 @@ TEST_F(PersonalInfoSuggesterTest, chrome_keyboard_controller_client_->set_keyboard_visible_for_test(true); profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); suggestion_handler_->VerifySuggestionDispatchedToExtension( std::vector{base::UTF16ToUTF8(email_)}); } @@ -277,19 +276,19 @@ TEST_F(PersonalInfoSuggesterTest, SuggestNames) { autofill_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, full_name_); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my first name is ")); + suggester_->Suggest(u"my first name is "); suggestion_handler_->VerifySuggestion(first_name_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("my last name is: ")); + suggester_->Suggest(u"my last name is: "); suggestion_handler_->VerifySuggestion(last_name_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("my name is ")); + suggester_->Suggest(u"my name is "); suggestion_handler_->VerifySuggestion(full_name_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("Hmm... my FULL name: ")); + suggester_->Suggest(u"Hmm... my FULL name: "); suggestion_handler_->VerifySuggestion(full_name_, 0); } @@ -307,7 +306,7 @@ TEST_F(PersonalInfoSuggesterTest, SuggestNamesButInsufficientData) { chromeos::AssistiveType::kPersonalName, 0); - suggester_->Suggest(base::UTF8ToUTF16("my name is ")); + suggester_->Suggest(u"my name is "); histogram_tester.ExpectUniqueSample("InputMethod.Assistive.InsufficientData", chromeos::AssistiveType::kPersonalName, 1); @@ -327,13 +326,13 @@ TEST_F(PersonalInfoSuggesterTest, DoNotSuggestNamesWhenFlagIsDisabled) { autofill_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, full_name_); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my first name is ")); + suggester_->Suggest(u"my first name is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("my last name is: ")); + suggester_->Suggest(u"my last name is: "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("my name is ")); + suggester_->Suggest(u"my name is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -351,16 +350,16 @@ TEST_F(PersonalInfoSuggesterTest, DoNotSuggestNamesWhenPrefixDoesNotMatch) { autofill_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, full_name_); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("our first name is ")); + suggester_->Suggest(u"our first name is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("our last name is: ")); + suggester_->Suggest(u"our last name is: "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("our name is ")); + suggester_->Suggest(u"our name is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("our full name: ")); + suggester_->Suggest(u"our full name: "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -374,34 +373,34 @@ TEST_F(PersonalInfoSuggesterTest, SuggestAddress) { autofill::AutofillProfile autofill_profile(base::GenerateGUID(), autofill::test::kEmptyOrigin); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_LINE1, - base::UTF8ToUTF16("1 Dream Road")); + u"1 Dream Road"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_CITY, - base::UTF8ToUTF16("Hollywood")); + u"Hollywood"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_ZIP, - base::UTF8ToUTF16("12345")); + u"12345"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_STATE, - base::UTF8ToUTF16("CA")); + u"CA"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_COUNTRY, - base::UTF8ToUTF16("US")); + u"US"); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my address is ")); + suggester_->Suggest(u"my address is "); suggestion_handler_->VerifySuggestion(address_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("our address is: ")); + suggester_->Suggest(u"our address is: "); suggestion_handler_->VerifySuggestion(address_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("my shipping address: ")); + suggester_->Suggest(u"my shipping address: "); suggestion_handler_->VerifySuggestion(address_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("our billing address is ")); + suggester_->Suggest(u"our billing address is "); suggestion_handler_->VerifySuggestion(address_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("my current address: ")); + suggester_->Suggest(u"my current address: "); suggestion_handler_->VerifySuggestion(address_, 0); } @@ -415,18 +414,18 @@ TEST_F(PersonalInfoSuggesterTest, DoNotSuggestAddressWhenFlagIsDisabled) { autofill::AutofillProfile autofill_profile(base::GenerateGUID(), autofill::test::kEmptyOrigin); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_LINE1, - base::UTF8ToUTF16("1 Dream Road")); + u"1 Dream Road"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_CITY, - base::UTF8ToUTF16("Hollywood")); + u"Hollywood"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_ZIP, - base::UTF8ToUTF16("12345")); + u"12345"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_STATE, - base::UTF8ToUTF16("CA")); + u"CA"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_COUNTRY, - base::UTF8ToUTF16("US")); + u"US"); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my address is ")); + suggester_->Suggest(u"my address is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -440,24 +439,24 @@ TEST_F(PersonalInfoSuggesterTest, DoNotSuggestAddressWhenPrefixDoesNotMatch) { autofill::AutofillProfile autofill_profile(base::GenerateGUID(), autofill::test::kEmptyOrigin); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_LINE1, - base::UTF8ToUTF16("1 Dream Road")); + u"1 Dream Road"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_CITY, - base::UTF8ToUTF16("Hollywood")); + u"Hollywood"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_ZIP, - base::UTF8ToUTF16("12345")); + u"12345"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_STATE, - base::UTF8ToUTF16("CA")); + u"CA"); autofill_profile.SetRawInfo(autofill::ServerFieldType::ADDRESS_HOME_COUNTRY, - base::UTF8ToUTF16("US")); + u"US"); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my address ")); + suggester_->Suggest(u"my address "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("my last address is: ")); + suggester_->Suggest(u"my last address is: "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("our address number is ")); + suggester_->Suggest(u"our address number is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -473,23 +472,23 @@ TEST_F(PersonalInfoSuggesterTest, SuggestPhoneNumber) { autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, phone_number_); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my phone number is ")); + suggester_->Suggest(u"my phone number is "); suggestion_handler_->VerifySuggestion(phone_number_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("my number is ")); + suggester_->Suggest(u"my number is "); suggestion_handler_->VerifySuggestion(phone_number_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("my mobile number is: ")); + suggester_->Suggest(u"my mobile number is: "); suggestion_handler_->VerifySuggestion(phone_number_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("my number: ")); + suggester_->Suggest(u"my number: "); suggestion_handler_->VerifySuggestion(phone_number_, 0); SendKeyboardEvent(ui::DomCode::ESCAPE); - suggester_->Suggest(base::UTF8ToUTF16("my telephone number is ")); + suggester_->Suggest(u"my telephone number is "); suggestion_handler_->VerifySuggestion(phone_number_, 0); } @@ -506,7 +505,7 @@ TEST_F(PersonalInfoSuggesterTest, DoNotSuggestPhoneNumberWhenFlagIsDisabled) { autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, phone_number_); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my phone number is ")); + suggester_->Suggest(u"my phone number is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -523,16 +522,16 @@ TEST_F(PersonalInfoSuggesterTest, autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, phone_number_); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("our phone number is ")); + suggester_->Suggest(u"our phone number is "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("my number ")); + suggester_->Suggest(u"my number "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("my number phone is: ")); + suggester_->Suggest(u"my number phone is: "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); - suggester_->Suggest(base::UTF8ToUTF16("my phone phone: ")); + suggester_->Suggest(u"my phone phone: "); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); } @@ -544,7 +543,7 @@ TEST_F(PersonalInfoSuggesterTest, AcceptSuggestionWithDownEnter) { profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); SendKeyboardEvent(ui::DomCode::ARROW_DOWN); SendKeyboardEvent(ui::DomCode::ENTER); @@ -563,7 +562,7 @@ TEST_F(PersonalInfoSuggesterTest, AcceptSuggestionWithUpEnter) { update->SetIntKey(kPersonalInfoSuggesterAcceptanceCount, 1); profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); SendKeyboardEvent(ui::DomCode::ARROW_UP); SendKeyboardEvent(ui::DomCode::ENTER); @@ -582,7 +581,7 @@ TEST_F(PersonalInfoSuggesterTest, DismissSuggestion) { autofill_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, full_name_); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my name is ")); + suggester_->Suggest(u"my name is "); SendKeyboardEvent(ui::DomCode::ESCAPE); suggestion_handler_->VerifySuggestion(base::EmptyString16(), 0); EXPECT_FALSE(suggestion_handler_->IsSuggestionAccepted()); @@ -600,8 +599,8 @@ TEST_F(PersonalInfoSuggesterTest, SuggestWithConfirmedLength) { autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, phone_number_); personal_data_->AddProfile(autofill_profile); - suggester_->Suggest(base::UTF8ToUTF16("my phone number is ")); - suggester_->Suggest(base::UTF8ToUTF16("my phone number is 16")); + suggester_->Suggest(u"my phone number is "); + suggester_->Suggest(u"my phone number is 16"); suggestion_handler_->VerifySuggestion(phone_number_, 2); } @@ -616,7 +615,7 @@ TEST_F(PersonalInfoSuggesterTest, profile_->GetPrefs()->SetBoolean( ash::prefs::kAccessibilitySpokenFeedbackEnabled, false); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(5000)); tts_handler_->VerifyAnnouncement(""); @@ -636,7 +635,7 @@ TEST_F(PersonalInfoSuggesterTest, AnnounceSpokenFeedbackWhenChromeVoxIsOn) { profile_->GetPrefs()->SetBoolean( ash::prefs::kAccessibilitySpokenFeedbackEnabled, true); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(500)); tts_handler_->VerifyAnnouncement(""); @@ -649,7 +648,7 @@ TEST_F(PersonalInfoSuggesterTest, AnnounceSpokenFeedbackWhenChromeVoxIsOn) { task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(200)); tts_handler_->VerifyAnnouncement("Suggestion inserted."); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); task_environment_.FastForwardBy(base::TimeDelta::FromMilliseconds(1500)); tts_handler_->VerifyAnnouncement( "Personal info suggested. Press down arrow to access; escape to ignore."); @@ -665,12 +664,12 @@ TEST_F(PersonalInfoSuggesterTest, DoNotShowAnnotationAfterMaxAcceptanceCount) { /*disabled_features=*/{}); for (int i = 0; i < kMaxAcceptanceCount; i++) { - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); SendKeyboardEvent(ui::DomCode::ARROW_DOWN); SendKeyboardEvent(ui::DomCode::ENTER); suggestion_handler_->VerifyShowAnnotation(true); } - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); suggestion_handler_->VerifyShowAnnotation(false); } @@ -685,12 +684,12 @@ TEST_F(PersonalInfoSuggesterTest, ShowSettingLink) { update->RemoveKey(kPersonalInfoSuggesterShowSettingCount); update->RemoveKey(kPersonalInfoSuggesterAcceptanceCount); for (int i = 0; i < kMaxShowSettingCount; i++) { - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); // Dismiss suggestion. SendKeyboardEvent(ui::DomCode::ESCAPE); suggestion_handler_->VerifyShowSettingLink(true); } - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); suggestion_handler_->VerifyShowSettingLink(false); } @@ -703,12 +702,12 @@ TEST_F(PersonalInfoSuggesterTest, DoNotShowSettingLinkAfterAcceptance) { DictionaryPrefUpdate update(profile_->GetPrefs(), prefs::kAssistiveInputFeatureSettings); update->SetIntKey(kPersonalInfoSuggesterShowSettingCount, 0); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); suggestion_handler_->VerifyShowSettingLink(true); // Accept suggestion. SendKeyboardEvent(ui::DomCode::ARROW_DOWN); SendKeyboardEvent(ui::DomCode::ENTER); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); suggestion_handler_->VerifyShowSettingLink(false); } @@ -724,7 +723,7 @@ TEST_F(PersonalInfoSuggesterTest, ClickSettingsWithDownDownEnter) { update->RemoveKey(kPersonalInfoSuggesterAcceptanceCount); profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); SendKeyboardEvent(ui::DomCode::ARROW_DOWN); SendKeyboardEvent(ui::DomCode::ARROW_DOWN); SendKeyboardEvent(ui::DomCode::ENTER); @@ -745,7 +744,7 @@ TEST_F(PersonalInfoSuggesterTest, ClickSettingsWithUpEnter) { update->RemoveKey(kPersonalInfoSuggesterAcceptanceCount); profile_->set_profile_name(base::UTF16ToUTF8(email_)); - suggester_->Suggest(base::UTF8ToUTF16("my email is ")); + suggester_->Suggest(u"my email is "); SendKeyboardEvent(ui::DomCode::ARROW_UP); SendKeyboardEvent(ui::DomCode::ENTER); @@ -765,7 +764,7 @@ TEST_F(PersonalInfoSuggesterTest, RecordsTimeToAccept) { profile_->set_profile_name(base::UTF16ToUTF8(email_)); - EXPECT_TRUE(suggester_->Suggest(base::UTF8ToUTF16("my email is "))); + EXPECT_TRUE(suggester_->Suggest(u"my email is ")); // Press ui::DomCode::ARROW_DOWN to choose and accept the suggestion. SendKeyboardEvent(ui::DomCode::ARROW_DOWN); @@ -786,7 +785,7 @@ TEST_F(PersonalInfoSuggesterTest, RecordsTimeToDismiss) { profile_->set_profile_name(base::UTF16ToUTF8(email_)); - EXPECT_TRUE(suggester_->Suggest(base::UTF8ToUTF16("my email is "))); + EXPECT_TRUE(suggester_->Suggest(u"my email is ")); // Press ui::DomCode::ESCAPE to dismiss. SendKeyboardEvent(ui::DomCode::ESCAPE); histogram_tester.ExpectTotalCount( diff --git a/chrome/browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc b/chrome/browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc index c5a16147b5f938..b084b8d96670c6 100644 --- a/chrome/browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc +++ b/chrome/browser/chromeos/input_method/textinput_surroundingtext_browsertest.cc @@ -35,8 +35,8 @@ IN_PROC_BROWSER_TEST_F(TextInput_SurroundingTextChangedTest, helper.WaitForTextInputStateChanged(ui::TEXT_INPUT_TYPE_TEXT_AREA); EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT_AREA, helper.GetTextInputType()); - const std::u16string sample_text1 = base::UTF8ToUTF16("abcde"); - const std::u16string sample_text2 = base::UTF8ToUTF16("fghij"); + const std::u16string sample_text1 = u"abcde"; + const std::u16string sample_text2 = u"fghij"; const std::u16string surrounding_text2 = sample_text1 + sample_text2; gfx::Range expected_range1(5, 5); gfx::Range expected_range2(10, 10); @@ -76,7 +76,7 @@ IN_PROC_BROWSER_TEST_F(TextInput_SurroundingTextChangedTest, helper.WaitForTextInputStateChanged(ui::TEXT_INPUT_TYPE_TEXT_AREA); EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT_AREA, helper.GetTextInputType()); - const std::u16string sample_text = base::UTF8ToUTF16("abcde"); + const std::u16string sample_text = u"abcde"; gfx::Range expected_range(5, 5); ui::CompositionText composition_text; @@ -122,7 +122,7 @@ IN_PROC_BROWSER_TEST_F(TextInput_SurroundingTextChangedTest, // Click textarea containing text, so expecting new surrounding text comes. helper.ClickElement("filled_textarea", tab); - const std::u16string expected_text = base::UTF8ToUTF16("abcde"); + const std::u16string expected_text = u"abcde"; const gfx::Range expected_range(5, 5); helper.WaitForSurroundingTextChanged(expected_text, expected_range); EXPECT_EQ(expected_text, helper.GetSurroundingText()); diff --git a/chrome/browser/chromeos/input_method/ui/candidate_window_view_unittest.cc b/chrome/browser/chromeos/input_method/ui/candidate_window_view_unittest.cc index 54ba37af1efc4a..e15fb0e43faec8 100644 --- a/chrome/browser/chromeos/input_method/ui/candidate_window_view_unittest.cc +++ b/chrome/browser/chromeos/input_method/ui/candidate_window_view_unittest.cc @@ -289,20 +289,19 @@ TEST_F(CandidateWindowViewTest, DoNotChangeRowHeightWithLabelSwitchTest) { ui::CandidateWindow candidate_window; ui::CandidateWindow no_shortcut_candidate_window; - const std::u16string kSampleCandidate1 = base::UTF8ToUTF16("Sample String 1"); + const std::u16string kSampleCandidate1 = u"Sample String 1"; const std::u16string kSampleCandidate2 = base::UTF8ToUTF16("\xE3\x81\x82"); // multi byte string. - const std::u16string kSampleCandidate3 = base::UTF8ToUTF16("....."); + const std::u16string kSampleCandidate3 = u"....."; - const std::u16string kSampleShortcut1 = base::UTF8ToUTF16("1"); - const std::u16string kSampleShortcut2 = base::UTF8ToUTF16("b"); - const std::u16string kSampleShortcut3 = base::UTF8ToUTF16("C"); + const std::u16string kSampleShortcut1 = u"1"; + const std::u16string kSampleShortcut2 = u"b"; + const std::u16string kSampleShortcut3 = u"C"; - const std::u16string kSampleAnnotation1 = - base::UTF8ToUTF16("Sample Annotation 1"); + const std::u16string kSampleAnnotation1 = u"Sample Annotation 1"; const std::u16string kSampleAnnotation2 = base::UTF8ToUTF16("\xE3\x81\x82"); // multi byte string. - const std::u16string kSampleAnnotation3 = base::UTF8ToUTF16("......"); + const std::u16string kSampleAnnotation3 = u"......"; // Create CandidateWindow object. InitCandidateWindow(kPageSize, &candidate_window); diff --git a/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl_unittest.cc b/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl_unittest.cc index b2dbd5ad55cfcd..0d03a499ea1411 100644 --- a/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl_unittest.cc +++ b/chrome/browser/chromeos/phonehub/browser_tabs_metadata_fetcher_impl_unittest.cc @@ -178,16 +178,16 @@ class BrowserTabsMetadataFetcherImplTest : public testing::Test { }; TEST_F(BrowserTabsMetadataFetcherImplTest, NewFetchDuringOldFetchInProgress) { - const std::u16string kTitleA = base::UTF8ToUTF16("A"); + const std::u16string kTitleA = u"A"; const GURL kUrlA = GURL("http://a.com"); - const std::u16string kTitleB = base::UTF8ToUTF16("B"); + const std::u16string kTitleB = u"B"; const GURL kUrlB = GURL("http://b.com"); - const std::u16string kTitleC = base::UTF8ToUTF16("C"); + const std::u16string kTitleC = u"C"; const GURL kUrlC = GURL("http://c.com"); - const std::u16string kTitleD = base::UTF8ToUTF16("D"); + const std::u16string kTitleD = u"D"; const GURL kUrlD = GURL("http://d.com"); auto synced_session_window = @@ -243,10 +243,10 @@ TEST_F(BrowserTabsMetadataFetcherImplTest, NoTabsOpen) { } TEST_F(BrowserTabsMetadataFetcherImplTest, BelowMaximumNumberOfTabs) { - const std::u16string kTitleC = base::UTF8ToUTF16("C"); + const std::u16string kTitleC = u"C"; const GURL kUrlC = GURL("http://c.com"); - const std::u16string kTitleD = base::UTF8ToUTF16("D"); + const std::u16string kTitleD = u"D"; const GURL kUrlD = GURL("http://d.com"); auto synced_session_window = @@ -267,22 +267,22 @@ TEST_F(BrowserTabsMetadataFetcherImplTest, BelowMaximumNumberOfTabs) { } TEST_F(BrowserTabsMetadataFetcherImplTest, ExceedMaximumNumberOfTabs) { - const std::u16string kTitleA = base::UTF8ToUTF16("A"); + const std::u16string kTitleA = u"A"; const GURL kUrlA = GURL("http://a.com"); - const std::u16string kTitleB = base::UTF8ToUTF16("B"); + const std::u16string kTitleB = u"B"; const GURL kUrlB = GURL("http://b.com"); - const std::u16string kTitleC = base::UTF8ToUTF16("C"); + const std::u16string kTitleC = u"C"; const GURL kUrlC = GURL("http://c.com"); - const std::u16string kTitleD = base::UTF8ToUTF16("D"); + const std::u16string kTitleD = u"D"; const GURL kUrlD = GURL("http://d.com"); - const std::u16string kTitleE = base::UTF8ToUTF16("E"); + const std::u16string kTitleE = u"E"; const GURL kUrlE = GURL(chrome::kChromeUINewTabURL); - const std::u16string kTitleF = base::UTF8ToUTF16("F"); + const std::u16string kTitleF = u"F"; const GURL kUrlF = GURL("content://image.png"); auto synced_session_window = @@ -311,16 +311,16 @@ TEST_F(BrowserTabsMetadataFetcherImplTest, ExceedMaximumNumberOfTabs) { } TEST_F(BrowserTabsMetadataFetcherImplTest, MultipleWindows) { - const std::u16string kTitleB = base::UTF8ToUTF16("B"); + const std::u16string kTitleB = u"B"; const GURL kUrlB = GURL("http://b.com"); - const std::u16string kTitleC = base::UTF8ToUTF16("C"); + const std::u16string kTitleC = u"C"; const GURL kUrlC = GURL("http://c.com"); - const std::u16string kTitleD = base::UTF8ToUTF16("D"); + const std::u16string kTitleD = u"D"; const GURL kUrlD = GURL("http://d.com"); - const std::u16string kTitleE = base::UTF8ToUTF16("E"); + const std::u16string kTitleE = u"E"; const GURL kUrlE = GURL("http://e.com"); auto synced_session_window_one = diff --git a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc index c99162a8b6c569..6d92f8fba1e434 100644 --- a/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc +++ b/chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller_browsertest.cc @@ -164,7 +164,7 @@ class DataTransferDlpBrowserTest : public LoginPolicyTestBase { params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; widget_->Init(std::move(params)); textfield_ = widget_->SetContentsView(std::make_unique()); - textfield_->SetAccessibleName(base::UTF8ToUTF16("Textfield")); + textfield_->SetAccessibleName(u"Textfield"); textfield_->SetFocusBehavior(views::View::FocusBehavior::ALWAYS); // Show the widget. diff --git a/chrome/browser/chromeos/policy/dlp/dlp_content_manager_browsertest.cc b/chrome/browser/chromeos/policy/dlp/dlp_content_manager_browsertest.cc index 5b31eddcf24c97..f0eb48a8ac4db7 100644 --- a/chrome/browser/chromeos/policy/dlp/dlp_content_manager_browsertest.cc +++ b/chrome/browser/chromeos/policy/dlp/dlp_content_manager_browsertest.cc @@ -296,8 +296,8 @@ IN_PROC_BROWSER_TEST_F(DlpContentManagerBrowserTest, browser()->window()->GetNativeWindow()->GetRootWindow(); const auto media_id = content::DesktopMediaID::RegisterNativeWindow( content::DesktopMediaID::TYPE_SCREEN, root_window); - manager->OnScreenCaptureStarted( - "label", {media_id}, base::UTF8ToUTF16("example.com"), base::DoNothing()); + manager->OnScreenCaptureStarted("label", {media_id}, u"example.com", + base::DoNothing()); EXPECT_FALSE(display_service_tester.GetNotification( kScreenCapturePausedNotificationId)); diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc index 871954b6f0c4cf..26f7bdbd2838c6 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc @@ -162,8 +162,8 @@ class UserCloudPolicyManagerChromeOSTest GetIdentityTestEnvironmentFactories(); profile_ = profile_manager_->CreateTestingProfile( chrome::kInitialProfile, - std::unique_ptr(), - base::UTF8ToUTF16(""), 0, std::string(), std::move(factories)); + std::unique_ptr(), u"", 0, + std::string(), std::move(factories)); identity_test_env_profile_adaptor_ = std::make_unique(profile_); diff --git a/chrome/browser/chromeos/ui/echo_dialog_view_unittest.cc b/chrome/browser/chromeos/ui/echo_dialog_view_unittest.cc index 09dbd6cc20ab7c..f3cb4f7265ae38 100644 --- a/chrome/browser/chromeos/ui/echo_dialog_view_unittest.cc +++ b/chrome/browser/chromeos/ui/echo_dialog_view_unittest.cc @@ -65,8 +65,8 @@ using EchoDialogViewTest = views::ViewsTestBase; TEST_F(EchoDialogViewTest, EnabledHasEnabledText) { EchoDialogView::Params params; params.echo_enabled = true; - params.service_name = base::UTF8ToUTF16("$service"); - params.origin = base::UTF8ToUTF16("$origin"); + params.service_name = u"$service"; + params.origin = u"$origin"; TestEchoDialogListener listener; EchoDialogView dialog(&listener, params); @@ -83,8 +83,8 @@ TEST_F(EchoDialogViewTest, EnabledHasEnabledText) { TEST_F(EchoDialogViewTest, DisabledHasDisabledText) { EchoDialogView::Params params; params.echo_enabled = false; - params.service_name = base::UTF8ToUTF16("$service"); - params.origin = base::UTF8ToUTF16("$origin"); + params.service_name = u"$service"; + params.origin = u"$origin"; TestEchoDialogListener listener; EchoDialogView dialog(&listener, params); diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index 6637de5698f70a..412a7d3988a084 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc @@ -1020,7 +1020,7 @@ IN_PROC_BROWSER_TEST_F(ContentSettingsTest, ContentSettingsBlockDataURLs) { content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); - ASSERT_EQ(base::UTF8ToUTF16("Data URL"), web_contents->GetTitle()); + ASSERT_EQ(u"Data URL", web_contents->GetTitle()); EXPECT_TRUE( PageSpecificContentSettings::GetForFrame(web_contents->GetMainFrame()) diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index 5ce090bfd786cb..b77900fa23a5fc 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -4543,8 +4543,8 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, CrossOriginDownloadNavigatesIframe) { // Clicking the in the iframe should navigate the iframe, // not the main frame. - std::u16string expected_title(base::UTF8ToUTF16("Loaded as iframe")); - std::u16string failed_title(base::UTF8ToUTF16("Loaded as main frame")); + std::u16string expected_title(u"Loaded as iframe"); + std::u16string failed_title(u"Loaded as main frame"); content::TitleWatcher title_watcher(web_contents, expected_title); title_watcher.AlsoWaitForTitle(failed_title); render_frame_host->ExecuteJavaScriptForTests(base::ASCIIToUTF16("runTest();"), diff --git a/chrome/browser/enterprise/connectors/analysis/analysis_service_settings_unittest.cc b/chrome/browser/enterprise/connectors/analysis/analysis_service_settings_unittest.cc index da4e7300ed8085..a666ccfcbbece4 100644 --- a/chrome/browser/enterprise/connectors/analysis/analysis_service_settings_unittest.cc +++ b/chrome/browser/enterprise/connectors/analysis/analysis_service_settings_unittest.cc @@ -152,7 +152,7 @@ AnalysisSettings* NormalDlpAndMalwareSettings() { AnalysisSettings* NormalSettingsWithCustomMessage() { static base::NoDestructor settings([]() { AnalysisSettings settings = NormalSettingsWithTags({"dlp", "malware"}); - settings.custom_message_text = base::UTF8ToUTF16("abcèéç"); + settings.custom_message_text = u"abcèéç"; return settings; }()); return settings.get(); diff --git a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc index 6d013815a34d30..4c79bc05683879 100644 --- a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc +++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate_unittest.cc @@ -1241,7 +1241,7 @@ TEST_F(ContentAnalysisDelegateAuditOnlyTest, NoDelay) { ASSERT_TRUE( ContentAnalysisDelegate::IsEnabled(profile(), url, &data, FILE_ATTACHED)); - data.text.emplace_back(base::UTF8ToUTF16("dlp_text")); + data.text.emplace_back(u"dlp_text"); CreateFilesForTest({FILE_PATH_LITERAL("foo_fail_malware_0.doc"), FILE_PATH_LITERAL("foo_fail_malware_1.doc"), FILE_PATH_LITERAL("foo_fail_malware_2.doc"), diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc index 3fd4dd32f2eef0..544901804fe1d8 100644 --- a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc +++ b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc @@ -279,20 +279,15 @@ TEST_F(ExtensionInfoGeneratorUnitTest, BasicInfoTest) { ErrorConsole* error_console = ErrorConsole::Get(profile()); const GURL kContextUrl("http://example.com"); error_console->ReportError(std::make_unique( - extension->id(), false, base::UTF8ToUTF16("source"), - base::UTF8ToUTF16("message"), - StackTrace(1, StackFrame(1, 1, base::UTF8ToUTF16("source"), - base::UTF8ToUTF16("function"))), - kContextUrl, logging::LOG_ERROR, 1, 1)); + extension->id(), false, u"source", u"message", + StackTrace(1, StackFrame(1, 1, u"source", u"function")), kContextUrl, + logging::LOG_ERROR, 1, 1)); error_console->ReportError(std::make_unique( - extension->id(), base::UTF8ToUTF16("message"), base::UTF8ToUTF16("key"), - std::u16string())); + extension->id(), u"message", u"key", std::u16string())); error_console->ReportError(std::make_unique( - extension->id(), false, base::UTF8ToUTF16("source"), - base::UTF8ToUTF16("message"), - StackTrace(1, StackFrame(1, 1, base::UTF8ToUTF16("source"), - base::UTF8ToUTF16("function"))), - kContextUrl, logging::LOG_WARNING, 1, 1)); + extension->id(), false, u"source", u"message", + StackTrace(1, StackFrame(1, 1, u"source", u"function")), kContextUrl, + logging::LOG_WARNING, 1, 1)); // It's not feasible to validate every field here, because that would be // a duplication of the logic in the method itself. Instead, test a handful diff --git a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc index 30a229356302b7..e3f6fb0dd8f846 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc @@ -154,7 +154,7 @@ TEST(FileSystemApiUnitTest, FileSystemChooseEntryFunctionFileTypeInfoTest) { FileSystemChooseEntryFunction::BuildFileTypeInfo(&file_type_info, base::FilePath::StringType(), &options, &acceptsAllTypes); EXPECT_EQ(file_type_info.extension_description_overrides[0], - base::UTF8ToUTF16("File Types 101")); + u"File Types 101"); } TEST(FileSystemApiUnitTest, FileSystemChooseEntryFunctionSuggestionTest) { diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc index c2dbafd2da2997..67cb61806ccb1d 100644 --- a/chrome/browser/extensions/crx_installer_browsertest.cc +++ b/chrome/browser/extensions/crx_installer_browsertest.cc @@ -230,7 +230,7 @@ class ManagementPolicyMock : public extensions::ManagementPolicy::Provider { bool UserMayLoad(const Extension* extension, std::u16string* error) const override { if (error) - *error = base::UTF8ToUTF16("Dummy error message"); + *error = u"Dummy error message"; return false; } }; diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc index 6dbf824bcba9a4..627c24c509ae50 100644 --- a/chrome/browser/extensions/extension_context_menu_browsertest.cc +++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc @@ -667,15 +667,12 @@ IN_PROC_BROWSER_TEST_P(ExtensionContextMenuLazyTest, TopLevel) { ASSERT_TRUE(menu->GetMenuModelAndItemIndex( ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0), &model, &index)); - EXPECT_EQ(base::UTF8ToUTF16("An Extension with multiple Context Menus"), + EXPECT_EQ(u"An Extension with multiple Context Menus", model->GetLabelAt(index++)); - EXPECT_EQ(base::UTF8ToUTF16("Context Menu #1 - Extension #2"), - model->GetLabelAt(index++)); - EXPECT_EQ(base::UTF8ToUTF16("Context Menu #2 - Extension #3"), - model->GetLabelAt(index++)); - EXPECT_EQ(base::UTF8ToUTF16("Context Menu #3 - Extension #1"), - model->GetLabelAt(index++)); - EXPECT_EQ(base::UTF8ToUTF16("Ze Extension with multiple Context Menus"), + EXPECT_EQ(u"Context Menu #1 - Extension #2", model->GetLabelAt(index++)); + EXPECT_EQ(u"Context Menu #2 - Extension #3", model->GetLabelAt(index++)); + EXPECT_EQ(u"Context Menu #3 - Extension #1", model->GetLabelAt(index++)); + EXPECT_EQ(u"Ze Extension with multiple Context Menus", model->GetLabelAt(index++)); } @@ -787,7 +784,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionContextMenuPersistentTest, Separators) { ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0), &model, &index)); - EXPECT_EQ(base::UTF8ToUTF16("parent"), model->GetLabelAt(index)); + EXPECT_EQ(u"parent", model->GetLabelAt(index)); submenu = model->GetSubmenuModelAt(index); ASSERT_TRUE(submenu); VerifyMenuForSeparatorsTest(*submenu); diff --git a/chrome/browser/extensions/extension_error_ui_default_unittest.cc b/chrome/browser/extensions/extension_error_ui_default_unittest.cc index ea732f3fa73b4c..5d89fef961d191 100644 --- a/chrome/browser/extensions/extension_error_ui_default_unittest.cc +++ b/chrome/browser/extensions/extension_error_ui_default_unittest.cc @@ -56,13 +56,12 @@ TEST(ExtensionErrorUIDefaultTest, BubbleTitleAndMessageMentionsExtension) { std::vector messages = bubble->GetBubbleViewMessages(); - EXPECT_THAT( - messages, - testing::ElementsAre( - l10n_util::GetStringFUTF16(IDS_EXTENSION_ALERT_ITEM_BLOCKLISTED_OTHER, - base::UTF8ToUTF16("Bar")), - l10n_util::GetStringFUTF16(IDS_EXTENSION_ALERT_ITEM_BLOCKLISTED_OTHER, - base::UTF8ToUTF16("Baz")))); + EXPECT_THAT(messages, + testing::ElementsAre( + l10n_util::GetStringFUTF16( + IDS_EXTENSION_ALERT_ITEM_BLOCKLISTED_OTHER, u"Bar"), + l10n_util::GetStringFUTF16( + IDS_EXTENSION_ALERT_ITEM_BLOCKLISTED_OTHER, u"Baz"))); } TEST(ExtensionErrorUIDefaultTest, BubbleTitleAndMessageMentionsApp) { @@ -82,8 +81,7 @@ TEST(ExtensionErrorUIDefaultTest, BubbleTitleAndMessageMentionsApp) { std::vector messages = bubble->GetBubbleViewMessages(); EXPECT_THAT(messages, testing::ElementsAre(l10n_util::GetStringFUTF16( - IDS_APP_ALERT_ITEM_BLOCKLISTED_OTHER, - base::UTF8ToUTF16("Bar")))); + IDS_APP_ALERT_ITEM_BLOCKLISTED_OTHER, u"Bar"))); } TEST(ExtensionErrorUIDefaultTest, BubbleMessageMentionsMalware) { diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 7f986695eb7137..304689c6fed350 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -5196,8 +5196,8 @@ namespace { void CreateDatabase(storage::DatabaseTracker* db_tracker, const std::string& origin_id) { DCHECK(db_tracker->task_runner()->RunsTasksInCurrentSequence()); - std::u16string db_name = base::UTF8ToUTF16("db"); - std::u16string description = base::UTF8ToUTF16("db_description"); + std::u16string db_name = u"db"; + std::u16string description = u"db_description"; int64_t size; db_tracker->DatabaseOpened(origin_id, db_name, description, &size); db_tracker->DatabaseClosed(origin_id, db_name); diff --git a/chrome/browser/extensions/forced_extensions/force_installed_test_base.cc b/chrome/browser/extensions/forced_extensions/force_installed_test_base.cc index c30b2e22f051b2..000619056b1c66 100644 --- a/chrome/browser/extensions/forced_extensions/force_installed_test_base.cc +++ b/chrome/browser/extensions/forced_extensions/force_installed_test_base.cc @@ -48,9 +48,8 @@ void ForceInstalledTestBase::SetUp() { TestingBrowserProcess::GetGlobal()); ASSERT_TRUE(profile_manager_->SetUp()); profile_ = profile_manager_->CreateTestingProfile( - "p1", nullptr, base::UTF8ToUTF16("p1"), 0, "", - TestingProfile::TestingFactories(), base::nullopt, - std::move(policy_service)); + "p1", nullptr, u"p1", 0, "", TestingProfile::TestingFactories(), + base::nullopt, std::move(policy_service)); prefs_ = profile_->GetTestingPrefService(); registry_ = ExtensionRegistry::Get(profile_); diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index 96bc5643563355..ef22c1b57f229d 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -637,9 +637,8 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, EventDispatchToTab) { BookmarkModel* bookmark_model = BookmarkModelFactory::GetForBrowserContext(browser()->profile()); bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model); - bookmarks::AddIfNotBookmarked(bookmark_model, - GURL("http://www.google.com"), - base::UTF8ToUTF16("Google")); + bookmarks::AddIfNotBookmarked(bookmark_model, GURL("http://www.google.com"), + u"Google"); EXPECT_TRUE(event_page_ready.WaitUntilSatisfied()); diff --git a/chrome/browser/extensions/plugin_manager.cc b/chrome/browser/extensions/plugin_manager.cc index f0516b391045a1..812253e0992d6e 100644 --- a/chrome/browser/extensions/plugin_manager.cc +++ b/chrome/browser/extensions/plugin_manager.cc @@ -166,7 +166,7 @@ void PluginManager::UpdatePluginListWithNaClModules() { content::WebPluginMimeType mime_type_info; mime_type_info.mime_type = iter->mime_type; mime_type_info.additional_params.emplace_back( - base::UTF8ToUTF16("nacl"), base::UTF8ToUTF16(iter->url.spec())); + u"nacl", base::UTF8ToUTF16(iter->url.spec())); info.mime_types.emplace_back(std::move(mime_type_info)); } diff --git a/chrome/browser/history/history_tab_helper_unittest.cc b/chrome/browser/history/history_tab_helper_unittest.cc index 96a34c5b7fc8a9..648c377be77b5c 100644 --- a/chrome/browser/history/history_tab_helper_unittest.cc +++ b/chrome/browser/history/history_tab_helper_unittest.cc @@ -82,7 +82,7 @@ TEST_F(HistoryTabHelperTest, ShouldUpdateTitleInHistory) { web_contents()->GetController().GetLastCommittedEntry(); ASSERT_NE(nullptr, entry); - web_contents()->UpdateTitleForEntry(entry, base::UTF8ToUTF16("title1")); + web_contents()->UpdateTitleForEntry(entry, u"title1"); EXPECT_EQ("title1", QueryPageTitleFromHistory(page_url_)); } @@ -103,7 +103,7 @@ TEST_F(HistoryTabHelperTest, ShouldLimitTitleUpdatesPerPage) { ASSERT_EQ("title10", QueryPageTitleFromHistory(page_url_)); // Furhter updates should be ignored. - web_contents()->UpdateTitleForEntry(entry, base::UTF8ToUTF16("title11")); + web_contents()->UpdateTitleForEntry(entry, u"title11"); EXPECT_EQ("title10", QueryPageTitleFromHistory(page_url_)); } diff --git a/chrome/browser/loader/signed_exchange_policy_browsertest.cc b/chrome/browser/loader/signed_exchange_policy_browsertest.cc index 0525a0a3e9e382..1fc90d2858f00c 100644 --- a/chrome/browser/loader/signed_exchange_policy_browsertest.cc +++ b/chrome/browser/loader/signed_exchange_policy_browsertest.cc @@ -92,7 +92,7 @@ IN_PROC_BROWSER_TEST_F(SignedExchangePolicyBrowserTest, BlackList) { ui_test_utils::NavigateToURL(browser(), url); - std::u16string blocked_page_title(base::UTF8ToUTF16("test.example.org")); + std::u16string blocked_page_title(u"test.example.org"); EXPECT_EQ(blocked_page_title, contents->GetTitle()); // Verify that the expected error page is being displayed. diff --git a/chrome/browser/media/webrtc/display_media_access_handler_unittest.cc b/chrome/browser/media/webrtc/display_media_access_handler_unittest.cc index 8c7ced99a5da97..3f4273d37b3217 100644 --- a/chrome/browser/media/webrtc/display_media_access_handler_unittest.cc +++ b/chrome/browser/media/webrtc/display_media_access_handler_unittest.cc @@ -254,7 +254,7 @@ TEST_F(DisplayMediaAccessHandlerTest, CorrectHostAsksForPermissions) { access_handler_->UpdateMediaRequestState( render_process_id, render_frame_id, page_request_id, video_stream_type, content::MEDIA_REQUEST_STATE_CLOSING); - EXPECT_EQ(base::UTF8ToUTF16("http://127.0.0.1:8000"), params.app_name); + EXPECT_EQ(u"http://127.0.0.1:8000", params.app_name); } TEST_F(DisplayMediaAccessHandlerTest, CorrectHostAsksForPermissionsNormalURLs) { @@ -288,7 +288,7 @@ TEST_F(DisplayMediaAccessHandlerTest, CorrectHostAsksForPermissionsNormalURLs) { access_handler_->UpdateMediaRequestState( render_process_id, render_frame_id, page_request_id, video_stream_type, content::MEDIA_REQUEST_STATE_CLOSING); - EXPECT_EQ(base::UTF8ToUTF16("www.google.com"), params.app_name); + EXPECT_EQ(u"www.google.com", params.app_name); } TEST_F(DisplayMediaAccessHandlerTest, WebContentsDestroyed) { diff --git a/chrome/browser/media/webrtc/native_desktop_media_list_unittest.cc b/chrome/browser/media/webrtc/native_desktop_media_list_unittest.cc index ba9d1413e3bdba..1916f181cbc527 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list_unittest.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list_unittest.cc @@ -305,7 +305,7 @@ class NativeDesktopMediaListTest : public ChromeViewsTestBase { for (size_t i = 0; i < window_count; ++i) { EXPECT_EQ(model_->GetSource(i).id.type, DesktopMediaID::TYPE_WINDOW); - EXPECT_EQ(model_->GetSource(i).name, base::UTF8ToUTF16("Test window")); + EXPECT_EQ(model_->GetSource(i).name, u"Test window"); int index = has_view_dialog ? i + 1 : i; int native_id = window_list_[index].id; EXPECT_EQ(model_->GetSource(i).id.id, native_id); diff --git a/chrome/browser/media/webrtc/tab_desktop_media_list_unittest.cc b/chrome/browser/media/webrtc/tab_desktop_media_list_unittest.cc index 285f3d7c54b400..e4933c1f47eb79 100644 --- a/chrome/browser/media/webrtc/tab_desktop_media_list_unittest.cc +++ b/chrome/browser/media/webrtc/tab_desktop_media_list_unittest.cc @@ -334,7 +334,7 @@ TEST_F(TabDesktopMediaListTest, UpdateTitle) { base::RunLoop().Run(); - EXPECT_EQ(list_->GetSource(0).name, base::UTF8ToUTF16("New test tab")); + EXPECT_EQ(list_->GetSource(0).name, u"New test tab"); list_.reset(); } diff --git a/chrome/browser/metrics/plugin_metrics_provider_unittest.cc b/chrome/browser/metrics/plugin_metrics_provider_unittest.cc index 44360f58399c41..07c84957238486 100644 --- a/chrome/browser/metrics/plugin_metrics_provider_unittest.cc +++ b/chrome/browser/metrics/plugin_metrics_provider_unittest.cc @@ -172,7 +172,7 @@ TEST_F(PluginMetricsProviderTest, ProvideStabilityMetricsWhenPendingTask) { abnormal_termination_info.exit_code = 1; content::ChildProcessData child_process_data1( content::PROCESS_TYPE_PPAPI_PLUGIN); - child_process_data1.name = base::UTF8ToUTF16("p1"); + child_process_data1.name = u"p1"; provider.BrowserChildProcessHostConnected(child_process_data1); provider.BrowserChildProcessCrashed(child_process_data1, abnormal_termination_info); @@ -183,7 +183,7 @@ TEST_F(PluginMetricsProviderTest, ProvideStabilityMetricsWhenPendingTask) { content::ChildProcessData child_process_data2( content::PROCESS_TYPE_PPAPI_PLUGIN); - child_process_data2.name = base::UTF8ToUTF16("p2"); + child_process_data2.name = u"p2"; provider.BrowserChildProcessHostConnected(child_process_data2); provider.BrowserChildProcessCrashed(child_process_data2, abnormal_termination_info); diff --git a/chrome/browser/mouse_events_interactive_uitest.cc b/chrome/browser/mouse_events_interactive_uitest.cc index b60608d9a1d728..480a2842fdd74a 100644 --- a/chrome/browser/mouse_events_interactive_uitest.cc +++ b/chrome/browser/mouse_events_interactive_uitest.cc @@ -188,7 +188,7 @@ IN_PROC_BROWSER_TEST_F(MouseEventsTest, MAYBE_ModalDialog) { base::RunLoop dialog_wait; js_dialog_manager->SetDialogShownCallbackForTesting( dialog_wait.QuitClosure()); - tab->GetMainFrame()->ExecuteJavaScriptForTests(base::UTF8ToUTF16("alert()"), + tab->GetMainFrame()->ExecuteJavaScriptForTests(u"alert()", base::NullCallback()); dialog_wait.Run(); diff --git a/chrome/browser/notifications/notification_platform_bridge_linux.cc b/chrome/browser/notifications/notification_platform_bridge_linux.cc index a642b0a8da158e..226ba1972cf8b7 100644 --- a/chrome/browser/notifications/notification_platform_bridge_linux.cc +++ b/chrome/browser/notifications/notification_platform_bridge_linux.cc @@ -129,7 +129,7 @@ std::u16string CreateNotificationTitle( std::u16string title; if (notification.type() == message_center::NOTIFICATION_TYPE_PROGRESS) { title += base::FormatPercent(notification.progress()); - title += base::UTF8ToUTF16(" - "); + title += u" - "; } title += notification.title(); return title; diff --git a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc index 3ff59568f81b1a..ee1c844a5e5e6a 100644 --- a/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc +++ b/chrome/browser/notifications/notification_platform_bridge_linux_unittest.cc @@ -509,7 +509,7 @@ TEST_F(NotificationPlatformBridgeLinuxTest, ProgressPercentageAddedToSummary) { NotificationBuilder("") .SetType(message_center::NOTIFICATION_TYPE_PROGRESS) .SetProgress(42) - .SetTitle(base::UTF8ToUTF16("The Title")) + .SetTitle(u"The Title") .GetResult(), nullptr); } @@ -529,8 +529,7 @@ TEST_F(NotificationPlatformBridgeLinuxTest, NotificationListItemsInBody) { NotificationBuilder("") .SetType(message_center::NOTIFICATION_TYPE_MULTIPLE) .SetItems(std::vector{ - {base::UTF8ToUTF16("abc"), base::UTF8ToUTF16("123")}, - {base::UTF8ToUTF16("def"), base::UTF8ToUTF16("456")}}) + {u"abc", u"123"}, {u"def", u"456"}}) .GetResult(), nullptr); } diff --git a/chrome/browser/notifications/notification_platform_bridge_mac.mm b/chrome/browser/notifications/notification_platform_bridge_mac.mm index 4151b15d357d40..568393de7669e6 100644 --- a/chrome/browser/notifications/notification_platform_bridge_mac.mm +++ b/chrome/browser/notifications/notification_platform_bridge_mac.mm @@ -128,7 +128,7 @@ @interface NotificationCenterDelegate std::u16string context_message = notification.items().empty() ? notification.message() - : (notification.items().at(0).title + base::UTF8ToUTF16(" - ") + + : (notification.items().at(0).title + u" - " + notification.items().at(0).message); [builder setContextMessage:base::SysUTF16ToNSString(context_message)]; diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm b/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm index 47658b082dcb68..4d633be4dc72e1 100644 --- a/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm +++ b/chrome/browser/notifications/notification_platform_bridge_mac_unittest.mm @@ -108,9 +108,8 @@ static void StoreNotificationCount(int* out_notification_count, auto notification = std::make_unique( message_center::NOTIFICATION_TYPE_SIMPLE, "id1", base::UTF8ToUTF16(title), base::UTF8ToUTF16(subtitle), gfx::Image(), - base::UTF8ToUTF16("Notifier's Name"), url, - message_center::NotifierId(url), optional_fields, - new message_center::NotificationDelegate()); + u"Notifier's Name", url, message_center::NotifierId(url), + optional_fields, new message_center::NotificationDelegate()); if (require_interaction) notification->set_never_timeout(true); @@ -266,8 +265,7 @@ new NotificationPlatformBridgeMac(notification_center(), ASSERT_EQ(1u, [displayedAlerts count]); NSDictionary* deliveredNotification = [displayedAlerts objectAtIndex:0]; - std::u16string expected = - base::FormatPercent(kSamplePercent) + base::UTF8ToUTF16(" - Title"); + std::u16string expected = base::FormatPercent(kSamplePercent) + u" - Title"; EXPECT_NSEQ(base::SysUTF16ToNSString(expected), [deliveredNotification objectForKey:@"title"]); } diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_unnotification.mm b/chrome/browser/notifications/notification_platform_bridge_mac_unnotification.mm index a771b600d9ccf7..ff78c350e567e5 100644 --- a/chrome/browser/notifications/notification_platform_bridge_mac_unnotification.mm +++ b/chrome/browser/notifications/notification_platform_bridge_mac_unnotification.mm @@ -105,7 +105,7 @@ - (instancetype)initWithNotificationClosedHandler: std::u16string context_message = notification.items().empty() ? notification.message() - : (notification.items().at(0).title + base::UTF8ToUTF16(" - ") + + : (notification.items().at(0).title + u" - " + notification.items().at(0).message); bool is_alert = IsAlertNotificationMac(notification); diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_unnotification_unittest.mm b/chrome/browser/notifications/notification_platform_bridge_mac_unnotification_unittest.mm index 0679a6f8798c4e..dae63d3ccc932e 100644 --- a/chrome/browser/notifications/notification_platform_bridge_mac_unnotification_unittest.mm +++ b/chrome/browser/notifications/notification_platform_bridge_mac_unnotification_unittest.mm @@ -62,9 +62,8 @@ Notification CreateNotification(const std::string& notificationId = "id1") { GURL url("https://gmail.com"); Notification notification( - message_center::NOTIFICATION_TYPE_SIMPLE, notificationId, - base::UTF8ToUTF16("Title"), base::UTF8ToUTF16("Context"), gfx::Image(), - base::UTF8ToUTF16("Notifier's Name"), url, + message_center::NOTIFICATION_TYPE_SIMPLE, notificationId, u"Title", + u"Context", gfx::Image(), u"Notifier's Name", url, message_center::NotifierId(url), message_center::RichNotificationData(), base::MakeRefCounted()); @@ -524,8 +523,8 @@ Notification CreateAlert(const std::string& notificationId = "id1") { notification.set_settings_button_handler( message_center::SettingsButtonHandler::DELEGATE); std::vector buttons = { - message_center::ButtonInfo(base::UTF8ToUTF16("Button 1")), - message_center::ButtonInfo(base::UTF8ToUTF16("Button 2"))}; + message_center::ButtonInfo(u"Button 1"), + message_center::ButtonInfo(u"Button 2")}; notification.set_buttons(buttons); bridge_->Display(NotificationHandler::Type::WEB_PERSISTENT, profile_, diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_utils.mm b/chrome/browser/notifications/notification_platform_bridge_mac_utils.mm index ad0db259032ee6..f130d29a3eb858 100644 --- a/chrome/browser/notifications/notification_platform_bridge_mac_utils.mm +++ b/chrome/browser/notifications/notification_platform_bridge_mac_utils.mm @@ -77,7 +77,7 @@ bool MacOSSupportsXPCAlertsImpl() { if (notification.type() == message_center::NOTIFICATION_TYPE_PROGRESS && notification.progress() >= 0 && notification.progress() <= 100) { title += base::FormatPercent(notification.progress()); - title += base::UTF8ToUTF16(" - "); + title += u" - "; } title += notification.title(); return title; diff --git a/chrome/browser/notifications/notification_platform_bridge_mac_utils_unittest.mm b/chrome/browser/notifications/notification_platform_bridge_mac_utils_unittest.mm index 0f132b6833ec4a..599a94acdafc72 100644 --- a/chrome/browser/notifications/notification_platform_bridge_mac_utils_unittest.mm +++ b/chrome/browser/notifications/notification_platform_bridge_mac_utils_unittest.mm @@ -46,8 +46,8 @@ Notification CreateNotification( Notification notification( type, "test_id", base::UTF8ToUTF16(title), base::UTF8ToUTF16(subtitle), - gfx::Image(), base::UTF8ToUTF16("Notifier's Name"), url, - message_center::NotifierId(url), message_center::RichNotificationData(), + gfx::Image(), u"Notifier's Name", url, message_center::NotifierId(url), + message_center::RichNotificationData(), /*delegate=*/nullptr); if (type == message_center::NOTIFICATION_TYPE_PROGRESS) @@ -93,7 +93,7 @@ Notification notification( message_center::NOTIFICATION_TYPE_SIMPLE, /*progress=*/0, /*contextMessage=*/base::nullopt); std::u16string createdTitle = CreateMacNotificationTitle(notification); - EXPECT_EQ(base::UTF8ToUTF16("Title"), createdTitle); + EXPECT_EQ(u"Title", createdTitle); } TEST_F(NotificationPlatformBridgeMacUtilsTest, @@ -103,7 +103,7 @@ Notification notification( message_center::NOTIFICATION_TYPE_PROGRESS, /*progress=*/50, /*contextMessage=*/base::nullopt); std::u16string createdTitle = CreateMacNotificationTitle(notification); - EXPECT_EQ(base::UTF8ToUTF16("50% - Title"), createdTitle); + EXPECT_EQ(u"50% - Title", createdTitle); } TEST_F(NotificationPlatformBridgeMacUtilsTest, @@ -114,7 +114,7 @@ Notification notification( /*contextMessage=*/base::nullopt); std::u16string createdContext = CreateMacNotificationContext( /*isPersistent=*/false, notification, /*requiresAttribution=*/true); - EXPECT_EQ(base::UTF8ToUTF16("moe.example.com"), createdContext); + EXPECT_EQ(u"moe.example.com", createdContext); } TEST_F(NotificationPlatformBridgeMacUtilsTest, @@ -125,7 +125,7 @@ Notification notification( /*contextMessage=*/base::nullopt); std::u16string createdContext = CreateMacNotificationContext( /*isPersistent=*/true, notification, /*requiresAttribution=*/true); - EXPECT_EQ(base::UTF8ToUTF16("moe.example.com"), createdContext); + EXPECT_EQ(u"moe.example.com", createdContext); } TEST_F(NotificationPlatformBridgeMacUtilsTest, @@ -137,7 +137,7 @@ Notification notification( /*contextMessage=*/"moe"); std::u16string createdContext = CreateMacNotificationContext( /*isPersistent=*/false, notification, /*requiresAttribution=*/false); - EXPECT_EQ(base::UTF8ToUTF16("moe"), createdContext); + EXPECT_EQ(u"moe", createdContext); } TEST_F(NotificationPlatformBridgeMacUtilsTest, @@ -149,14 +149,14 @@ Notification notification( /*contextMessage=*/base::nullopt); std::u16string createdContext = CreateMacNotificationContext( /*isPersistent=*/false, notification, /*requiresAttribution=*/true); - EXPECT_EQ(base::UTF8ToUTF16("example.com"), createdContext); + EXPECT_EQ(u"example.com", createdContext); // Should also work if the eTLD is in the format of '/+.+/' notification.set_origin_url(GURL( "https://thisisareallyreallyreaaalllyyylongorigin.moe.example.co.uk/")); createdContext = CreateMacNotificationContext( /*isPersistent=*/false, notification, /*requiresAttribution=*/true); - EXPECT_EQ(base::UTF8ToUTF16("example.co.uk"), createdContext); + EXPECT_EQ(u"example.co.uk", createdContext); } TEST_F(NotificationPlatformBridgeMacUtilsTest, @@ -167,12 +167,12 @@ Notification notification( /*contextMessage=*/base::nullopt); std::u16string createdContext = CreateMacNotificationContext( /*isPersistent=*/true, notification, /*requiresAttribution=*/true); - EXPECT_EQ(base::UTF8ToUTF16("moe.co.uk"), createdContext); + EXPECT_EQ(u"moe.co.uk", createdContext); // For banners this should pass createdContext = CreateMacNotificationContext( /*isPersistent=*/false, notification, /*requiresAttribution=*/true); - EXPECT_EQ(base::UTF8ToUTF16("thisisalongorigin.moe.co.uk"), createdContext); + EXPECT_EQ(u"thisisalongorigin.moe.co.uk", createdContext); } TEST_F(NotificationPlatformBridgeMacUtilsTest, @@ -183,12 +183,12 @@ Notification notification( /*contextMessage=*/base::nullopt); std::u16string createdContext = CreateMacNotificationContext( /*isPersistent=*/true, notification, /*requiresAttribution=*/true); - EXPECT_EQ(base::UTF8ToUTF16("moe.co.uk"), createdContext); + EXPECT_EQ(u"moe.co.uk", createdContext); // It should get the eTLD+1 for banners too createdContext = CreateMacNotificationContext( /*isPersistent=*/false, notification, /*requiresAttribution=*/true); - EXPECT_EQ(base::UTF8ToUTF16("moe.co.uk"), createdContext); + EXPECT_EQ(u"moe.co.uk", createdContext); } TEST_F(NotificationPlatformBridgeMacUtilsTest, diff --git a/chrome/browser/notifications/notification_ui_manager_browsertest.cc b/chrome/browser/notifications/notification_ui_manager_browsertest.cc index 34e4831accdcf8..8e5c15f39bb93f 100644 --- a/chrome/browser/notifications/notification_ui_manager_browsertest.cc +++ b/chrome/browser/notifications/notification_ui_manager_browsertest.cc @@ -86,9 +86,9 @@ class NotificationUIManagerBrowserTest : public InProcessBrowserTest { return Notification( message_center::NOTIFICATION_TYPE_SIMPLE, id, base::ASCIIToUTF16("title"), base::ASCIIToUTF16("message"), - gfx::Image(), base::UTF8ToUTF16("chrome-test://testing/"), - GURL("chrome-test://testing/"), message_center::NotifierId(), - message_center::RichNotificationData(), new_delegate); + gfx::Image(), u"chrome-test://testing/", GURL("chrome-test://testing/"), + message_center::NotifierId(), message_center::RichNotificationData(), + new_delegate); } Notification CreateRichTestNotification(const std::string& id, @@ -104,8 +104,7 @@ class NotificationUIManagerBrowserTest : public InProcessBrowserTest { return Notification( message_center::NOTIFICATION_TYPE_BASE_FORMAT, id, base::ASCIIToUTF16("title"), base::ASCIIToUTF16("message"), - gfx::Image(), base::UTF8ToUTF16("chrome-test://testing/"), - GURL("chrome-test://testing/"), + gfx::Image(), u"chrome-test://testing/", GURL("chrome-test://testing/"), message_center::NotifierId(message_center::NotifierType::APPLICATION, "extension_id"), data, new_delegate); diff --git a/chrome/browser/notifications/scheduler/internal/notification_store_unittest.cc b/chrome/browser/notifications/scheduler/internal/notification_store_unittest.cc index 8654d311c426c6..97057a83f36e5a 100644 --- a/chrome/browser/notifications/scheduler/internal/notification_store_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/notification_store_unittest.cc @@ -151,7 +151,7 @@ TEST_F(NotificationStoreTest, AddAndUpdate) { VerifyDataInDb(std::move(expected)); // Update and verified the new data. - entry.notification_data.title = base::UTF8ToUTF16("test_title"); + entry.notification_data.title = u"test_title"; expected = std::make_unique(); expected->emplace_back(entry); store()->Update(kGuid, entry, diff --git a/chrome/browser/notifications/scheduler/internal/proto_conversion_unittest.cc b/chrome/browser/notifications/scheduler/internal/proto_conversion_unittest.cc index ae803f20950222..81dc145456f8f3 100644 --- a/chrome/browser/notifications/scheduler/internal/proto_conversion_unittest.cc +++ b/chrome/browser/notifications/scheduler/internal/proto_conversion_unittest.cc @@ -183,8 +183,8 @@ TEST(ProtoConversionTest, NotificationEntryConversion) { TestNotificationEntryConversion(&entry); // Test notification data. - entry.notification_data.title = base::UTF8ToUTF16("title"); - entry.notification_data.message = base::UTF8ToUTF16("message"); + entry.notification_data.title = u"title"; + entry.notification_data.message = u"message"; entry.icons_uuid.emplace(IconType::kSmallIcon, "small_icon_uuid"); entry.icons_uuid.emplace(IconType::kLargeIcon, "large_icon_uuid"); entry.notification_data.custom_data = {{"url", "https://www.example.com"}}; diff --git a/chrome/browser/notifications/scheduler/notification_schedule_service_browsertest.cc b/chrome/browser/notifications/scheduler/notification_schedule_service_browsertest.cc index 774d21a1b75e98..ed6e8ab4c87ac6 100644 --- a/chrome/browser/notifications/scheduler/notification_schedule_service_browsertest.cc +++ b/chrome/browser/notifications/scheduler/notification_schedule_service_browsertest.cc @@ -171,8 +171,8 @@ class NotificationScheduleServiceTest : public InProcessBrowserTest { schedule_params.deliver_time_end = base::Time::Now() + base::TimeDelta::FromMinutes(5); NotificationData data; - data.title = base::UTF8ToUTF16("title"); - data.message = base::UTF8ToUTF16("message"); + data.title = u"title"; + data.message = u"message"; auto params = std::make_unique( notifications::SchedulerClientType::kTest1, std::move(data), std::move(schedule_params)); diff --git a/chrome/browser/offline_pages/offline_page_mhtml_archiver_unittest.cc b/chrome/browser/offline_pages/offline_page_mhtml_archiver_unittest.cc index 22042c28632a27..6fedf151e00557 100644 --- a/chrome/browser/offline_pages/offline_page_mhtml_archiver_unittest.cc +++ b/chrome/browser/offline_pages/offline_page_mhtml_archiver_unittest.cc @@ -34,7 +34,7 @@ const char kTestURL[] = "http://example.com/hello.mhtml"; const char kNonExistentURL[] = "http://example.com/non_existent.mhtml"; // Size of chrome/test/data/offline_pages/hello.mhtml const int64_t kTestFileSize = 471LL; -const std::u16string kTestTitle = base::UTF8ToUTF16("a title"); +const std::u16string kTestTitle = u"a title"; // SHA256 Hash of chrome/test/data/offline_pages/hello.mhtml const std::string kTestDigest( "\x43\x60\x62\x02\x06\x15\x0f\x3e\x77\x99\x3d\xed\xdc\xd4\xe2\x0d\xbe\xbd" diff --git a/chrome/browser/offline_pages/prefetch/prefetched_pages_notifier_unittest.cc b/chrome/browser/offline_pages/prefetch/prefetched_pages_notifier_unittest.cc index 10777b4defd701..63e74ab575d836 100644 --- a/chrome/browser/offline_pages/prefetch/prefetched_pages_notifier_unittest.cc +++ b/chrome/browser/offline_pages/prefetch/prefetched_pages_notifier_unittest.cc @@ -19,9 +19,9 @@ namespace { const ClientId kClientId("1234", kSuggestedArticlesNamespace); const base::FilePath kFilePath("/"); -const std::u16string kExampleHost = base::UTF8ToUTF16("www.example.com"); -const std::u16string kExampleHost2 = base::UTF8ToUTF16("www.example2.com"); -const std::u16string kExampleHost3 = base::UTF8ToUTF16("www.example3.com"); +const std::u16string kExampleHost = u"www.example.com"; +const std::u16string kExampleHost2 = u"www.example2.com"; +const std::u16string kExampleHost3 = u"www.example3.com"; OfflinePageItem ItemCreatedOn(std::u16string host, base::Time creation_time) { static int offline_id = 0; diff --git a/chrome/browser/password_manager/password_generation_interactive_uitest.cc b/chrome/browser/password_manager/password_generation_interactive_uitest.cc index 077627dc290e96..5faad79b0dfbe8 100644 --- a/chrome/browser/password_manager/password_generation_interactive_uitest.cc +++ b/chrome/browser/password_manager/password_generation_interactive_uitest.cc @@ -440,8 +440,7 @@ IN_PROC_BROWSER_TEST_F(PasswordGenerationInteractiveTest, password_store->stored_passwords(); EXPECT_EQ(1u, stored_passwords.size()); EXPECT_EQ(1u, stored_passwords.begin()->second.size()); - EXPECT_EQ(base::UTF8ToUTF16("UN"), - (stored_passwords.begin()->second)[0].username_value); + EXPECT_EQ(u"UN", (stored_passwords.begin()->second)[0].username_value); } // Verify that navigating away closes the popup. diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc index 1fd10eb7113507..960acc58279beb 100644 --- a/chrome/browser/password_manager/password_manager_browsertest.cc +++ b/chrome/browser/password_manager/password_manager_browsertest.cc @@ -1606,7 +1606,7 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, NoLastLoadGoodLastLoad) { ASSERT_TRUE(handler); NavigationObserver nav_observer(WebContents()); // Any username/password will work. - handler->SetAuth(base::UTF8ToUTF16("user"), base::UTF8ToUTF16("pwd")); + handler->SetAuth(u"user", u"pwd"); auth_supplied_observer.Wait(); // The password manager should be working correctly. @@ -3732,7 +3732,7 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, CorrectEntryForHttpAuth) { LoginHandler* handler = *login_observer.handlers().begin(); ASSERT_TRUE(handler); // Any username/password will work. - handler->SetAuth(base::UTF8ToUTF16("user"), base::UTF8ToUTF16("pwd")); + handler->SetAuth(u"user", u"pwd"); auth_supplied_observer.Wait(); // The password manager should be working correctly. @@ -3803,7 +3803,7 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, LoginHandler* handler = *login_observer.handlers().begin(); ASSERT_TRUE(handler); // Any username/password will work. - handler->SetAuth(base::UTF8ToUTF16("user"), base::UTF8ToUTF16("pwd")); + handler->SetAuth(u"user", u"pwd"); auth_supplied_observer.Wait(); nav_observer.Wait(); diff --git a/chrome/browser/password_manager/password_manager_interactive_uitest.cc b/chrome/browser/password_manager/password_manager_interactive_uitest.cc index e55910479c93c0..ca3eb6b91a47b3 100644 --- a/chrome/browser/password_manager/password_manager_interactive_uitest.cc +++ b/chrome/browser/password_manager/password_manager_interactive_uitest.cc @@ -110,10 +110,8 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerInteractiveTest, UsernameChanged) { password_store->stored_passwords(); EXPECT_EQ(1u, stored_passwords.size()); EXPECT_EQ(2u, stored_passwords.begin()->second.size()); - EXPECT_EQ(base::UTF8ToUTF16("temp"), - (stored_passwords.begin()->second)[0].username_value); - EXPECT_EQ(base::UTF8ToUTF16("temporary"), - (stored_passwords.begin()->second)[1].username_value); + EXPECT_EQ(u"temp", (stored_passwords.begin()->second)[0].username_value); + EXPECT_EQ(u"temporary", (stored_passwords.begin()->second)[1].username_value); } IN_PROC_BROWSER_TEST_F(PasswordManagerInteractiveTest, diff --git a/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc b/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc index 37f0af1e2c0b6d..5f90cb3adcd027 100644 --- a/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc +++ b/chrome/browser/password_manager/password_manager_signin_intercept_test_helper.cc @@ -97,8 +97,7 @@ void PasswordManagerSigninInterceptTestHelper::SetupProfilesForInterception( const base::FilePath profile_path = profile_manager->GenerateNextProfileDirectoryPath(); profile_storage->AddProfile( - profile_path, base::UTF8ToUTF16("TestProfileName"), kGaiaId, - base::UTF8ToUTF16(kGaiaEmail), + profile_path, u"TestProfileName", kGaiaId, base::UTF8ToUTF16(kGaiaEmail), /*is_consented_primary_account=*/false, /*icon_index=*/0, /*supervised_user_id=*/std::string(), EmptyAccountId()); diff --git a/chrome/browser/policy/test/certificate_transparency_policy_browsertest.cc b/chrome/browser/policy/test/certificate_transparency_policy_browsertest.cc index 9922252c943480..33d9a07aea78f1 100644 --- a/chrome/browser/policy/test/certificate_transparency_policy_browsertest.cc +++ b/chrome/browser/policy/test/certificate_transparency_policy_browsertest.cc @@ -56,7 +56,7 @@ IN_PROC_BROWSER_TEST_F(CertificateTransparencyPolicyTest, EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText( tab->GetMainFrame(), "proceed-link")); - EXPECT_NE(base::UTF8ToUTF16("OK"), + EXPECT_NE(u"OK", browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); // Now exempt the URL from being blocked by setting policy. @@ -75,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(CertificateTransparencyPolicyTest, // There should be no interstitial after the page loads. EXPECT_FALSE(IsShowingInterstitial(tab)); - EXPECT_EQ(base::UTF8ToUTF16("OK"), + EXPECT_EQ(u"OK", browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); // Now ensure that this setting still works after a network process crash. @@ -93,7 +93,7 @@ IN_PROC_BROWSER_TEST_F(CertificateTransparencyPolicyTest, // There should be no interstitial after the page loads. EXPECT_FALSE(IsShowingInterstitial(tab)); - EXPECT_EQ(base::UTF8ToUTF16("OK"), + EXPECT_EQ(u"OK", browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); } @@ -125,7 +125,7 @@ IN_PROC_BROWSER_TEST_F(CertificateTransparencyPolicyTest, EXPECT_TRUE(chrome_browser_interstitials::IsInterstitialDisplayingText( main_frame, "proceed-link")); - EXPECT_NE(base::UTF8ToUTF16("OK"), + EXPECT_NE(u"OK", browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); // Now exempt the leaf SPKI from being blocked by setting policy. @@ -146,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(CertificateTransparencyPolicyTest, https_server_ok.GetURL("/simple.html")); // Check we are no longer in the interstitial. - EXPECT_EQ(base::UTF8ToUTF16("OK"), + EXPECT_EQ(u"OK", browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); } diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc index 76462f62088af1..7a0836159727ec 100644 --- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc +++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_browsertest.cc @@ -1260,8 +1260,7 @@ IN_PROC_BROWSER_TEST_F(PrefetchProxyBrowserTest, size_t starting_origin_request_count = OriginServerRequestCount(); ui_test_utils::NavigateToURL(browser(), prefetch_url); - EXPECT_EQ(base::UTF8ToUTF16("Title Of Awesomeness"), - GetWebContents()->GetTitle()); + EXPECT_EQ(u"Title Of Awesomeness", GetWebContents()->GetTitle()); VerifyOriginRequestsAreIsolated({prefetch_url.path()}); @@ -2514,8 +2513,7 @@ IN_PROC_BROWSER_TEST_F( // Only the probe should have hit the origin server. EXPECT_EQ(starting_origin_request_count + 1, OriginServerRequestCount()); - EXPECT_EQ(base::UTF8ToUTF16("Title Of Awesomeness"), - GetWebContents()->GetTitle()); + EXPECT_EQ(u"Title Of Awesomeness", GetWebContents()->GetTitle()); ASSERT_TRUE(tab_helper->after_srp_metrics()); ASSERT_TRUE(tab_helper->after_srp_metrics()->prefetch_status_.has_value()); @@ -2586,8 +2584,7 @@ IN_PROC_BROWSER_TEST_F( ui_test_utils::NavigateToURL(browser(), eligible_link); - EXPECT_EQ(base::UTF8ToUTF16("Title Of Awesomeness"), - GetWebContents()->GetTitle()); + EXPECT_EQ(u"Title Of Awesomeness", GetWebContents()->GetTitle()); ASSERT_TRUE(tab_helper->after_srp_metrics()); ASSERT_TRUE(tab_helper->after_srp_metrics()->prefetch_status_.has_value()); @@ -2678,8 +2675,7 @@ class PrefetchProxyBaseProbingBrowserTest : public PrefetchProxyBrowserTest { ui_test_utils::NavigateToURL(browser(), eligible_link); EXPECT_EQ(expect_successful_tls_probe, 1U == probe_counter.count()); - EXPECT_EQ(base::UTF8ToUTF16("Title Of Awesomeness"), - GetWebContents()->GetTitle()); + EXPECT_EQ(u"Title Of Awesomeness", GetWebContents()->GetTitle()); ASSERT_TRUE(tab_helper->after_srp_metrics()); ASSERT_TRUE(tab_helper->after_srp_metrics()->prefetch_status_.has_value()); diff --git a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc index 6a68b29e22ca8b..be3357237e7a34 100644 --- a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc +++ b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc @@ -1162,16 +1162,16 @@ class PrefHashBrowserTestDefaultSearch : public PrefHashBrowserTestBase { static_cast(-1); TemplateURLData user_dse; - user_dse.SetKeyword(base::UTF8ToUTF16("userkeyword")); - user_dse.SetShortName(base::UTF8ToUTF16("username")); + user_dse.SetKeyword(u"userkeyword"); + user_dse.SetShortName(u"username"); user_dse.SetURL("http://user_default_engine/search?q=good_user_query"); default_search_manager.SetUserSelectedDefaultSearchEngine(user_dse); const TemplateURLData* current_dse = default_search_manager.GetDefaultSearchEngine(&dse_source); EXPECT_EQ(DefaultSearchManager::FROM_USER, dse_source); - EXPECT_EQ(current_dse->keyword(), base::UTF8ToUTF16("userkeyword")); - EXPECT_EQ(current_dse->short_name(), base::UTF8ToUTF16("username")); + EXPECT_EQ(current_dse->keyword(), u"userkeyword"); + EXPECT_EQ(current_dse->short_name(), u"username"); EXPECT_EQ(current_dse->url(), "http://user_default_engine/search?q=good_user_query"); } @@ -1236,16 +1236,16 @@ class PrefHashBrowserTestDefaultSearch : public PrefHashBrowserTestBase { #if !BUILDFLAG(IS_CHROMEOS_ASH) // Attack is successful. EXPECT_EQ(DefaultSearchManager::FROM_USER, dse_source); - EXPECT_EQ(current_dse->keyword(), base::UTF8ToUTF16("badkeyword")); - EXPECT_EQ(current_dse->short_name(), base::UTF8ToUTF16("badname")); + EXPECT_EQ(current_dse->keyword(), u"badkeyword"); + EXPECT_EQ(current_dse->short_name(), u"badname"); EXPECT_EQ(current_dse->url(), "http://bad_default_engine/search?q=dirty_user_query"); #endif } else { // Attack fails. EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, dse_source); - EXPECT_NE(current_dse->keyword(), base::UTF8ToUTF16("badkeyword")); - EXPECT_NE(current_dse->short_name(), base::UTF8ToUTF16("badname")); + EXPECT_NE(current_dse->keyword(), u"badkeyword"); + EXPECT_NE(current_dse->short_name(), u"badname"); EXPECT_NE(current_dse->url(), "http://bad_default_engine/search?q=dirty_user_query"); } diff --git a/chrome/browser/profiles/gaia_info_update_service_unittest.cc b/chrome/browser/profiles/gaia_info_update_service_unittest.cc index 50fd1e6d934a2a..bd44fa87c25299 100644 --- a/chrome/browser/profiles/gaia_info_update_service_unittest.cc +++ b/chrome/browser/profiles/gaia_info_update_service_unittest.cc @@ -163,8 +163,8 @@ TEST_F(GAIAInfoUpdateServiceTest, SyncOnSyncOff) { ASSERT_EQ(1u, storage()->GetNumberOfProfiles()); ProfileAttributesEntry* entry = storage()->GetAllProfilesAttributes().front(); - EXPECT_EQ(entry->GetGAIAGivenName(), base::UTF8ToUTF16("Pat")); - EXPECT_EQ(entry->GetGAIAName(), base::UTF8ToUTF16("Pat Foo")); + EXPECT_EQ(entry->GetGAIAGivenName(), u"Pat"); + EXPECT_EQ(entry->GetGAIAName(), u"Pat Foo"); EXPECT_EQ(entry->GetHostedDomain(), kNoHostedDomainFound); gfx::Image gaia_picture = gfx::test::CreateImage(256, 256); @@ -219,8 +219,8 @@ TEST_F(GAIAInfoUpdateServiceDiceTest, RevokeSyncConsent) { signin::ConsentLevel::kNotRequired)); // Verify that the GAIA name and picture, and picture URL are not cleared // as unconsented primary account still exists. - EXPECT_EQ(entry->GetGAIAGivenName(), base::UTF8ToUTF16("Pat")); - EXPECT_EQ(entry->GetGAIAName(), base::UTF8ToUTF16("Pat Foo")); + EXPECT_EQ(entry->GetGAIAGivenName(), u"Pat"); + EXPECT_EQ(entry->GetGAIAName(), u"Pat Foo"); EXPECT_EQ(entry->GetHostedDomain(), kNoHostedDomainFound); EXPECT_TRUE(gfx::test::AreImagesEqual(gaia_picture, entry->GetAvatarIcon())); } @@ -241,8 +241,8 @@ TEST_F(GAIAInfoUpdateServiceTest, LogInLogOut) { ASSERT_EQ(1u, storage()->GetNumberOfProfiles()); ProfileAttributesEntry* entry = storage()->GetAllProfilesAttributes().front(); - EXPECT_EQ(entry->GetGAIAGivenName(), base::UTF8ToUTF16("Pat")); - EXPECT_EQ(entry->GetGAIAName(), base::UTF8ToUTF16("Pat Foo")); + EXPECT_EQ(entry->GetGAIAGivenName(), u"Pat"); + EXPECT_EQ(entry->GetGAIAName(), u"Pat Foo"); EXPECT_EQ(entry->GetHostedDomain(), kNoHostedDomainFound); gfx::Image gaia_picture = gfx::test::CreateImage(256, 256); @@ -390,8 +390,8 @@ TEST_F(GAIAInfoUpdateServiceTest, ClearGaiaInfoOnStartup) { signin::ConsentLevel::kNotRequired)); ASSERT_EQ(1u, storage()->GetNumberOfProfiles()); ProfileAttributesEntry* entry = storage()->GetAllProfilesAttributes().front(); - entry->SetGAIAName(base::UTF8ToUTF16("foo")); - entry->SetGAIAGivenName(base::UTF8ToUTF16("Pat Foo")); + entry->SetGAIAName(u"foo"); + entry->SetGAIAGivenName(u"Pat Foo"); gfx::Image gaia_picture = gfx::test::CreateImage(256, 256); entry->SetGAIAPicture("GAIA_IMAGE_URL_WITH_SIZE", gaia_picture); entry->SetHostedDomain(kNoHostedDomainFound); diff --git a/chrome/browser/profiles/profile_attributes_entry.cc b/chrome/browser/profiles/profile_attributes_entry.cc index 88d4956c5d2697..e0035d66eba59d 100644 --- a/chrome/browser/profiles/profile_attributes_entry.cc +++ b/chrome/browser/profiles/profile_attributes_entry.cc @@ -256,8 +256,7 @@ std::u16string ProfileAttributesEntry::GetName() const { case NameForm::kLocalName: return GetLocalProfileName(); case NameForm::kGaiaAndLocalName: - return GetGAIANameToDisplay() + base::UTF8ToUTF16(" (") + - GetLocalProfileName() + base::UTF8ToUTF16(")"); + return GetGAIANameToDisplay() + u" (" + GetLocalProfileName() + u")"; } } diff --git a/chrome/browser/profiles/profile_attributes_storage_unittest.cc b/chrome/browser/profiles/profile_attributes_storage_unittest.cc index 49fef7dff4b3a2..53ddd4384272c6 100644 --- a/chrome/browser/profiles/profile_attributes_storage_unittest.cc +++ b/chrome/browser/profiles/profile_attributes_storage_unittest.cc @@ -381,16 +381,16 @@ TEST_F(ProfileAttributesStorageTest, EntryInternalAccessors) { ASSERT_TRUE(entry->GetValue(key)); EXPECT_EQ(base::Value::Type::STRING, entry->GetValue(key)->type()); EXPECT_EQ(std::string("abcd"), entry->GetString(key)); - EXPECT_EQ(base::UTF8ToUTF16("abcd"), entry->GetString16(key)); + EXPECT_EQ(u"abcd", entry->GetString16(key)); EXPECT_EQ(0.0, entry->GetDouble(key)); EXPECT_FALSE(entry->GetBool(key)); EXPECT_FALSE(entry->IsDouble(key)); - EXPECT_TRUE(entry->SetString16(key, base::UTF8ToUTF16("efgh"))); + EXPECT_TRUE(entry->SetString16(key, u"efgh")); ASSERT_TRUE(entry->GetValue(key)); EXPECT_EQ(base::Value::Type::STRING, entry->GetValue(key)->type()); EXPECT_EQ(std::string("efgh"), entry->GetString(key)); - EXPECT_EQ(base::UTF8ToUTF16("efgh"), entry->GetString16(key)); + EXPECT_EQ(u"efgh", entry->GetString16(key)); EXPECT_EQ(0.0, entry->GetDouble(key)); EXPECT_FALSE(entry->GetBool(key)); EXPECT_FALSE(entry->IsDouble(key)); @@ -399,7 +399,7 @@ TEST_F(ProfileAttributesStorageTest, EntryInternalAccessors) { ASSERT_TRUE(entry->GetValue(key)); EXPECT_EQ(base::Value::Type::DOUBLE, entry->GetValue(key)->type()); EXPECT_EQ(std::string(), entry->GetString(key)); - EXPECT_EQ(base::UTF8ToUTF16(""), entry->GetString16(key)); + EXPECT_EQ(u"", entry->GetString16(key)); EXPECT_EQ(12.5, entry->GetDouble(key)); EXPECT_FALSE(entry->GetBool(key)); EXPECT_TRUE(entry->IsDouble(key)); @@ -408,7 +408,7 @@ TEST_F(ProfileAttributesStorageTest, EntryInternalAccessors) { ASSERT_TRUE(entry->GetValue(key)); EXPECT_EQ(base::Value::Type::BOOLEAN, entry->GetValue(key)->type()); EXPECT_EQ(std::string(), entry->GetString(key)); - EXPECT_EQ(base::UTF8ToUTF16(""), entry->GetString16(key)); + EXPECT_EQ(u"", entry->GetString16(key)); EXPECT_EQ(0.0, entry->GetDouble(key)); EXPECT_TRUE(entry->GetBool(key)); EXPECT_FALSE(entry->IsDouble(key)); @@ -418,10 +418,10 @@ TEST_F(ProfileAttributesStorageTest, EntryInternalAccessors) { entry->SetBool(key, true); EXPECT_TRUE(entry->SetString(key, std::string("abcd"))); EXPECT_FALSE(entry->SetString(key, std::string("abcd"))); - EXPECT_FALSE(entry->SetString16(key, base::UTF8ToUTF16("abcd"))); + EXPECT_FALSE(entry->SetString16(key, u"abcd")); - EXPECT_TRUE(entry->SetString16(key, base::UTF8ToUTF16("efgh"))); - EXPECT_FALSE(entry->SetString16(key, base::UTF8ToUTF16("efgh"))); + EXPECT_TRUE(entry->SetString16(key, u"efgh")); + EXPECT_FALSE(entry->SetString16(key, u"efgh")); EXPECT_FALSE(entry->SetString(key, std::string("efgh"))); EXPECT_TRUE(entry->SetDouble(key, 12.5)); @@ -434,7 +434,7 @@ TEST_F(ProfileAttributesStorageTest, EntryInternalAccessors) { EXPECT_FALSE(entry->SetBool(key, true)); EXPECT_TRUE(entry->SetBool(key, false)); - EXPECT_TRUE(entry->SetString16(key, base::UTF8ToUTF16("efgh"))); + EXPECT_TRUE(entry->SetString16(key, u"efgh")); // If previous data is not there, setters should returns true even if the // defaults (empty string, 0.0, or false) are written. diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc index 274ccd47602957..b5b3c2d75f0ac7 100644 --- a/chrome/browser/profiles/profile_info_cache_unittest.cc +++ b/chrome/browser/profiles/profile_info_cache_unittest.cc @@ -144,9 +144,9 @@ std::u16string ProfileInfoCacheTest::GetConcatenation( const std::u16string& gaia_name, const std::u16string profile_name) { std::u16string name_to_display(gaia_name); - name_to_display.append(base::UTF8ToUTF16(" (")); + name_to_display.append(u" ("); name_to_display.append(profile_name); - name_to_display.append(base::UTF8ToUTF16(")")); + name_to_display.append(u")"); return name_to_display; } diff --git a/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc b/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc index 262199bde9023f..3511523bb36787 100644 --- a/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc +++ b/chrome/browser/renderer_context_menu/link_to_text_menu_observer_interactive_uitest.cc @@ -94,7 +94,7 @@ LinkToTextMenuObserverTest::~LinkToTextMenuObserverTest() = default; IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, AddsCopyMenuItem) { content::ContextMenuParams params; params.page_url = GURL("http://foo.com/"); - params.selection_text = base::UTF8ToUTF16("hello world"); + params.selection_text = u"hello world"; observer()->OverrideGeneratedSelectorForTesting(std::string()); InitMenu(params); EXPECT_EQ(1u, menu()->GetMenuSize()); @@ -141,7 +141,7 @@ IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, CopiesLinkToText) { content::BrowserTestClipboardScope test_clipboard_scope; content::ContextMenuParams params; params.page_url = GURL("http://foo.com/"); - params.selection_text = base::UTF8ToUTF16("hello world"); + params.selection_text = u"hello world"; observer()->OverrideGeneratedSelectorForTesting("hello%20world"); InitMenu(params); menu()->ExecuteCommand(IDC_CONTENT_CONTEXT_COPYLINKTOTEXT, 0); @@ -149,14 +149,14 @@ IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, CopiesLinkToText) { ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); std::u16string text; clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, nullptr, &text); - EXPECT_EQ(base::UTF8ToUTF16("http://foo.com/#:~:text=hello%20world"), text); + EXPECT_EQ(u"http://foo.com/#:~:text=hello%20world", text); } IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, CopiesLinkForEmptySelector) { content::BrowserTestClipboardScope test_clipboard_scope; content::ContextMenuParams params; params.page_url = GURL("http://foo.com/"); - params.selection_text = base::UTF8ToUTF16("hello world"); + params.selection_text = u"hello world"; observer()->OverrideGeneratedSelectorForTesting(std::string()); InitMenu(params); @@ -168,7 +168,7 @@ IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, CopiesLinkForEmptySelector) { ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); std::u16string text; clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, nullptr, &text); - EXPECT_EQ(base::UTF8ToUTF16("http://foo.com/"), text); + EXPECT_EQ(u"http://foo.com/", text); } } @@ -176,7 +176,7 @@ IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, ReplacesRefInURL) { content::BrowserTestClipboardScope test_clipboard_scope; content::ContextMenuParams params; params.page_url = GURL("http://foo.com/#:~:text=hello%20world"); - params.selection_text = base::UTF8ToUTF16("hello world"); + params.selection_text = u"hello world"; observer()->OverrideGeneratedSelectorForTesting("hello"); InitMenu(params); menu()->ExecuteCommand(IDC_CONTENT_CONTEXT_COPYLINKTOTEXT, 0); @@ -184,7 +184,7 @@ IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, ReplacesRefInURL) { ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); std::u16string text; clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, nullptr, &text); - EXPECT_EQ(base::UTF8ToUTF16("http://foo.com/#:~:text=hello"), text); + EXPECT_EQ(u"http://foo.com/#:~:text=hello", text); } // crbug.com/1139864 @@ -206,7 +206,7 @@ IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, InvalidSelectorForIframe) { content::BrowserTestClipboardScope test_clipboard_scope; content::ContextMenuParams params; params.page_url = main_url; - params.selection_text = base::UTF8ToUTF16("hello world"); + params.selection_text = u"hello world"; InitMenu(params); if (ShouldPreemptivelyGenerateLink()) { @@ -239,7 +239,7 @@ IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, Blocklist) { content::BrowserTestClipboardScope test_clipboard_scope; content::ContextMenuParams params; params.page_url = GURL("http://facebook.com/my-profile"); - params.selection_text = base::UTF8ToUTF16("hello world"); + params.selection_text = u"hello world"; InitMenu(params); if (ShouldPreemptivelyGenerateLink()) { @@ -250,7 +250,7 @@ IN_PROC_BROWSER_TEST_P(LinkToTextMenuObserverTest, Blocklist) { ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); std::u16string text; clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, nullptr, &text); - EXPECT_EQ(base::UTF8ToUTF16("http://facebook.com/my-profile"), text); + EXPECT_EQ(u"http://facebook.com/my-profile", text); } } diff --git a/chrome/browser/renderer_context_menu/quick_answers_menu_observer_browsertest.cc b/chrome/browser/renderer_context_menu/quick_answers_menu_observer_browsertest.cc index 836f950c06ca13..ddbcaa527931f3 100644 --- a/chrome/browser/renderer_context_menu/quick_answers_menu_observer_browsertest.cc +++ b/chrome/browser/renderer_context_menu/quick_answers_menu_observer_browsertest.cc @@ -77,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(QuickAnswersMenuObserverTest, FeatureIneligible) { observer_->OnEligibilityChanged(false); content::ContextMenuParams params; - params.selection_text = base::UTF8ToUTF16("test"); + params.selection_text = u"test"; ShowMenu(params); @@ -92,7 +92,7 @@ IN_PROC_BROWSER_TEST_F(QuickAnswersMenuObserverTest, PasswordField) { content::ContextMenuParams params; params.input_field_type = blink::mojom::ContextMenuDataInputFieldType::kPassword; - params.selection_text = base::UTF8ToUTF16("test"); + params.selection_text = u"test"; ShowMenu(params); @@ -117,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(QuickAnswersMenuObserverTest, QuickAnswersPending) { observer_->OnEligibilityChanged(true); content::ContextMenuParams params; - params.selection_text = base::UTF8ToUTF16("test"); + params.selection_text = u"test"; ShowMenu(params); // Quick Answers UI should be pending. diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc b/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc index 6c0013483dd0ce..df793e06e32603 100644 --- a/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc +++ b/chrome/browser/safe_browsing/chrome_password_protection_service_browsertest.cc @@ -553,7 +553,7 @@ IN_PROC_BROWSER_TEST_F(ChromePasswordProtectionServiceBrowserTest, ServiceAccessType::EXPLICIT_ACCESS) .get(); password_store->SaveGaiaPasswordHash( - user_manager::kStubUserEmail, base::UTF8ToUTF16("password_1"), + user_manager::kStubUserEmail, u"password_1", /*is_primary_account=*/true, password_manager::metrics_util::GaiaPasswordHashChange:: CHANGED_IN_CONTENT_AREA); @@ -799,9 +799,9 @@ IN_PROC_BROWSER_TEST_F(ChromePasswordProtectionServiceBrowserTest, ServiceAccessType::EXPLICIT_ACCESS) .get(); password_store->SaveEnterprisePasswordHash("username@domain.com", - base::UTF8ToUTF16("password_1")); + u"password_1"); password_store->SaveGaiaPasswordHash( - user_manager::kStubUserEmail, base::UTF8ToUTF16("password_2"), + user_manager::kStubUserEmail, u"password_2", /*is_primary_account=*/false, password_manager::metrics_util::GaiaPasswordHashChange:: CHANGED_IN_CONTENT_AREA); diff --git a/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.cc b/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.cc index 9fef6316bf2257..e1cb150cb7e587 100644 --- a/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.cc @@ -1300,9 +1300,8 @@ TEST_F(ChromePasswordProtectionServiceTest, domains.push_back("amazon.com"); service_->set_saved_passwords_matching_domains(domains); warning_text = l10n_util::GetStringFUTF16( - IDS_PAGE_INFO_CHECK_PASSWORD_DETAILS_SAVED_3_DOMAIN, - base::UTF8ToUTF16("amazon.com"), base::UTF8ToUTF16(domains[0]), - base::UTF8ToUTF16(domains[1])); + IDS_PAGE_INFO_CHECK_PASSWORD_DETAILS_SAVED_3_DOMAIN, u"amazon.com", + base::UTF8ToUTF16(domains[0]), base::UTF8ToUTF16(domains[1])); EXPECT_EQ(warning_text, service_->GetWarningDetailText(reused_password_type, &placeholder_offsets)); } @@ -1315,7 +1314,7 @@ TEST_F(ChromePasswordProtectionServiceTest, service_->set_saved_passwords_matching_domains(domains); // Default domains should be prioritzed over other domains. std::vector expected_placeholders{ - base::UTF8ToUTF16("amazon.com"), base::UTF8ToUTF16(domains[0]), + u"amazon.com", base::UTF8ToUTF16(domains[0]), base::UTF8ToUTF16(domains[1])}; EXPECT_EQ(expected_placeholders, service_->GetPlaceholdersForSavedPasswordWarningText()); @@ -1329,7 +1328,7 @@ TEST_F(ChromePasswordProtectionServiceTest, IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS_ENTERPRISE); std::u16string warning_text_with_org_name = l10n_util::GetStringFUTF16( IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS_ENTERPRISE_WITH_ORG_NAME, - base::UTF8ToUTF16("example.com")); + u"example.com"); std::u16string warning_text_sync = l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS_SYNC); diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index b7842410018e66..ddc5b25c08a930 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -942,7 +942,7 @@ TEST_F(SessionServiceTest, KeepPostDataWithoutPasswords) { std::unique_ptr entry1 = content::NavigationEntry::Create(); entry1->SetURL(GURL("http://google.com")); - entry1->SetTitle(base::UTF8ToUTF16("title1")); + entry1->SetTitle(u"title1"); entry1->SetHasPostData(true); entry1->SetPostData(network::ResourceRequestBody::CreateFromBytes( post_data.data(), post_data.size())); @@ -955,7 +955,7 @@ TEST_F(SessionServiceTest, KeepPostDataWithoutPasswords) { std::unique_ptr entry2 = content::NavigationEntry::Create(); entry2->SetURL(GURL("http://google.com/nopost")); - entry2->SetTitle(base::UTF8ToUTF16("title2")); + entry2->SetTitle(u"title2"); entry2->SetHasPostData(false); SerializedNavigationEntry nav2 = sessions::ContentSerializedNavigationBuilder::FromNavigationEntry( diff --git a/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc b/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc index 4712458296b2b7..c48e9df4241ddc 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc +++ b/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc @@ -397,7 +397,7 @@ IN_PROC_BROWSER_TEST_F(DiceWebSigninInterceptorBrowserTest, SwitchAndLoad) { const base::FilePath profile_path = profile_manager->GenerateNextProfileDirectoryPath(); profile_storage->AddProfile( - profile_path, base::UTF8ToUTF16("TestProfileName"), account_info.gaia, + profile_path, u"TestProfileName", account_info.gaia, base::UTF8ToUTF16(account_info.email), /*is_consented_primary_account=*/false, /*icon_index=*/0, /*supervised_user_id*/ std::string(), EmptyAccountId()); diff --git a/chrome/browser/signin/dice_web_signin_interceptor_unittest.cc b/chrome/browser/signin/dice_web_signin_interceptor_unittest.cc index d7bbb2fdf3ab6f..0569c9eecb0590 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor_unittest.cc +++ b/chrome/browser/signin/dice_web_signin_interceptor_unittest.cc @@ -210,7 +210,7 @@ TEST_F(DiceWebSigninInterceptorTest, ShouldShowProfileSwitchBubble) { ASSERT_NE(entry, nullptr); std::string kOtherGaiaID = "SomeOtherGaiaID"; ASSERT_NE(kOtherGaiaID, account_info.gaia); - entry->SetAuthInfo(kOtherGaiaID, base::UTF8ToUTF16("alice@gmail.com"), + entry->SetAuthInfo(kOtherGaiaID, u"alice@gmail.com", /*is_consented_primary_account=*/true); EXPECT_FALSE(interceptor()->ShouldShowProfileSwitchBubble( email, profile_attributes_storage())); diff --git a/chrome/browser/signin/signin_global_error_unittest.cc b/chrome/browser/signin/signin_global_error_unittest.cc index d2cb56491fa8b8..36746f51f45e6f 100644 --- a/chrome/browser/signin/signin_global_error_unittest.cc +++ b/chrome/browser/signin/signin_global_error_unittest.cc @@ -51,8 +51,7 @@ class SigninGlobalErrorTest : public testing::Test { profile_ = profile_manager_.CreateTestingProfile( "Person 1", std::unique_ptr(), - base::UTF8ToUTF16("Person 1"), 0, std::string(), - std::move(testing_factories)); + u"Person 1", 0, std::string(), std::move(testing_factories)); identity_test_env_profile_adaptor_ = std::make_unique(profile()); diff --git a/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc b/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc index 675f03f7a707ea..1e7bdad2b4cb8a 100644 --- a/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc +++ b/chrome/browser/spellchecker/spell_check_host_chrome_impl_mac_browsertest.cc @@ -54,7 +54,7 @@ class SpellCheckHostChromeImplMacBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(SpellCheckHostChromeImplMacBrowserTest, SpellCheckReturnMessage) { spell_check_host_->RequestTextCheck( - base::UTF8ToUTF16("zz."), 123, + u"zz.", 123, base::BindOnce(&SpellCheckHostChromeImplMacBrowserTest::LogResult, base::Unretained(this))); RunUntilResultReceived(); diff --git a/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc b/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc index 917c41612d5dab..184701510f7025 100644 --- a/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc +++ b/chrome/browser/spellchecker/spell_check_host_chrome_impl_win_browsertest.cc @@ -119,7 +119,7 @@ void SpellCheckHostChromeImplWinBrowserTest::RunSpellCheckReturnMessageTest() { RunUntilResultReceived(); spell_check_host_->RequestTextCheck( - base::UTF8ToUTF16("zz."), + u"zz.", /*route_id=*/123, base::BindOnce( &SpellCheckHostChromeImplWinBrowserTest::OnSpellcheckResult, diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc index 3ed1123933e123..86dfe7db745c3e 100644 --- a/chrome/browser/ssl/ssl_browsertest.cc +++ b/chrome/browser/ssl/ssl_browsertest.cc @@ -851,8 +851,8 @@ class SSLUITestBase : public InProcessBrowserTest, auto web_app_info = std::make_unique(); web_app_info->start_url = start_url; web_app_info->scope = start_url.GetWithoutFilename(); - web_app_info->title = base::UTF8ToUTF16("Test app"); - web_app_info->description = base::UTF8ToUTF16("Test description"); + web_app_info->title = u"Test app"; + web_app_info->description = u"Test description"; Profile* profile = browser()->profile(); diff --git a/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc b/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc index 1a5eea13d1174c..5f4bf4d9f68e60 100644 --- a/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc @@ -909,7 +909,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientWalletSyncTest, // Unmask the card (the full card number has to start with "34" to match the // type of the masked card which is by default AMEX in the tests). - UnmaskServerCard(0, *cards[0], base::UTF8ToUTF16("3404000300020001")); + UnmaskServerCard(0, *cards[0], u"3404000300020001"); // Keep the same data (only change the customer data to force the FakeServer // to send the full update). diff --git a/chrome/browser/sync/test/integration/two_client_search_engines_sync_test.cc b/chrome/browser/sync/test/integration/two_client_search_engines_sync_test.cc index 183c7796b9af34..8f72f3f4e6d8c8 100644 --- a/chrome/browser/sync/test/integration/two_client_search_engines_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_search_engines_sync_test.cc @@ -141,7 +141,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTestWithVerifier, Duplicates) { GetServiceForBrowserContext(0)->Add(builder.Build()); GetVerifierService()->Add(builder.Build()); - builder.data()->SetKeyword(base::UTF8ToUTF16("test1")); + builder.data()->SetKeyword(u"test1"); builder.data()->sync_guid = "newguid"; GetServiceForBrowserContext(0)->Add(builder.Build()); GetVerifierService()->Add(builder.Build()); @@ -163,9 +163,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, // Change the keyword. ASSERT_TRUE(SearchEnginesMatchChecker().Wait()); - EditSearchEngine(/*profile_index=*/0, /*keyword=*/"test0", - base::UTF8ToUTF16("test0"), /*new_keyword=*/"newkeyword", - "http://www.test0.com/"); + EditSearchEngine(/*profile_index=*/0, /*keyword=*/"test0", u"test0", + /*new_keyword=*/"newkeyword", "http://www.test0.com/"); ASSERT_TRUE(SearchEnginesMatchChecker().Wait()); } @@ -183,9 +182,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, E2E_ENABLED(UpdateUrl)) { ASSERT_TRUE(SearchEnginesMatchChecker().Wait()); // Change the URL. - EditSearchEngine(/*profile_index=*/0, /*keyword=*/"test0", - base::UTF8ToUTF16("test0"), /*new_keyword=*/"test0", - "http://www.wikipedia.org/q=%s"); + EditSearchEngine(/*profile_index=*/0, /*keyword=*/"test0", u"test0", + /*new_keyword=*/"test0", "http://www.wikipedia.org/q=%s"); ASSERT_TRUE(SearchEnginesMatchChecker().Wait()); } @@ -204,8 +202,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, ASSERT_TRUE(SearchEnginesMatchChecker().Wait()); // Change the short name. - EditSearchEngine(/*profile_index=*/0, "test0", base::UTF8ToUTF16("New Name"), - "test0", "http://www.test0.com/"); + EditSearchEngine(/*profile_index=*/0, "test0", u"New Name", "test0", + "http://www.test0.com/"); ASSERT_TRUE(SearchEnginesMatchChecker().Wait()); } @@ -222,11 +220,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, ConflictKeyword) { AddSearchEngine(/*profile_index=*/0, "test0"); AddSearchEngine(/*profile_index=*/1, "test1"); TemplateURLService* service = GetServiceForBrowserContext(1); - TemplateURL* turl = - service->GetTemplateURLForKeyword(base::UTF8ToUTF16("test1")); + TemplateURL* turl = service->GetTemplateURLForKeyword(u"test1"); EXPECT_TRUE(turl); - service->ResetTemplateURL(turl, turl->short_name(), - base::UTF8ToUTF16("test0"), turl->url()); + service->ResetTemplateURL(turl, turl->short_name(), u"test0", turl->url()); ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllServicesMatch()); @@ -251,7 +247,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, MergeMultiple) { AddSearchEngine(/*profile_index=*/1, "test3"); TemplateURLBuilder builder("test0"); - builder.data()->SetKeyword(base::UTF8ToUTF16("somethingelse.com")); + builder.data()->SetKeyword(u"somethingelse.com"); builder.data()->SetURL("http://www.somethingelse.com/"); builder.data()->sync_guid = "somethingelse"; GetServiceForBrowserContext(1)->Add(builder.Build()); diff --git a/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc b/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc index 8e83985747c10d..14f6c7e707a86f 100644 --- a/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc @@ -218,13 +218,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsBMOSyncTest, SyncDoubleInstallationDifferentNames) { ASSERT_TRUE(SetupClients()); WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Test name"); + info.title = u"Test name"; info.start_url = GURL("http://www.chromium.org/path"); // Install web app to both profiles. AppId app_id = InstallApp(info, GetProfile(0)); // The web app has a different title on the second profile. - info.title = base::UTF8ToUTF16("Test name 2"); + info.title = u"Test name 2"; AppId app_id2 = InstallApp(info, GetProfile(1)); EXPECT_EQ(app_id, app_id2); @@ -259,7 +259,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsBMOSyncTest, ASSERT_TRUE(AllProfilesHaveSameWebAppIds()); WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Test name"); + info.title = u"Test name"; info.start_url = GURL("http://www.chromium.org/path"); info.open_as_window = true; diff --git a/chrome/browser/sync/test/integration/two_client_web_apps_sync_test.cc b/chrome/browser/sync/test/integration/two_client_web_apps_sync_test.cc index d74ae57de24868..7b3ea4d19f50f4 100644 --- a/chrome/browser/sync/test/integration/two_client_web_apps_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_web_apps_sync_test.cc @@ -69,8 +69,8 @@ class TwoClientWebAppsSyncTest : public SyncTest { IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, Basic) { WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Test name"); - info.description = base::UTF8ToUTF16("Test description"); + info.title = u"Test name"; + info.description = u"Test description"; info.start_url = GURL("http://www.chromium.org/path"); info.scope = GURL("http://www.chromium.org/"); AppId app_id = apps_helper::InstallWebApp(GetProfile(0), info); @@ -86,7 +86,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, Basic) { IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, Minimal) { WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Test name"); + info.title = u"Test name"; info.start_url = GURL("http://www.chromium.org/"); AppId app_id = apps_helper::InstallWebApp(GetProfile(0), info); @@ -100,7 +100,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, Minimal) { IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, ThemeColor) { WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Test name"); + info.title = u"Test name"; info.start_url = GURL("http://www.chromium.org/"); info.theme_color = SK_ColorBLUE; AppId app_id = apps_helper::InstallWebApp(GetProfile(0), info); @@ -118,7 +118,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, ThemeColor) { IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, IsLocallyInstalled) { WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Test name"); + info.title = u"Test name"; info.start_url = GURL("http://www.chromium.org/"); AppId app_id = apps_helper::InstallWebApp(GetProfile(0), info); EXPECT_TRUE(GetRegistrar(GetProfile(0)).IsLocallyInstalled(app_id)); @@ -140,8 +140,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, AppFieldsChangeDoesNotSync) { const AppRegistrar& registrar1 = GetRegistrar(GetProfile(1)); WebApplicationInfo info_a; - info_a.title = base::UTF8ToUTF16("Test name A"); - info_a.description = base::UTF8ToUTF16("Description A"); + info_a.title = u"Test name A"; + info_a.description = u"Description A"; info_a.start_url = GURL("http://www.chromium.org/path/to/start_url"); info_a.scope = GURL("http://www.chromium.org/path/to/"); info_a.theme_color = SK_ColorBLUE; @@ -159,8 +159,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, AppFieldsChangeDoesNotSync) { // Reinstall same app in Profile 0 with a different metadata aside from the // name and start_url. WebApplicationInfo info_b; - info_b.title = base::UTF8ToUTF16("Test name B"); - info_b.description = base::UTF8ToUTF16("Description B"); + info_b.title = u"Test name B"; + info_b.description = u"Description B"; info_b.start_url = GURL("http://www.chromium.org/path/to/start_url"); info_b.scope = GURL("http://www.chromium.org/path/to/"); info_b.theme_color = SK_ColorRED; @@ -176,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, AppFieldsChangeDoesNotSync) { // Install a separate app just to have something to await on to ensure the // sync has propagated to the other profile. WebApplicationInfo infoC; - infoC.title = base::UTF8ToUTF16("Different test name"); + infoC.title = u"Different test name"; infoC.start_url = GURL("http://www.notchromium.org/"); AppId app_id_c = apps_helper::InstallWebApp(GetProfile(0), infoC); EXPECT_NE(app_id_a, app_id_c); @@ -243,7 +243,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, SyncUsingStartUrlFallback) { // Install app with name. WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Test app"); + info.title = u"Test app"; info.start_url = embedded_test_server()->GetURL("/web_apps/different_start_url.html"); AppId app_id = apps_helper::InstallWebApp(GetProfile(0), info); @@ -272,7 +272,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, SyncUsingNameFallback) { // Install app with name. WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Correct App Name"); + info.title = u"Correct App Name"; info.start_url = embedded_test_server()->GetURL("/web_apps/bad_title_only.html"); AppId app_id = apps_helper::InstallWebApp(GetProfile(0), info); @@ -298,7 +298,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, SyncWithoutUsingNameFallback) { // Install app with name. WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Incorrect App Name"); + info.title = u"Incorrect App Name"; info.start_url = embedded_test_server()->GetURL("/web_apps/basic.html"); AppId app_id = apps_helper::InstallWebApp(GetProfile(0), info); EXPECT_EQ(GetRegistrar(source_profile).GetAppShortName(app_id), @@ -327,7 +327,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientWebAppsSyncTest, SyncUsingIconUrlFallback) { // Install app with name. WebApplicationInfo info; - info.title = base::UTF8ToUTF16("Blue icon"); + info.title = u"Blue icon"; info.start_url = GURL("https://does-not-exist.org"); info.theme_color = SK_ColorBLUE; info.scope = GURL("https://does-not-exist.org/scope"); diff --git a/chrome/browser/task_manager/providers/child_process_task_unittest.cc b/chrome/browser/task_manager/providers/child_process_task_unittest.cc index f32869cde5503f..78db5a0867f7d9 100644 --- a/chrome/browser/task_manager/providers/child_process_task_unittest.cc +++ b/chrome/browser/task_manager/providers/child_process_task_unittest.cc @@ -111,7 +111,7 @@ TEST_F(ChildProcessTaskTest, TestAll) { EXPECT_TRUE(provided_tasks_.empty()); const int unique_id = 245; - const std::u16string name(base::UTF8ToUTF16("Test Task")); + const std::u16string name(u"Test Task"); const std::u16string expected_name( l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_PREFIX, name)); diff --git a/chrome/browser/task_manager/providers/web_contents/extension_tag_browsertest.cc b/chrome/browser/task_manager/providers/web_contents/extension_tag_browsertest.cc index f24270a097cdd4..6b6e19dd891992 100644 --- a/chrome/browser/task_manager/providers/web_contents/extension_tag_browsertest.cc +++ b/chrome/browser/task_manager/providers/web_contents/extension_tag_browsertest.cc @@ -111,7 +111,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionTagsTest, ASSERT_EQ(1U, task_manager.tasks().size()); const Task* about_blank_task = task_manager.tasks().back(); EXPECT_EQ(Task::RENDERER, about_blank_task->GetType()); - EXPECT_EQ(base::UTF8ToUTF16("Tab: about:blank"), about_blank_task->title()); + EXPECT_EQ(u"Tab: about:blank", about_blank_task->title()); // Reload the extension, the task manager should show it again. ReloadExtension(extension->id()); diff --git a/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc b/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc index 345d66eec3837e..a1b53fc4d4381f 100644 --- a/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc +++ b/chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc @@ -167,7 +167,7 @@ class TabContentsTagTest : public InProcessBrowserTest { std::u16string GetAboutBlankExpectedTitle() const { return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_TAB_PREFIX, - base::UTF8ToUTF16("about:blank")); + u"about:blank"); } int tabs_count() const { return browser()->tab_strip_model()->count(); } diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc index 1b4fb2301fde82..0ad05bbcf147ad 100644 --- a/chrome/browser/task_manager/task_manager_browsertest.cc +++ b/chrome/browser/task_manager/task_manager_browsertest.cc @@ -912,8 +912,7 @@ IN_PROC_BROWSER_TEST_P(TaskManagerOOPIFBrowserTest, SubframeHistoryNavigation) { // corresponding navigation entry is not marked as skippable. content::RenderFrameHost* child_frame = ChildFrameAt(tab->GetMainFrame(), 0); content::RenderFrameHost* grandchild_frame = ChildFrameAt(child_frame, 0); - grandchild_frame->ExecuteJavaScriptWithUserGestureForTests( - base::UTF8ToUTF16("a=5")); + grandchild_frame->ExecuteJavaScriptWithUserGestureForTests(u"a=5"); GURL d_url = embedded_test_server()->GetURL( "d.com", "/cross_site_iframe_factory.html?d(e)"); diff --git a/chrome/browser/translate/language_detection_service_browsertest.cc b/chrome/browser/translate/language_detection_service_browsertest.cc index e30381ece0bfa0..a85aac7dbf1990 100644 --- a/chrome/browser/translate/language_detection_service_browsertest.cc +++ b/chrome/browser/translate/language_detection_service_browsertest.cc @@ -38,7 +38,7 @@ IN_PROC_BROWSER_TEST_F(LanguageDetectionServiceTest, DetermineLanguageUndeterminedUnreliable) { mojo::Remote service = language_detection::LaunchLanguageDetectionService(); - std::u16string text = base::UTF8ToUTF16("Not enough text for detection"); + std::u16string text = u"Not enough text for detection"; base::RunLoop run_loop; service->DetermineLanguage( diff --git a/chrome/browser/ui/app_list/arc/arc_usb_host_permission_browsertest.cc b/chrome/browser/ui/app_list/arc/arc_usb_host_permission_browsertest.cc index 748a166727390f..ecde97c9063c6b 100644 --- a/chrome/browser/ui/app_list/arc/arc_usb_host_permission_browsertest.cc +++ b/chrome/browser/ui/app_list/arc/arc_usb_host_permission_browsertest.cc @@ -217,8 +217,8 @@ IN_PROC_BROWSER_TEST_F(ArcUsbHostPermissionTest, UsbTemporayPermissionTest) { AddArcPackage(kPackageName); // Persistent device0. const std::string guid0 = "TestGuidXXXXXX0"; - const std::u16string device_name0 = base::UTF8ToUTF16("TestDevice0"); - const std::u16string serial_number0 = base::UTF8ToUTF16("TestSerialNumber0"); + const std::u16string device_name0 = u"TestDevice0"; + const std::u16string serial_number0 = u"TestSerialNumber0"; const uint16_t vendor_id0 = 123; const uint16_t product_id0 = 456; @@ -240,19 +240,19 @@ IN_PROC_BROWSER_TEST_F(ArcUsbHostPermissionTest, UsbChromePrefsTest) { // Persistent device0. const std::string guid0 = "TestGuidXXXXXX0"; - const std::u16string device_name0 = base::UTF8ToUTF16("TestDevice0"); - const std::u16string serial_number0 = base::UTF8ToUTF16("TestSerialNumber0"); + const std::u16string device_name0 = u"TestDevice0"; + const std::u16string serial_number0 = u"TestSerialNumber0"; const uint16_t vendor_id0 = 123; const uint16_t product_id0 = 456; // Persistent device1. const std::string guid1 = "TestGuidXXXXXX1"; - const std::u16string device_name1 = base::UTF8ToUTF16("TestDevice1"); - const std::u16string serial_number1 = base::UTF8ToUTF16("TestSerialNumber1"); + const std::u16string device_name1 = u"TestDevice1"; + const std::u16string serial_number1 = u"TestSerialNumber1"; const uint16_t vendor_id1 = 234; const uint16_t product_id1 = 567; // Non persistent device2. const std::string guid2 = "TestGuidXXXXXX2"; - const std::u16string device_name2 = base::UTF8ToUTF16("TestDevice2"); + const std::u16string device_name2 = u"TestDevice2"; const uint16_t vendor_id2 = 345; const uint16_t product_id2 = 678; @@ -320,7 +320,7 @@ IN_PROC_BROWSER_TEST_F(ArcUsbHostKioskPermissionTest, UsbKioskPermission) { AddArcPackage(kPackageName); // Persistent device0. const std::string guid = "TestGuidXXXXXX0"; - const std::u16string serial_number = base::UTF8ToUTF16("TestSerialNumber0"); + const std::u16string serial_number = u"TestSerialNumber0"; const uint16_t vendor_id = 123; const uint16_t product_id = 456; diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider_unittest.cc b/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider_unittest.cc index 6d4574bda60d48..b6db205248bb0a 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_app_reinstall_search_provider_unittest.cc @@ -230,7 +230,7 @@ TEST_F(ArcAppReinstallSearchProviderTest, TestResultsWithSearchChanged) { // Test that we set to 0 results when having a query, or when arc is turned // off. - app_provider_->Start(base::UTF8ToUTF16("non empty query")); + app_provider_->Start(u"non empty query"); EXPECT_EQ(0u, app_provider_->results().size()); // Verify that all icons are still loaded. EXPECT_EQ(2u, app_provider_->icon_urls_.size()); @@ -434,9 +434,9 @@ TEST_F(ArcAppReinstallSearchProviderTest, TestResultListComparison) { b.emplace_back(new TestSearchResult); EXPECT_TRUE(app_list::ArcAppReinstallSearchProvider::ResultsIdentical(a, b)); // Different Titles. - a[0]->SetTitle(base::UTF8ToUTF16("fake_title")); + a[0]->SetTitle(u"fake_title"); EXPECT_FALSE(app_list::ArcAppReinstallSearchProvider::ResultsIdentical(a, b)); - b[0]->SetTitle(base::UTF8ToUTF16("fake_title")); + b[0]->SetTitle(u"fake_title"); EXPECT_TRUE(app_list::ArcAppReinstallSearchProvider::ResultsIdentical(a, b)); // Different ID. diff --git a/chrome/browser/ui/app_list/search/tests/zero_state_file_provider_unittest.cc b/chrome/browser/ui/app_list/search/tests/zero_state_file_provider_unittest.cc index ec9a1beb49cc27..89983232f411d8 100644 --- a/chrome/browser/ui/app_list/search/tests/zero_state_file_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/tests/zero_state_file_provider_unittest.cc @@ -74,7 +74,7 @@ class ZeroStateFileProviderTest : public testing::Test { }; TEST_F(ZeroStateFileProviderTest, NoResultsWithQuery) { - provider_->Start(base::UTF8ToUTF16("query")); + provider_->Start(u"query"); Wait(); EXPECT_TRUE(provider_->results().empty()); } diff --git a/chrome/browser/ui/ash/assistant/assistant_timers_browsertest.cc b/chrome/browser/ui/ash/assistant/assistant_timers_browsertest.cc index 2036d5014b41ab..4ef84067bd6280 100644 --- a/chrome/browser/ui/ash/assistant/assistant_timers_browsertest.cc +++ b/chrome/browser/ui/ash/assistant/assistant_timers_browsertest.cc @@ -271,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(AssistantTimersBrowserTest, EXPECT_EQ(2u, action_buttons.size()); // Tap the "CANCEL" action button in the notification. - EXPECT_EQ(base::UTF8ToUTF16("CANCEL"), action_buttons.at(1)->GetText()); + EXPECT_EQ(u"CANCEL", action_buttons.at(1)->GetText()); TapOnAndWait(action_buttons.at(1)); ShowAssistantUi(); diff --git a/chrome/browser/ui/ash/system_tray_client_browsertest.cc b/chrome/browser/ui/ash/system_tray_client_browsertest.cc index 61fb448db6a914..f4c1752e3032f2 100644 --- a/chrome/browser/ui/ash/system_tray_client_browsertest.cc +++ b/chrome/browser/ui/ash/system_tray_client_browsertest.cc @@ -57,11 +57,10 @@ IN_PROC_BROWSER_TEST_F(SystemTrayClientEnterpriseTest, TrayEnterprise) { true /* open_tray */)); std::u16string expected_text = ash::features::IsManagedDeviceUIRedesignEnabled() - ? l10n_util::GetStringFUTF16(IDS_ASH_SHORT_MANAGED_BY, - base::UTF8ToUTF16("example.com")) + ? l10n_util::GetStringFUTF16(IDS_ASH_SHORT_MANAGED_BY, u"example.com") : l10n_util::GetStringFUTF16(IDS_ASH_ENTERPRISE_DEVICE_MANAGED_BY, ui::GetChromeOSDeviceName(), - base::UTF8ToUTF16("example.com")); + u"example.com"); EXPECT_EQ(expected_text, test_api->GetBubbleViewTooltip(ash::VIEW_ID_TRAY_ENTERPRISE)); diff --git a/chrome/browser/ui/autofill/save_address_profile_bubble_controller_impl.cc b/chrome/browser/ui/autofill/save_address_profile_bubble_controller_impl.cc index c17e8719ee0a33..eacd354e57540f 100644 --- a/chrome/browser/ui/autofill/save_address_profile_bubble_controller_impl.cc +++ b/chrome/browser/ui/autofill/save_address_profile_bubble_controller_impl.cc @@ -41,7 +41,7 @@ void SaveAddressProfileBubbleControllerImpl::OfferSave( std::u16string SaveAddressProfileBubbleControllerImpl::GetWindowTitle() const { // TODO(crbug.com/1167060): Use ineternationalized string upon having final // strings. - return base::UTF8ToUTF16("Save Address?"); + return u"Save Address?"; } const AutofillProfile& diff --git a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc index eaded4a37cde95..2e84a1948a5c82 100644 --- a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc +++ b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc @@ -538,13 +538,13 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, ClosableAfterNavigation) { // Navigate it elsewhere. content::TestNavigationObserver nav_observer(popup); popup->GetMainFrame()->ExecuteJavaScriptForTests( - base::UTF8ToUTF16("location.href = '/empty.html'"), base::NullCallback()); + u"location.href = '/empty.html'", base::NullCallback()); nav_observer.Wait(); // Have it close itself. CloseObserver close_observer(popup); - popup->GetMainFrame()->ExecuteJavaScriptForTests( - base::UTF8ToUTF16("window.close()"), base::NullCallback()); + popup->GetMainFrame()->ExecuteJavaScriptForTests(u"window.close()", + base::NullCallback()); close_observer.Wait(); } diff --git a/chrome/browser/ui/cocoa/status_bubble_mac_interactive_uitest.mm b/chrome/browser/ui/cocoa/status_bubble_mac_interactive_uitest.mm index 208a875a133cc4..6c46d325e87fe7 100644 --- a/chrome/browser/ui/cocoa/status_bubble_mac_interactive_uitest.mm +++ b/chrome/browser/ui/cocoa/status_bubble_mac_interactive_uitest.mm @@ -28,7 +28,7 @@ EXPECT_FALSE(NSApp.hidden); [NSApp hide:nil]; EXPECT_TRUE(NSApp.hidden); - status_bubble->SetStatus(base::UTF8ToUTF16("Testing")); + status_bubble->SetStatus(u"Testing"); EXPECT_TRUE(NSApp.hidden); [NSApp unhide:nil]; EXPECT_FALSE(NSApp.hidden); diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc b/chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc index 209a069087b1fd..ad9138f599aa67 100644 --- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc +++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_browsertest.cc @@ -45,7 +45,7 @@ IN_PROC_BROWSER_TEST_F(JavaScriptDialogTest, ReloadDoesntHang) { scoped_refptr runner = new content::MessageLoopRunner; js_helper->SetDialogShownCallbackForTesting(runner->QuitClosure()); - tab->GetMainFrame()->ExecuteJavaScriptForTests(base::UTF8ToUTF16("alert()"), + tab->GetMainFrame()->ExecuteJavaScriptForTests(u"alert()", base::NullCallback()); runner->Run(); @@ -68,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(JavaScriptDialogTest, browser()->tab_strip_model()->GetActiveWebContents(); content::WebContentsAddedObserver new_wc_observer; tab1->GetMainFrame()->ExecuteJavaScriptForTests( - base::UTF8ToUTF16("window.open('about:blank');"), base::NullCallback()); + u"window.open('about:blank');", base::NullCallback()); content::WebContents* tab2 = new_wc_observer.GetWebContents(); ASSERT_NE(tab1, tab2); ASSERT_EQ(tab1->GetMainFrame()->GetProcess(), @@ -80,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(JavaScriptDialogTest, javascript_dialogs::TabModalDialogManager* js_helper2 = javascript_dialogs::TabModalDialogManager::FromWebContents(tab2); js_helper2->SetDialogShownCallbackForTesting(runner->QuitClosure()); - tab2->GetMainFrame()->ExecuteJavaScriptForTests(base::UTF8ToUTF16("alert()"), + tab2->GetMainFrame()->ExecuteJavaScriptForTests(u"alert()", base::NullCallback()); runner->Run(); diff --git a/chrome/browser/ui/login/login_handler_browsertest.cc b/chrome/browser/ui/login/login_handler_browsertest.cc index 0e04039b48c6b5..d013ef5fa94a58 100644 --- a/chrome/browser/ui/login/login_handler_browsertest.cc +++ b/chrome/browser/ui/login/login_handler_browsertest.cc @@ -155,7 +155,7 @@ void TestProxyAuth(Browser* browser, const GURL& test_page) { WindowedAuthSuppliedObserver auth_supplied_waiter(controller); LoginHandler* handler = observer.handlers().front(); - handler->SetAuth(base::UTF8ToUTF16("foo"), base::UTF8ToUTF16("bar")); + handler->SetAuth(u"foo", u"bar"); auth_supplied_waiter.Wait(); std::u16string expected_title = base::ASCIIToUTF16("OK"); @@ -318,7 +318,7 @@ const char kNoAuthPage1[] = "/simple.html"; std::u16string ExpectedTitleFromAuth(const std::u16string& username, const std::u16string& password) { // The TestServer sets the title to username/password on successful login. - return username + base::UTF8ToUTF16("/") + password; + return username + u"/" + password; } // Confirm that targetting an auth required @@ -1286,7 +1286,7 @@ IN_PROC_BROWSER_TEST_P(LoginPromptBrowserTest, load_stop_waiter.Wait(); } - std::u16string expected_title(base::UTF8ToUTF16("status=401")); + std::u16string expected_title(u"status=401"); EXPECT_EQ(expected_title, contents->GetTitle()); EXPECT_EQ(0, observer.auth_supplied_count()); @@ -1320,7 +1320,7 @@ IN_PROC_BROWSER_TEST_P(LoginPromptBrowserTest, load_stop_waiter.Wait(); } - std::u16string expected_title(base::UTF8ToUTF16("status=200")); + std::u16string expected_title(u"status=200"); EXPECT_EQ(expected_title, contents->GetTitle()); EXPECT_EQ(0, observer.auth_supplied_count()); @@ -1383,7 +1383,7 @@ IN_PROC_BROWSER_TEST_P(LoginPromptBrowserTest, WindowedLoadStopObserver load_stop_waiter(controller, 1); load_stop_waiter.Wait(); - std::u16string expected_title(base::UTF8ToUTF16("status=200")); + std::u16string expected_title(u"status=200"); EXPECT_EQ(expected_title, contents->GetTitle()); EXPECT_EQ(2, observer.auth_supplied_count()); @@ -1427,7 +1427,7 @@ IN_PROC_BROWSER_TEST_P(LoginPromptBrowserTest, WindowedLoadStopObserver load_stop_waiter(controller, 1); load_stop_waiter.Wait(); - std::u16string expected_title(base::UTF8ToUTF16("status=401")); + std::u16string expected_title(u"status=401"); EXPECT_EQ(expected_title, contents->GetTitle()); EXPECT_EQ(0, observer.auth_supplied_count()); @@ -2330,8 +2330,7 @@ IN_PROC_BROWSER_TEST_P(LoginPromptExtensionBrowserTest, OnAuthRequiredCancels) { GURL test_page = embedded_test_server()->GetURL(kAuthBasicPage); ui_test_utils::NavigateToURL(browser(), test_page); - std::u16string expected_title( - base::UTF8ToUTF16("Denied: Missing Authorization Header")); + std::u16string expected_title(u"Denied: Missing Authorization Header"); EXPECT_EQ(expected_title, contents->GetTitle()); } diff --git a/chrome/browser/ui/media_router/media_router_ui_unittest.cc b/chrome/browser/ui/media_router/media_router_ui_unittest.cc index a1a82da72bc1a0..d7f37c8b774c99 100644 --- a/chrome/browser/ui/media_router/media_router_ui_unittest.cc +++ b/chrome/browser/ui/media_router/media_router_ui_unittest.cc @@ -534,7 +534,7 @@ TEST_F(MediaRouterViewsUITest, RouteCreationTimeoutForPresentation) { StartCastingAndExpectTimeout( MediaCastMode::PRESENTATION, l10n_util::GetStringFUTF8(IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT, - base::UTF8ToUTF16("frameurl.fakeurl")), + u"frameurl.fakeurl"), 20); } diff --git a/chrome/browser/ui/omnibox/omnibox_pedals_unittest.cc b/chrome/browser/ui/omnibox/omnibox_pedals_unittest.cc index d8d5dab5d963a9..f1c51e5e05b190 100644 --- a/chrome/browser/ui/omnibox/omnibox_pedals_unittest.cc +++ b/chrome/browser/ui/omnibox/omnibox_pedals_unittest.cc @@ -570,15 +570,14 @@ TEST(OmniboxPedals, DataLoadsForAllLocales) { // Instantiating the provider loads concept data from shared ResourceBundle. OmniboxPedalProvider provider(client); - EXPECT_EQ(provider.FindPedalMatch(base::UTF8ToUTF16("")), nullptr); + EXPECT_EQ(provider.FindPedalMatch(u""), nullptr); #if BUILDFLAG(IS_CHROMEOS_ASH) // TODO(orinj): Get ChromeOS to use the right dataset, but for now make this // a soft failure so as to not block all other platforms. To ensure this // is not going to cause failure in production, still test that English // triggering functions. Data is there; it works; but warn about locale. if (!provider.FindPedalMatch(base::UTF8ToUTF16(test_case.triggers[0]))) { - EXPECT_NE(provider.FindPedalMatch(base::UTF8ToUTF16("clear history")), - nullptr); + EXPECT_NE(provider.FindPedalMatch(u"clear history"), nullptr); LOG(WARNING) << "ChromeOS using English for locale " << test_case.locale; continue; } diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index 1238255079f5fb..5747b73971ca4c 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -885,7 +885,7 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, SearchDisabledDontCrashOnQuestionMark) { // instead of keystrokes. ASSERT_NO_FATAL_FAILURE({ omnibox_view->OnBeforePossibleChange(); - omnibox_view->SetUserText(base::UTF8ToUTF16("?")); + omnibox_view->SetUserText(u"?"); omnibox_view->OnAfterPossibleChange(true); }); ASSERT_FALSE(omnibox_view->model()->is_keyword_hint()); diff --git a/chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller_unittest.cc b/chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller_unittest.cc index a8c09e43ae9fd5..28dcc54032fd5c 100644 --- a/chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller_unittest.cc +++ b/chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller_unittest.cc @@ -360,8 +360,8 @@ TEST_F(SaveUpdateBubbleControllerTest, EditCredential) { PretendPasswordWaiting(); EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); - const std::u16string kExpectedUsername = base::UTF8ToUTF16("new_username"); - const std::u16string kExpectedPassword = base::UTF8ToUTF16("new_password"); + const std::u16string kExpectedUsername = u"new_username"; + const std::u16string kExpectedPassword = u"new_password"; controller()->OnCredentialEdited(kExpectedUsername, kExpectedPassword); EXPECT_EQ(kExpectedUsername, controller()->pending_password().username_value); diff --git a/chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller_unittest.cc b/chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller_unittest.cc index 4dd86f8f161539..ad6df9f904439a 100644 --- a/chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller_unittest.cc +++ b/chrome/browser/ui/passwords/bubble_controllers/save_update_with_account_store_bubble_controller_unittest.cc @@ -456,8 +456,8 @@ TEST_F(SaveUpdateWithAccountStoreBubbleControllerTest, EditCredential) { PretendPasswordWaiting(); EXPECT_CALL(*GetStore(), RemoveSiteStatsImpl(GURL(kSiteOrigin).GetOrigin())); - const std::u16string kExpectedUsername = base::UTF8ToUTF16("new_username"); - const std::u16string kExpectedPassword = base::UTF8ToUTF16("new_password"); + const std::u16string kExpectedUsername = u"new_username"; + const std::u16string kExpectedPassword = u"new_password"; controller()->OnCredentialEdited(kExpectedUsername, kExpectedPassword); EXPECT_EQ(kExpectedUsername, controller()->pending_password().username_value); diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc index 9ac473db2128fe..82c2d8d2892751 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc @@ -528,10 +528,9 @@ TEST_F(ManagePasswordsUIControllerTest, PasswordSavedUKMRecording) { controller()->OnPasswordSubmitted(std::move(test_form_manager)); controller()->SavePassword( - test.edit_username ? base::UTF8ToUTF16("other_username") + test.edit_username ? u"other_username" : submitted_form().username_value, - test.change_password ? base::UTF8ToUTF16("other_pwd") - : submitted_form().password_value); + test.change_password ? u"other_pwd" : submitted_form().password_value); ExpectIconAndControllerStateIs(password_manager::ui::MANAGE_STATE); // Fake navigation so that the old form manager gets destroyed and diff --git a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc index ce03be396da793..de63ce5313ad9c 100644 --- a/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc +++ b/chrome/browser/ui/tab_sharing/tab_sharing_infobar_delegate_unittest.cc @@ -18,8 +18,8 @@ namespace { -const std::u16string kSharedTabName = base::UTF8ToUTF16("example.com"); -const std::u16string kAppName = base::UTF8ToUTF16("sharing.com"); +const std::u16string kSharedTabName = u"example.com"; +const std::u16string kAppName = u"sharing.com"; class MockTabSharingUIViews : public TabSharingUI { public: diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc index 967c4f87cb8132..89f736fe0332af 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc @@ -484,12 +484,12 @@ TEST_F(BackFwdMenuModelTest, EscapeLabel) { NavigationSimulator::NavigateAndCommitFromDocument(GURL("http://www.a.com/1"), main_rfh()); web_contents()->UpdateTitleForEntry(controller().GetLastCommittedEntry(), - base::UTF8ToUTF16("A & B")); + u"A & B"); LoadURLAndUpdateState("http://www.a.com/2", "A && B"); NavigationSimulator::NavigateAndCommitFromDocument(GURL("http://www.a.com/2"), main_rfh()); web_contents()->UpdateTitleForEntry(controller().GetLastCommittedEntry(), - base::UTF8ToUTF16("A &&& B")); + u"A &&& B"); LoadURLAndUpdateState("http://www.a.com/3", ""); EXPECT_EQ(6, back_model->GetItemCount()); diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc index 70a6fb8bd9e099..8e7441a204b915 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc @@ -171,10 +171,7 @@ TEST_F(AppInfoPermissionsPanelTest, RetainedFilePermissionsObtainedCorrectly) { const std::vector retained_file_paths = panel.GetRetainedFilePaths(); ASSERT_EQ(3U, retained_file_paths.size()); - EXPECT_THAT(retained_file_paths, - Contains(Eq(base::UTF8ToUTF16("file_1.ext")))); - EXPECT_THAT(retained_file_paths, - Contains(Eq(base::UTF8ToUTF16("file_2.ext")))); - EXPECT_THAT(retained_file_paths, - Contains(Eq(base::UTF8ToUTF16("file_3.ext")))); + EXPECT_THAT(retained_file_paths, Contains(Eq(u"file_1.ext"))); + EXPECT_THAT(retained_file_paths, Contains(Eq(u"file_2.ext"))); + EXPECT_THAT(retained_file_paths, Contains(Eq(u"file_3.ext"))); } diff --git a/chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc b/chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc index df04a9dcefeb20..38ac50b50ac91e 100644 --- a/chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/arc_app_dialog_view_browsertest.cc @@ -176,9 +176,9 @@ class ArcAppPermissionDialogViewBrowserTest // USB flow test related. const std::string guid_ = "TestGuidXXXXXX"; - const std::u16string serial_number_ = base::UTF8ToUTF16("TestSerialNumber"); - const std::u16string manufacturer_string_ = base::UTF8ToUTF16("Factory"); - const std::u16string product_string_ = base::UTF8ToUTF16("Product"); + const std::u16string serial_number_ = u"TestSerialNumber"; + const std::u16string manufacturer_string_ = u"Factory"; + const std::u16string product_string_ = u"Product"; uint16_t vendor_id_ = 123; uint16_t product_id_ = 456; diff --git a/chrome/browser/ui/views/autofill/payments/credit_card_access_manager_browsertest.cc b/chrome/browser/ui/views/autofill/payments/credit_card_access_manager_browsertest.cc index 3d388402059d6f..8208602d1fdf90 100644 --- a/chrome/browser/ui/views/autofill/payments/credit_card_access_manager_browsertest.cc +++ b/chrome/browser/ui/views/autofill/payments/credit_card_access_manager_browsertest.cc @@ -65,8 +65,7 @@ IN_PROC_BROWSER_TEST_F(CreditCardAccessManagerBrowserTest, // CreditCardAccessManager is completely recreated on page navigation, so to // ensure we're not using stale pointers, always re-fetch it on use. EXPECT_TRUE(GetCreditCardAccessManager()->UnmaskedCardCacheIsEmpty()); - GetCreditCardAccessManager()->CacheUnmaskedCardInfo(card, - base::UTF8ToUTF16("123")); + GetCreditCardAccessManager()->CacheUnmaskedCardInfo(card, u"123"); EXPECT_FALSE(GetCreditCardAccessManager()->UnmaskedCardCacheIsEmpty()); // Cache should reset upon navigation. diff --git a/chrome/browser/ui/views/borealis/borealis_splash_screen_view.cc b/chrome/browser/ui/views/borealis/borealis_splash_screen_view.cc index bf087044cb2cc9..01b7ccc2dafdb6 100644 --- a/chrome/browser/ui/views/borealis/borealis_splash_screen_view.cc +++ b/chrome/browser/ui/views/borealis/borealis_splash_screen_view.cc @@ -66,8 +66,8 @@ BorealisSplashScreenView::BorealisSplashScreenView(Profile* profile) { set_close_on_deactivate(false); // TODO: b/174589567 Make splash screen look like mockups. - views::MessageBoxView* message_box = new views::MessageBoxView( - base::UTF8ToUTF16("BOREALIS IS STARTING... PLEASE WAIT")); + views::MessageBoxView* message_box = + new views::MessageBoxView(u"BOREALIS IS STARTING... PLEASE WAIT"); AddChildView(message_box); } diff --git a/chrome/browser/ui/views/certificate_selector_browsertest.cc b/chrome/browser/ui/views/certificate_selector_browsertest.cc index 42f75e4204cd7d..64cd2ad1b73d55 100644 --- a/chrome/browser/ui/views/certificate_selector_browsertest.cc +++ b/chrome/browser/ui/views/certificate_selector_browsertest.cc @@ -110,23 +110,19 @@ class CertificateSelectorTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(CertificateSelectorTest, GetRowText) { ui::TableModel* model = selector_->table_model_for_testing(); - EXPECT_EQ(base::UTF8ToUTF16("Client Cert A"), + EXPECT_EQ(u"Client Cert A", model->GetText(0, IDS_CERT_SELECTOR_SUBJECT_COLUMN)); - EXPECT_EQ(base::UTF8ToUTF16("B CA"), - model->GetText(0, IDS_CERT_SELECTOR_ISSUER_COLUMN)); + EXPECT_EQ(u"B CA", model->GetText(0, IDS_CERT_SELECTOR_ISSUER_COLUMN)); EXPECT_EQ(std::u16string(), model->GetText(0, IDS_CERT_SELECTOR_PROVIDER_COLUMN)); - EXPECT_EQ(base::UTF8ToUTF16("1000"), - model->GetText(0, IDS_CERT_SELECTOR_SERIAL_COLUMN)); + EXPECT_EQ(u"1000", model->GetText(0, IDS_CERT_SELECTOR_SERIAL_COLUMN)); - EXPECT_EQ(base::UTF8ToUTF16("Client Cert D"), + EXPECT_EQ(u"Client Cert D", model->GetText(1, IDS_CERT_SELECTOR_SUBJECT_COLUMN)); - EXPECT_EQ(base::UTF8ToUTF16("E CA"), - model->GetText(1, IDS_CERT_SELECTOR_ISSUER_COLUMN)); + EXPECT_EQ(u"E CA", model->GetText(1, IDS_CERT_SELECTOR_ISSUER_COLUMN)); EXPECT_EQ(std::u16string(), model->GetText(1, IDS_CERT_SELECTOR_PROVIDER_COLUMN)); - EXPECT_EQ(base::UTF8ToUTF16("1002"), - model->GetText(1, IDS_CERT_SELECTOR_SERIAL_COLUMN)); + EXPECT_EQ(u"1002", model->GetText(1, IDS_CERT_SELECTOR_SERIAL_COLUMN)); } IN_PROC_BROWSER_TEST_F(CertificateSelectorTest, GetSelectedCert) { diff --git a/chrome/browser/ui/views/external_protocol_dialog_browsertest.cc b/chrome/browser/ui/views/external_protocol_dialog_browsertest.cc index 4e8bc2e2abfc76..6e2a4e64a2e005 100644 --- a/chrome/browser/ui/views/external_protocol_dialog_browsertest.cc +++ b/chrome/browser/ui/views/external_protocol_dialog_browsertest.cc @@ -60,8 +60,7 @@ class ExternalProtocolDialogBrowserTest content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); dialog_ = new ExternalProtocolDialog( - web_contents, GURL("telnet://12345"), - base::UTF8ToUTF16("/usr/bin/telnet"), + web_contents, GURL("telnet://12345"), u"/usr/bin/telnet", url::Origin::Create(GURL(initiating_origin))); } diff --git a/chrome/browser/ui/views/location_bar/custom_tab_bar_view_browsertest.cc b/chrome/browser/ui/views/location_bar/custom_tab_bar_view_browsertest.cc index a43d69d2868273..fc649e3a2ea1a5 100644 --- a/chrome/browser/ui/views/location_bar/custom_tab_bar_view_browsertest.cc +++ b/chrome/browser/ui/views/location_bar/custom_tab_bar_view_browsertest.cc @@ -479,7 +479,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, std::u16string result; clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr, &result); - EXPECT_EQ(result, base::UTF8ToUTF16("http://example.test/")); + EXPECT_EQ(result, u"http://example.test/"); } // Paths above the launch url should be out of scope and should be closable from @@ -567,7 +567,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, SetTitleAndLocation(app_view->GetActiveWebContents(), base::ASCIIToUTF16("FooBar"), navigate_to); - EXPECT_EQ(base::UTF8ToUTF16("https://xn--lv8h.example"), + EXPECT_EQ(u"https://xn--lv8h.example", app_view->toolbar()->custom_tab_bar()->location_for_testing()); EXPECT_EQ(base::ASCIIToUTF16("FooBar"), app_view->toolbar()->custom_tab_bar()->title_for_testing()); @@ -589,7 +589,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, SetTitleAndLocation(app_view->GetActiveWebContents(), base::ASCIIToUTF16("FooBar"), navigate_to); - EXPECT_EQ(base::UTF8ToUTF16("https://ΐ.example"), + EXPECT_EQ(u"https://ΐ.example", app_view->toolbar()->custom_tab_bar()->location_for_testing()); EXPECT_EQ(base::ASCIIToUTF16("FooBar"), app_view->toolbar()->custom_tab_bar()->title_for_testing()); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 3af707b8352b8b..851b5807409435 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -709,7 +709,7 @@ void LocationBarView::SetOmniboxAdditionalText(const std::u16string& text) { text.empty() ? text // TODO(pkasting): This should use a localizable string constant. - : base::UTF8ToUTF16("(") + text + base::UTF8ToUTF16(")"); + : u"(" + text + u")"; if (wrapped_text == GetOmniboxAdditionalText()) return; omnibox_additional_text_view_->SetText(wrapped_text); diff --git a/chrome/browser/ui/views/location_bar/location_bar_view_browsertest.cc b/chrome/browser/ui/views/location_bar/location_bar_view_browsertest.cc index e346b5cc734956..3ddd18afd20701 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view_browsertest.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view_browsertest.cc @@ -173,8 +173,8 @@ IN_PROC_BROWSER_TEST_F(TouchLocationBarViewBrowserTest, if (child != omnibox_view_views) child->SetVisible(false); } - omnibox_view_views->SetText(base::UTF8ToUTF16("谷")); - GetLocationBarView()->SetImeInlineAutocompletion(base::UTF8ToUTF16("歌")); + omnibox_view_views->SetText(u"谷"); + GetLocationBarView()->SetImeInlineAutocompletion(u"歌"); EXPECT_TRUE(ime_inline_autocomplete_view->GetVisible()); GetLocationBarView()->Layout(); diff --git a/chrome/browser/ui/views/media_router/cast_dialog_sink_button_unittest.cc b/chrome/browser/ui/views/media_router/cast_dialog_sink_button_unittest.cc index 9962d384d3caba..8bcd6f9ce3e5c6 100644 --- a/chrome/browser/ui/views/media_router/cast_dialog_sink_button_unittest.cc +++ b/chrome/browser/ui/views/media_router/cast_dialog_sink_button_unittest.cc @@ -29,7 +29,7 @@ class CastDialogSinkButtonTest : public ChromeViewsTestBase { TEST_F(CastDialogSinkButtonTest, SetTitleLabel) { UIMediaSink sink; - sink.friendly_name = base::UTF8ToUTF16("sink name"); + sink.friendly_name = u"sink name"; CastDialogSinkButton button(views::Button::PressedCallback(), sink); EXPECT_EQ(sink.friendly_name, button.title()->GetText()); } @@ -59,7 +59,7 @@ TEST_F(CastDialogSinkButtonTest, SetStatusLabelForActiveSink) { button1.subtitle()->GetText()); sink.state = UIMediaSinkState::CONNECTED; - sink.status_text = base::UTF8ToUTF16("status text"); + sink.status_text = u"status text"; CastDialogSinkButton button2(views::Button::PressedCallback(), sink); EXPECT_EQ(sink.status_text, button2.subtitle()->GetText()); diff --git a/chrome/browser/ui/views/media_router/cast_dialog_view_browsertest.cc b/chrome/browser/ui/views/media_router/cast_dialog_view_browsertest.cc index e1e043972a7509..ad74f487507b80 100644 --- a/chrome/browser/ui/views/media_router/cast_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/media_router/cast_dialog_view_browsertest.cc @@ -16,7 +16,7 @@ namespace { media_router::UIMediaSink CreateAvailableSink() { media_router::UIMediaSink sink; sink.id = "sink_available"; - sink.friendly_name = base::UTF8ToUTF16("TestAvailableSink"); + sink.friendly_name = u"TestAvailableSink"; sink.state = media_router::UIMediaSinkState::AVAILABLE; sink.cast_modes = {media_router::TAB_MIRROR, media_router::DESKTOP_MIRROR}; return sink; @@ -25,7 +25,7 @@ media_router::UIMediaSink CreateAvailableSink() { media_router::UIMediaSink CreateConnectedSink() { media_router::UIMediaSink sink; sink.id = "sink_connected"; - sink.friendly_name = base::UTF8ToUTF16("TestConnectedSink"); + sink.friendly_name = u"TestConnectedSink"; sink.state = media_router::UIMediaSinkState::CONNECTED; sink.cast_modes = {media_router::TAB_MIRROR, media_router::DESKTOP_MIRROR}; sink.route = media_router::MediaRoute( @@ -37,7 +37,7 @@ media_router::UIMediaSink CreateConnectedSink() { media_router::UIMediaSink CreateUnavailableSink() { media_router::UIMediaSink sink; sink.id = "sink_unavailable"; - sink.friendly_name = base::UTF8ToUTF16("TestUnavailableSink"); + sink.friendly_name = u"TestUnavailableSink"; sink.state = media_router::UIMediaSinkState::UNAVAILABLE; sink.cast_modes = {media_router::TAB_MIRROR, media_router::DESKTOP_MIRROR}; return sink; @@ -46,7 +46,7 @@ media_router::UIMediaSink CreateUnavailableSink() { media_router::CastDialogModel CreateModelWithSinks( std::vector sinks) { media_router::CastDialogModel model; - model.set_dialog_header(base::UTF8ToUTF16("Dialog header")); + model.set_dialog_header(u"Dialog header"); model.set_media_sinks(std::move(sinks)); return model; } diff --git a/chrome/browser/ui/views/media_router/cast_dialog_view_unittest.cc b/chrome/browser/ui/views/media_router/cast_dialog_view_unittest.cc index 9331a1d4fc0c7d..68cc5359c4d9c7 100644 --- a/chrome/browser/ui/views/media_router/cast_dialog_view_unittest.cc +++ b/chrome/browser/ui/views/media_router/cast_dialog_view_unittest.cc @@ -58,7 +58,7 @@ UIMediaSink CreateConnectedSink() { CastDialogModel CreateModelWithSinks(std::vector sinks) { CastDialogModel model; - model.set_dialog_header(base::UTF8ToUTF16("Dialog header")); + model.set_dialog_header(u"Dialog header"); model.set_media_sinks(std::move(sinks)); return model; } diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc index e0e5f665a5598c..99378dca5687a5 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc @@ -911,11 +911,11 @@ TEST_F(OmniboxViewViewsTest, RevertOnEscape) { } TEST_F(OmniboxViewViewsTest, BackspaceExitsKeywordMode) { - omnibox_view()->SetUserText(base::UTF8ToUTF16("user text")); + omnibox_view()->SetUserText(u"user text"); omnibox_view()->model()->EnterKeywordModeForDefaultSearchProvider( OmniboxEventProto::KEYBOARD_SHORTCUT); - ASSERT_EQ(base::UTF8ToUTF16("user text"), omnibox_view()->GetText()); + ASSERT_EQ(u"user text", omnibox_view()->GetText()); ASSERT_TRUE(omnibox_view()->IsSelectAll()); ASSERT_FALSE(omnibox_view()->model()->keyword().empty()); @@ -1057,8 +1057,7 @@ TEST_F(OmniboxViewViewsTest, SelectAllDuringMouseDown) { TEST_F(OmniboxViewViewsTest, SetWindowTextAndCaretPos) { // googl|e.com - omnibox_view()->SetWindowTextAndCaretPos(base::UTF8ToUTF16("google.com"), 5, - false, false); + omnibox_view()->SetWindowTextAndCaretPos(u"google.com", 5, false, false); EXPECT_EQ(base::ASCIIToUTF16("google.com"), omnibox_view()->GetText()); EXPECT_EQ(omnibox_view()->GetRenderText()->GetAllSelections(), (std::vector{{5, 5}})); @@ -1066,22 +1065,22 @@ TEST_F(OmniboxViewViewsTest, SetWindowTextAndCaretPos) { TEST_F(OmniboxViewViewsTest, OnInlineAutocompleteTextMaybeChanged) { // No selection, google.com| - omnibox_view()->OnInlineAutocompleteTextMaybeChanged( - base::UTF8ToUTF16("google.com"), {{10, 10}}, 10); + omnibox_view()->OnInlineAutocompleteTextMaybeChanged(u"google.com", + {{10, 10}}, 10); EXPECT_EQ(base::ASCIIToUTF16("google.com"), omnibox_view()->GetText()); EXPECT_EQ(omnibox_view()->GetRenderText()->GetAllSelections(), (std::vector{{10, 10}})); // Single selection, gmai[l.com] - omnibox_view()->OnInlineAutocompleteTextMaybeChanged( - base::UTF8ToUTF16("gmail.com"), {{9, 4}}, 4); + omnibox_view()->OnInlineAutocompleteTextMaybeChanged(u"gmail.com", {{9, 4}}, + 4); EXPECT_EQ(base::ASCIIToUTF16("gmail.com"), omnibox_view()->GetText()); EXPECT_EQ(omnibox_view()->GetRenderText()->GetAllSelections(), (std::vector{{9, 4}})); // Multiselection, [go]ogl[e.com] - omnibox_view()->OnInlineAutocompleteTextMaybeChanged( - base::UTF8ToUTF16("google.com"), {{10, 5}, {0, 2}}, 3); + omnibox_view()->OnInlineAutocompleteTextMaybeChanged(u"google.com", + {{10, 5}, {0, 2}}, 3); EXPECT_EQ(base::ASCIIToUTF16("google.com"), omnibox_view()->GetText()); EXPECT_EQ(omnibox_view()->GetRenderText()->GetAllSelections(), (std::vector{{10, 5}, {0, 2}})); @@ -1862,17 +1861,14 @@ TEST_P(OmniboxViewViewsRevealOnHoverTest, HoverAndExit) { TEST_P(OmniboxViewViewsRevealOnHoverTest, HoverAndExitIDN) { // The display URL used in simplified domain display tests. const std::u16string kSimplifiedDomainDisplayIDNUrl = - base::UTF8ToUTF16("https://テスト.住所の例.test/bar"); + u"https://テスト.住所の例.test/bar"; const std::u16string kSimplifiedDomainDisplayIDNUrlHostnameAndScheme = - base::UTF8ToUTF16("https://テスト.住所の例.test"); + u"https://テスト.住所の例.test"; const std::u16string kSimplifiedDomainDisplayIDNUrlSubdomainAndScheme = - base::UTF8ToUTF16("https://テスト."); - const std::u16string kSimplifiedDomainDisplayIDNUrlSubdomain = - base::UTF8ToUTF16("テスト."); - const std::u16string kSimplifiedDomainDisplayIDNUrlPath = - base::UTF8ToUTF16("/bar"); - const std::u16string kSimplifiedDomainDisplayIDNUrlScheme = - base::UTF8ToUTF16("https://"); + u"https://テスト."; + const std::u16string kSimplifiedDomainDisplayIDNUrlSubdomain = u"テスト."; + const std::u16string kSimplifiedDomainDisplayIDNUrlPath = u"/bar"; + const std::u16string kSimplifiedDomainDisplayIDNUrlScheme = u"https://"; UpdateDisplayURL(kSimplifiedDomainDisplayIDNUrl); // Call OnThemeChanged() to create the animations. omnibox_view()->OnThemeChanged(); @@ -1940,19 +1936,18 @@ TEST_P(OmniboxViewViewsRevealOnHoverTest, PrivateRegistry) { return; const std::u16string kSimplifiedDomainDisplayPrivateRegistryUrl = - base::UTF8ToUTF16("https://foo.blogspot.com/bar"); + u"https://foo.blogspot.com/bar"; const std::u16string kSimplifiedDomainDisplayPrivateRegistryUrlHostnameAndScheme = - base::UTF8ToUTF16("https://foo.blogspot.com"); + u"https://foo.blogspot.com"; const std::u16string kSimplifiedDomainDisplayPrivateRegistryUrlSubdomainAndScheme = - base::UTF8ToUTF16("https://foo."); + u"https://foo."; const std::u16string kSimplifiedDomainDisplayPrivateRegistryUrlSubdomain = - base::UTF8ToUTF16("foo."); - const std::u16string kSimplifiedDomainDisplayPrivateRegistryUrlPath = - base::UTF8ToUTF16("/bar"); + u"foo."; + const std::u16string kSimplifiedDomainDisplayPrivateRegistryUrlPath = u"/bar"; const std::u16string kSimplifiedDomainDisplayPrivateRegistryUrlScheme = - base::UTF8ToUTF16("https://"); + u"https://"; UpdateDisplayURL(kSimplifiedDomainDisplayPrivateRegistryUrl); // Call OnThemeChanged() to create the animations. omnibox_view()->OnThemeChanged(); @@ -1971,17 +1966,15 @@ TEST_P(OmniboxViewViewsRevealOnHoverTest, PrivateRegistry) { TEST_P(OmniboxViewViewsRevealOnHoverTest, HoverAndExitDomainInPath) { // The display URL used in simplified domain display tests. const std::u16string kSimplifiedDomainDisplayRepeatedUrl = - base::UTF8ToUTF16("https://ex.example.test/example.test"); + u"https://ex.example.test/example.test"; const std::u16string kSimplifiedDomainDisplayRepeatedUrlHostnameAndScheme = - base::UTF8ToUTF16("https://ex.example.test"); + u"https://ex.example.test"; const std::u16string kSimplifiedDomainDisplayRepeatedUrlSubdomainAndScheme = - base::UTF8ToUTF16("https://ex."); - const std::u16string kSimplifiedDomainDisplayRepeatedUrlSubdomain = - base::UTF8ToUTF16("ex."); + u"https://ex."; + const std::u16string kSimplifiedDomainDisplayRepeatedUrlSubdomain = u"ex."; const std::u16string kSimplifiedDomainDisplayRepeatedUrlPath = - base::UTF8ToUTF16("/example.test"); - const std::u16string kSimplifiedDomainDisplayRepeatedUrlScheme = - base::UTF8ToUTF16("https://"); + u"/example.test"; + const std::u16string kSimplifiedDomainDisplayRepeatedUrlScheme = u"https://"; location_bar_model()->set_url(GURL(kSimplifiedDomainDisplayRepeatedUrl)); location_bar_model()->set_url_for_display( kSimplifiedDomainDisplayRepeatedUrl); diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc index a4e75e291af1c8..f9a2dfc94d88f7 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_browsertest.cc @@ -868,7 +868,7 @@ IN_PROC_BROWSER_TEST_F(PageInfoBubbleViewBrowserTest, MalwareAndEvCert) { EXPECT_EQ(GetCertificateButtonSubtitle(), l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_VERIFIED, - base::UTF8ToUTF16("Thawte Inc"), base::UTF8ToUTF16("US"))); + u"Thawte Inc", u"US")); } namespace { diff --git a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc index 7f04579e7dba65..f1a69b835f41d5 100644 --- a/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc @@ -678,7 +678,7 @@ TEST_F(PageInfoBubbleViewTest, CertificateButtonShowsEvCertDetails) { // name and country of incorporation. EXPECT_EQ(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_VERIFIED, - base::UTF8ToUTF16("Test Org"), base::UTF8ToUTF16("US")), + u"Test Org", u"US"), api_->GetCertificateButtonSubtitleText()); } @@ -719,6 +719,6 @@ TEST_F(PageInfoBubbleViewTest, EvDetailsShowForCertWithStateButNoLocality) { // name and country of incorporation. EXPECT_EQ(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY_EV_VERIFIED, - base::UTF8ToUTF16("Test Org"), base::UTF8ToUTF16("US")), + u"Test Org", u"US"), api_->GetCertificateButtonSubtitleText()); } diff --git a/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc index d0c9e8f9a588bb..0dff1b3c88103f 100644 --- a/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc +++ b/chrome/browser/ui/views/payments/credit_card_editor_view_controller_browsertest.cc @@ -849,8 +849,7 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCreditCardEditorTest, autofill::ADDRESS_HOME_STREET_ADDRESS); SetEditorTextfieldValue(base::ASCIIToUTF16("BobCity"), autofill::ADDRESS_HOME_CITY); - SetComboboxValue(base::UTF8ToUTF16("California"), - autofill::ADDRESS_HOME_STATE); + SetComboboxValue(u"California", autofill::ADDRESS_HOME_STATE); SetEditorTextfieldValue(base::ASCIIToUTF16("BobZip"), autofill::ADDRESS_HOME_ZIP); SetEditorTextfieldValue(base::ASCIIToUTF16("+15755555555"), diff --git a/chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc index 30abeb00906136..042e770cc7d466 100644 --- a/chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc +++ b/chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc @@ -118,16 +118,16 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCvcUnmaskViewControllerTest, views::Textfield* cvc_field = static_cast(dialog_view()->GetViewByID( static_cast(DialogViewID::CVC_PROMPT_TEXT_FIELD))); - cvc_field->SetText(base::UTF8ToUTF16("")); - cvc_field->InsertOrReplaceText(base::UTF8ToUTF16("0")); + cvc_field->SetText(u""); + cvc_field->InsertOrReplaceText(u"0"); EXPECT_FALSE(done_button->GetEnabled()); - cvc_field->SetText(base::UTF8ToUTF16("")); - cvc_field->InsertOrReplaceText(base::UTF8ToUTF16("aaa")); + cvc_field->SetText(u""); + cvc_field->InsertOrReplaceText(u"aaa"); EXPECT_FALSE(done_button->GetEnabled()); - cvc_field->SetText(base::UTF8ToUTF16("")); - cvc_field->InsertOrReplaceText(base::UTF8ToUTF16("111")); + cvc_field->SetText(u""); + cvc_field->InsertOrReplaceText(u"111"); EXPECT_TRUE(done_button->GetEnabled()); } diff --git a/chrome/browser/ui/views/payments/order_summary_view_controller.cc b/chrome/browser/ui/views/payments/order_summary_view_controller.cc index 1e06a593627880..4de298b1bc2ec6 100644 --- a/chrome/browser/ui/views/payments/order_summary_view_controller.cc +++ b/chrome/browser/ui/views/payments/order_summary_view_controller.cc @@ -173,7 +173,7 @@ void OrderSummaryViewController::FillContentView(views::View* content_view) { for (size_t i = 0; i < display_items.size(); i++) { DialogViewID view_id = i < line_items.size() ? line_items[i] : DialogViewID::VIEW_ID_NONE; - std::u16string currency = base::UTF8ToUTF16(""); + std::u16string currency = u""; if (is_mixed_currency) { currency = base::UTF8ToUTF16((*display_items[i])->amount->currency); } diff --git a/chrome/browser/ui/views/payments/payment_credential_enrollment_dialog_view_browsertest.cc b/chrome/browser/ui/views/payments/payment_credential_enrollment_dialog_view_browsertest.cc index 69dae629961b28..653fe31ee15862 100644 --- a/chrome/browser/ui/views/payments/payment_credential_enrollment_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_credential_enrollment_dialog_view_browsertest.cc @@ -55,7 +55,7 @@ class PaymentCredentialEnrollmentDialogViewTest instrument_icon_ = instrument_icon.get(); model_.set_instrument_icon(std::move(instrument_icon)); - model_.set_instrument_name(base::UTF8ToUTF16("Visa ••••4444")); + model_.set_instrument_name(u"Visa ••••4444"); model_.set_accept_button_label(l10n_util::GetStringUTF16( IDS_PAYMENT_CREDENTIAL_ENROLLMENT_ACCEPT_BUTTON_LABEL)); @@ -302,11 +302,11 @@ IN_PROC_BROWSER_TEST_F(PaymentCredentialEnrollmentDialogViewTest, ExpectViewMatchesModel(); - model_.set_title(base::UTF8ToUTF16("Test Title")); - model_.set_description(base::UTF8ToUTF16("Test description")); - model_.set_instrument_name(base::UTF8ToUTF16("Test instrument")); - model_.set_accept_button_label(base::UTF8ToUTF16("Test accept")); - model_.set_cancel_button_label(base::UTF8ToUTF16("Test cancel")); + model_.set_title(u"Test Title"); + model_.set_description(u"Test description"); + model_.set_instrument_name(u"Test instrument"); + model_.set_accept_button_label(u"Test accept"); + model_.set_cancel_button_label(u"Test cancel"); dialog_view_->OnModelUpdated(); diff --git a/chrome/browser/ui/views/payments/payment_request_browsertest.cc b/chrome/browser/ui/views/payments/payment_request_browsertest.cc index 60ba651a93f88b..baff6b447151e4 100644 --- a/chrome/browser/ui/views/payments/payment_request_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_request_browsertest.cc @@ -219,7 +219,7 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestAbortTest, AddCreditCard(card); // Visa. InvokePaymentRequestUI(); - OpenCVCPromptWithCVC(base::UTF8ToUTF16("123")); + OpenCVCPromptWithCVC(u"123"); ResetEventWaiter(DialogEvent::ABORT_CALLED); diff --git a/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc b/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc index 1d6f97f8ac19cb..d5d3926c1981dd 100644 --- a/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc +++ b/chrome/browser/ui/views/payments/payment_request_can_make_payment_metrics_browsertest.cc @@ -201,13 +201,10 @@ IN_PROC_BROWSER_TEST_F(PaymentRequestCanMakePaymentMetricsTest, // Add a test credit card. OpenCreditCardEditorScreen(); - SetEditorTextfieldValue(base::UTF8ToUTF16("Bob Simpson"), - autofill::CREDIT_CARD_NAME_FULL); - SetEditorTextfieldValue(base::UTF8ToUTF16("4111111111111111"), - autofill::CREDIT_CARD_NUMBER); - SetComboboxValue(base::UTF8ToUTF16("05"), autofill::CREDIT_CARD_EXP_MONTH); - SetComboboxValue(base::UTF8ToUTF16("2026"), - autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR); + SetEditorTextfieldValue(u"Bob Simpson", autofill::CREDIT_CARD_NAME_FULL); + SetEditorTextfieldValue(u"4111111111111111", autofill::CREDIT_CARD_NUMBER); + SetComboboxValue(u"05", autofill::CREDIT_CARD_EXP_MONTH); + SetComboboxValue(u"2026", autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR); SelectBillingAddress(billing_address.guid()); ResetEventWaiter(DialogEvent::BACK_TO_PAYMENT_SHEET_NAVIGATION); ClickOnDialogViewAndWait(DialogViewID::EDITOR_SAVE_BUTTON); diff --git a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc index 5dffaa828132ce..2642aaa572f395 100644 --- a/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc +++ b/chrome/browser/ui/views/payments/payment_sheet_view_controller.cc @@ -893,8 +893,8 @@ std::unique_ptr PaymentSheetViewController::CreateDataSourceRow() { // TODO(pkasting): Remove these BEGIN/END_LINK tags and use a substitution for // "Settings", allowing this code to use the offset-returning versions of the // l10n getters. - std::u16string begin_tag = base::UTF8ToUTF16("BEGIN_LINK"); - std::u16string end_tag = base::UTF8ToUTF16("END_LINK"); + std::u16string begin_tag = u"BEGIN_LINK"; + std::u16string end_tag = u"END_LINK"; size_t link_begin = data_source.find(begin_tag); DCHECK(link_begin != std::u16string::npos); diff --git a/chrome/browser/ui/views/payments/secure_payment_confirmation_dialog_view_browsertest.cc b/chrome/browser/ui/views/payments/secure_payment_confirmation_dialog_view_browsertest.cc index 244acbf33ef1ad..657aa3a54f2b63 100644 --- a/chrome/browser/ui/views/payments/secure_payment_confirmation_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/payments/secure_payment_confirmation_dialog_view_browsertest.cc @@ -51,18 +51,18 @@ class SecurePaymentConfirmationDialogViewTest model_.set_merchant_label( l10n_util::GetStringUTF16(IDS_SECURE_PAYMENT_CONFIRMATION_STORE_LABEL)); - model_.set_merchant_value(base::UTF8ToUTF16("merchant.com")); + model_.set_merchant_value(u"merchant.com"); model_.set_instrument_label(l10n_util::GetStringUTF16( IDS_PAYMENT_REQUEST_PAYMENT_METHOD_SECTION_NAME)); - model_.set_instrument_value(base::UTF8ToUTF16("Mastercard ****4444")); + model_.set_instrument_value(u"Mastercard ****4444"); instrument_icon_ = std::make_unique(CreateInstrumentIcon(SK_ColorBLUE)); model_.set_instrument_icon(instrument_icon_.get()); model_.set_total_label( l10n_util::GetStringUTF16(IDS_SECURE_PAYMENT_CONFIRMATION_TOTAL_LABEL)); - model_.set_total_value(base::UTF8ToUTF16("$20.00 USD")); + model_.set_total_value(u"$20.00 USD"); model_.set_verify_button_label(l10n_util::GetStringUTF16( IDS_SECURE_PAYMENT_CONFIRMATION_VERIFY_BUTTON_LABEL)); @@ -317,15 +317,15 @@ IN_PROC_BROWSER_TEST_F(SecurePaymentConfirmationDialogViewTest, ExpectViewMatchesModel(); - model_.set_title(base::UTF8ToUTF16("Test Title")); - model_.set_merchant_label(base::UTF8ToUTF16("Test merchant")); - model_.set_merchant_value(base::UTF8ToUTF16("Test merchant value")); - model_.set_instrument_label(base::UTF8ToUTF16("Test instrument")); - model_.set_instrument_value(base::UTF8ToUTF16("Test instrument value")); - model_.set_total_label(base::UTF8ToUTF16("Test total")); - model_.set_total_value(base::UTF8ToUTF16("Test total value")); - model_.set_verify_button_label(base::UTF8ToUTF16("Test verify")); - model_.set_cancel_button_label(base::UTF8ToUTF16("Test cancel")); + model_.set_title(u"Test Title"); + model_.set_merchant_label(u"Test merchant"); + model_.set_merchant_value(u"Test merchant value"); + model_.set_instrument_label(u"Test instrument"); + model_.set_instrument_value(u"Test instrument value"); + model_.set_total_label(u"Test total"); + model_.set_total_value(u"Test total value"); + model_.set_verify_button_label(u"Test verify"); + model_.set_cancel_button_label(u"Test cancel"); test_delegate_->dialog_view()->OnModelUpdated(); diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc index fbeeba2de24735..5b976dd9bfa2c8 100644 --- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc +++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller.cc @@ -391,7 +391,7 @@ void ShippingAddressEditorViewController::UpdateCountries( std::make_pair(country->country_code(), country->name())); } else { // Separator, kept to make sure the size of the vector stays the same. - countries_.push_back(std::make_pair("", base::UTF8ToUTF16(""))); + countries_.push_back(std::make_pair("", u"")); } } // If there is a profile to edit, make sure to use its country for the initial diff --git a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc index 9449f4845494a0..1b9d93562101f7 100644 --- a/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc +++ b/chrome/browser/ui/views/payments/shipping_address_editor_view_controller_browsertest.cc @@ -321,8 +321,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_PaymentRequestShippingAddressEditorTest, test_region_data_loader_.SendAsynchronousData(regions); SetCommonFields(); - SetComboboxValue(base::UTF8ToUTF16("United States"), - autofill::ADDRESS_HOME_COUNTRY); + SetComboboxValue(u"United States", autofill::ADDRESS_HOME_COUNTRY); SetComboboxValue(base::UTF8ToUTF16(kAnyState), autofill::ADDRESS_HOME_STATE); std::string country_code(GetSelectedCountryCode()); @@ -695,11 +694,10 @@ IN_PROC_BROWSER_TEST_F(MAYBE_PaymentRequestShippingAddressEditorTest, OpenShippingAddressEditorScreen(); SetCommonFields(); - SetComboboxValue(base::UTF8ToUTF16("California"), - autofill::ADDRESS_HOME_STATE); + SetComboboxValue(u"California", autofill::ADDRESS_HOME_STATE); // Set an Australian phone number in international format. - SetEditorTextfieldValue(base::UTF8ToUTF16("+61 2 9374 4000"), + SetEditorTextfieldValue(u"+61 2 9374 4000", autofill::PHONE_HOME_WHOLE_NUMBER); ResetEventWaiterForSequence({DialogEvent::PROCESSING_SPINNER_SHOWN, @@ -720,8 +718,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_PaymentRequestShippingAddressEditorTest, // Set an Australian phone number in local format. This is an invalid // US number as there is no area code 029, but it can be considered and parsed // as a US number. - SetEditorTextfieldValue(base::UTF8ToUTF16("02 9374 4000"), - autofill::PHONE_HOME_WHOLE_NUMBER); + SetEditorTextfieldValue(u"02 9374 4000", autofill::PHONE_HOME_WHOLE_NUMBER); EXPECT_FALSE(IsEditorTextfieldInvalid(autofill::PHONE_HOME_WHOLE_NUMBER)); } @@ -736,8 +733,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_PaymentRequestShippingAddressEditorTest, SetCommonFields(); // Trying to set an impossible number, note it has 11 digits. - SetEditorTextfieldValue(base::UTF8ToUTF16("02 9374 40001"), - autofill::PHONE_HOME_WHOLE_NUMBER); + SetEditorTextfieldValue(u"02 9374 40001", autofill::PHONE_HOME_WHOLE_NUMBER); EXPECT_TRUE(IsEditorTextfieldInvalid(autofill::PHONE_HOME_WHOLE_NUMBER)); } @@ -816,8 +812,7 @@ IN_PROC_BROWSER_TEST_F( // Create a profile in the US and add a valid AU phone number in international // format. autofill::AutofillProfile california = autofill::test::GetFullProfile(); - california.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("+61 2 9374 4000")); + california.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, u"+61 2 9374 4000"); AddAutofillProfile(california); InvokePaymentRequestUI(); @@ -839,8 +834,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_PaymentRequestShippingAddressEditorTest, // Create a profile in the US and add a valid AU phone number in local format. autofill::AutofillProfile california = autofill::test::GetFullProfile(); california.set_use_count(50U); - california.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("02 9374 4000")); + california.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, u"02 9374 4000"); AddAutofillProfile(california); InvokePaymentRequestUI(); @@ -861,8 +855,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_PaymentRequestShippingAddressEditorTest, // Create a profile in the US and add a impossible number. autofill::AutofillProfile california = autofill::test::GetFullProfile(); california.set_use_count(50U); - california.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("02 9374 40001")); + california.SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, u"02 9374 40001"); AddAutofillProfile(california); InvokePaymentRequestUI(); @@ -1392,7 +1385,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_PaymentRequestShippingAddressEditorTest, NavigateTo("/payment_request_dynamic_shipping_test.html"); autofill::AutofillProfile address = autofill::test::GetFullProfile(); - address.SetRawInfo(autofill::ADDRESS_HOME_COUNTRY, base::UTF8ToUTF16("KR")); + address.SetRawInfo(autofill::ADDRESS_HOME_COUNTRY, u"KR"); AddAutofillProfile(address); InvokePaymentRequestUI(); diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc index 71cfeca8ffd206..c5a6f2b7d26d20 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc @@ -585,8 +585,7 @@ constexpr ProfileMenuViewBase::ActionableItem PROFILE_MENU_CLICK_TEST( kActionableItems_SingleProfileWithCustomName, DISABLED_ProfileMenuClickTest_SingleProfileWithCustomName) { - profiles::UpdateProfileName(browser()->profile(), - base::UTF8ToUTF16("Custom name")); + profiles::UpdateProfileName(browser()->profile(), u"Custom name"); RunTest(); } diff --git a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc index da86e90dcee61e..ff77c5355e5cf4 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc @@ -340,7 +340,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, ASSERT_NE(entry, nullptr); EXPECT_FALSE(entry->IsEphemeral()); EXPECT_FALSE(entry->IsAuthenticated()); - EXPECT_EQ(entry->GetLocalProfileName(), base::UTF8ToUTF16("Joe")); + EXPECT_EQ(entry->GetLocalProfileName(), u"Joe"); EXPECT_EQ(ThemeServiceFactory::GetForProfile(profile_being_created) ->GetAutogeneratedThemeColor(), @@ -389,7 +389,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, .GetProfileAttributesWithPath(profile_being_created->GetPath()); ASSERT_NE(entry, nullptr); EXPECT_FALSE(entry->IsEphemeral()); - EXPECT_EQ(entry->GetLocalProfileName(), base::UTF8ToUTF16("Joe")); + EXPECT_EQ(entry->GetLocalProfileName(), u"Joe"); EXPECT_EQ(ThemeServiceFactory::GetForProfile(profile_being_created) ->GetAutogeneratedThemeColor(), kProfileColor); @@ -436,7 +436,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, // difference between SYNC_WITH_DEFAULT_SETTINGS and CONFIGURE_SYNC_FIRST // cannot be told. EXPECT_TRUE(entry->IsAuthenticated()); - EXPECT_EQ(entry->GetLocalProfileName(), base::UTF8ToUTF16("Joe")); + EXPECT_EQ(entry->GetLocalProfileName(), u"Joe"); // The color is not applied if the user enters settings. EXPECT_FALSE(ThemeServiceFactory::GetForProfile(profile_being_created) ->UsingAutogeneratedTheme()); @@ -490,8 +490,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, storage.GetProfileAttributesWithPath(other_path); ASSERT_NE(other_entry, nullptr); // Fake sync is enabled in this profile with Joe's account. - other_entry->SetAuthInfo(std::string(), - base::UTF8ToUTF16("joe.consumer@gmail.com"), + other_entry->SetAuthInfo(std::string(), u"joe.consumer@gmail.com", /*is_consented_primary_account=*/true); Profile* profile_being_created = StartSigninFlow(); @@ -566,8 +565,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, storage.GetProfileAttributesWithPath(other_path); ASSERT_NE(other_entry, nullptr); // Fake sync is enabled in this profile with Joe's account. - other_entry->SetAuthInfo(std::string(), - base::UTF8ToUTF16("joe.consumer@gmail.com"), + other_entry->SetAuthInfo(std::string(), u"joe.consumer@gmail.com", /*is_consented_primary_account=*/true); Profile* profile_being_created = StartSigninFlow(); @@ -651,8 +649,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, EXPECT_FALSE(entry->IsAuthenticated()); // Since the given name is not provided, the email address is used instead as // a profile name. - EXPECT_EQ(entry->GetLocalProfileName(), - base::UTF8ToUTF16("joe.consumer@gmail.com")); + EXPECT_EQ(entry->GetLocalProfileName(), u"joe.consumer@gmail.com"); EXPECT_EQ(ThemeServiceFactory::GetForProfile(profile_being_created) ->GetAutogeneratedThemeColor(), kProfileColor); @@ -753,7 +750,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerEnterpriseCreationFlowBrowserTest, .GetProfileAttributesWithPath(profile_being_created->GetPath()); ASSERT_NE(entry, nullptr); EXPECT_FALSE(entry->IsEphemeral()); - EXPECT_EQ(entry->GetLocalProfileName(), base::UTF8ToUTF16("enterprise.com")); + EXPECT_EQ(entry->GetLocalProfileName(), u"enterprise.com"); // The color is not applied for enterprise users. EXPECT_FALSE(ThemeServiceFactory::GetForProfile(profile_being_created) @@ -820,7 +817,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerEnterpriseCreationFlowBrowserTest, .GetProfileAttributesWithPath(profile_being_created->GetPath()); ASSERT_NE(entry, nullptr); EXPECT_FALSE(entry->IsEphemeral()); - EXPECT_EQ(entry->GetLocalProfileName(), base::UTF8ToUTF16("enterprise.com")); + EXPECT_EQ(entry->GetLocalProfileName(), u"enterprise.com"); // The color is not applied for enterprise users. EXPECT_FALSE(ThemeServiceFactory::GetForProfile(profile_being_created) @@ -876,7 +873,7 @@ IN_PROC_BROWSER_TEST_F(ProfilePickerEnterpriseCreationFlowBrowserTest, .GetProfileAttributesWithPath(profile_being_created->GetPath()); ASSERT_NE(entry, nullptr); EXPECT_FALSE(entry->IsEphemeral()); - EXPECT_EQ(entry->GetLocalProfileName(), base::UTF8ToUTF16("enterprise.com")); + EXPECT_EQ(entry->GetLocalProfileName(), u"enterprise.com"); // The color is not applied if the user enters settings. EXPECT_FALSE(ThemeServiceFactory::GetForProfile(profile_being_created) ->UsingAutogeneratedTheme()); @@ -1006,7 +1003,7 @@ IN_PROC_BROWSER_TEST_P(ProfilePickerCreationFlowEphemeralProfileBrowserTest, WaitForPickerClosed(); EXPECT_EQ(2u, profile_manager()->GetNumberOfProfiles()); - EXPECT_EQ(entry->GetLocalProfileName(), base::UTF8ToUTF16("Joe")); + EXPECT_EQ(entry->GetLocalProfileName(), u"Joe"); // The profile is no longer ephemeral, unless the policy is enabled. EXPECT_EQ(entry->IsEphemeral(), AreEphemeralProfilesForced()); EXPECT_FALSE(entry->IsOmitted()); diff --git a/chrome/browser/ui/views/sharing/sharing_dialog_view_unittest.cc b/chrome/browser/ui/views/sharing/sharing_dialog_view_unittest.cc index 44ac29285dc7d8..dec4a02f453901 100644 --- a/chrome/browser/ui/views/sharing/sharing_dialog_view_unittest.cc +++ b/chrome/browser/ui/views/sharing/sharing_dialog_view_unittest.cc @@ -148,8 +148,8 @@ TEST_F(SharingDialogViewTest, DevicePressed) { } TEST_F(SharingDialogViewTest, AppPressed) { - SharingApp app(&vector_icons::kOpenInNewIcon, gfx::Image(), - base::UTF8ToUTF16("app0"), std::string()); + SharingApp app(&vector_icons::kOpenInNewIcon, gfx::Image(), u"app0", + std::string()); EXPECT_CALL(app_callback_, Call(AppEquals(&app))); auto dialog_data = CreateDialogData(/*devices=*/3, /*apps=*/2); diff --git a/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view_browsertest.cc b/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view_browsertest.cc index 23c9325ef6b9d4..7324ed0f6e65cd 100644 --- a/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/supervised_user/parent_permission_dialog_view_browsertest.cc @@ -92,8 +92,8 @@ class ParentPermissionDialogViewTest parent_permission_dialog_ = ParentPermissionDialog::CreateParentPermissionDialog( browser()->profile(), contents->GetTopLevelNativeWindow(), - gfx::ImageSkia::CreateFrom1xBitmap(icon), - base::UTF8ToUTF16("Test prompt message"), base::DoNothing()); + gfx::ImageSkia::CreateFrom1xBitmap(icon), u"Test prompt message", + base::DoNothing()); } else if (name == "extension") { parent_permission_dialog_ = ParentPermissionDialog::CreateParentPermissionDialogForExtension( @@ -186,8 +186,8 @@ class ParentPermissionDialogViewTest parent_permission_dialog_ = ParentPermissionDialog::CreateParentPermissionDialog( browser()->profile(), contents->GetTopLevelNativeWindow(), - gfx::ImageSkia::CreateFrom1xBitmap(icon), - base::UTF8ToUTF16("Test prompt message"), std::move(callback)); + gfx::ImageSkia::CreateFrom1xBitmap(icon), u"Test prompt message", + std::move(callback)); parent_permission_dialog_->ShowDialog(); run_loop.Run(); } diff --git a/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc b/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc index 533500b56da835..8a8bfa89916723 100644 --- a/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc +++ b/chrome/browser/ui/views/tab_sharing/tab_sharing_ui_views_browsertest.cc @@ -75,9 +75,8 @@ class TabSharingUIViewsBrowserTest : public InProcessBrowserTest { // Explicitly activate the shared tab in testing. ActivateTab(browser, tab); - tab_sharing_ui_ = - TabSharingUI::Create(GetDesktopMediaID(browser, tab), - base::UTF8ToUTF16("example-sharing.com")); + tab_sharing_ui_ = TabSharingUI::Create(GetDesktopMediaID(browser, tab), + u"example-sharing.com"); tab_sharing_ui_->OnStarted( base::OnceClosure(), base::BindRepeating(&TabSharingUIViewsBrowserTest::OnStartSharing, @@ -296,9 +295,8 @@ class MultipleTabSharingUIViewsBrowserTest : public InProcessBrowserTest { for (int i = 0; i < tab_count; ++i) { int tab = tab_index + i; ActivateTab(browser, tab); - tab_sharing_ui_views_.push_back( - TabSharingUI::Create(GetDesktopMediaID(browser, tab), - base::UTF8ToUTF16("example-sharing.com"))); + tab_sharing_ui_views_.push_back(TabSharingUI::Create( + GetDesktopMediaID(browser, tab), u"example-sharing.com")); tab_sharing_ui_views_[tab_sharing_ui_views_.size() - 1]->OnStarted( base::OnceClosure(), content::MediaStreamUI::SourceCallback()); } diff --git a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view_browsertest.cc b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view_browsertest.cc index 0953c8a7b7490f..3d28b1a34fefc1 100644 --- a/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/tabs/tab_hover_card_bubble_view_browsertest.cc @@ -208,7 +208,7 @@ IN_PROC_BROWSER_TEST_F(TabHoverCardBubbleViewBrowserTest, IN_PROC_BROWSER_TEST_F(TabHoverCardBubbleViewBrowserTest, MAYBE_WidgetVisibleOnTabFocusFromKeyboardAccelerator) { TabRendererData new_tab_data = TabRendererData(); - new_tab_data.title = base::UTF8ToUTF16("Test Tab 2"); + new_tab_data.title = u"Test Tab 2"; new_tab_data.last_committed_url = GURL("http://example.com/this/should/not/be/seen"); tab_strip()->AddTabAt(1, new_tab_data, false); @@ -257,7 +257,7 @@ IN_PROC_BROWSER_TEST_F(TabHoverCardBubbleViewBrowserTest, IN_PROC_BROWSER_TEST_F(TabHoverCardBubbleViewBrowserTest, MAYBE_WidgetDataUpdate) { TabRendererData new_tab_data = TabRendererData(); - new_tab_data.title = base::UTF8ToUTF16("Test Tab 2"); + new_tab_data.title = u"Test Tab 2"; new_tab_data.last_committed_url = GURL("http://example.com/this/should/not/be/seen"); tab_strip()->AddTabAt(1, new_tab_data, false); diff --git a/chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view_browsertest.cc b/chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view_browsertest.cc index 2bd2829cf90942..76e22cf6a9cc9d 100644 --- a/chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view_browsertest.cc @@ -34,7 +34,7 @@ class PWAConfirmationBubbleViewBrowserTest : public InProcessBrowserTest { std::unique_ptr GetAppInfo() { auto app_info = std::make_unique(); - app_info->title = base::UTF8ToUTF16("Test app 2"); + app_info->title = u"Test app 2"; app_info->start_url = GURL("https://example2.com"); app_info->open_as_window = true; return app_info; @@ -47,7 +47,7 @@ class PWAConfirmationBubbleViewBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(PWAConfirmationBubbleViewBrowserTest, ShowBubbleInPWAWindow) { auto app_info = std::make_unique(); - app_info->title = base::UTF8ToUTF16("Test app"); + app_info->title = u"Test app"; app_info->start_url = GURL("https://example.com"); Profile* profile = browser()->profile(); web_app::AppId app_id = web_app::InstallWebApp(profile, std::move(app_info)); @@ -62,7 +62,7 @@ IN_PROC_BROWSER_TEST_F(PWAConfirmationBubbleViewBrowserTest, // Tests that we don't crash when attempting to show bubble when it's already // shown. app_info = std::make_unique(); - app_info->title = base::UTF8ToUTF16("Test app 3"); + app_info->title = u"Test app 3"; app_info->start_url = GURL("https://example3.com"); app_info->open_as_window = true; chrome::ShowPWAInstallBubble( diff --git a/chrome/browser/ui/views/web_apps/web_app_confirmation_view_browsertest.cc b/chrome/browser/ui/views/web_apps/web_app_confirmation_view_browsertest.cc index fc79b2a12cc0e0..1e1bbcbd22a772 100644 --- a/chrome/browser/ui/views/web_apps/web_app_confirmation_view_browsertest.cc +++ b/chrome/browser/ui/views/web_apps/web_app_confirmation_view_browsertest.cc @@ -14,7 +14,7 @@ using WebAppConfirmViewBrowserTest = InProcessBrowserTest; IN_PROC_BROWSER_TEST_F(WebAppConfirmViewBrowserTest, ShowWebAppInstallDialog) { auto app_info = std::make_unique(); - app_info->title = base::UTF8ToUTF16("Test app"); + app_info->title = u"Test app"; app_info->start_url = GURL("https://example.com"); chrome::SetAutoAcceptWebAppDialogForTesting(/*auto_accept=*/true, diff --git a/chrome/browser/ui/views/webauthn/webauthn_icon_view.cc b/chrome/browser/ui/views/webauthn/webauthn_icon_view.cc index 7e684cb55176ea..84fff0474ab803 100644 --- a/chrome/browser/ui/views/webauthn/webauthn_icon_view.cc +++ b/chrome/browser/ui/views/webauthn/webauthn_icon_view.cc @@ -97,7 +97,7 @@ const gfx::VectorIcon& WebAuthnIconView::GetVectorIcon() const { std::u16string WebAuthnIconView::GetTextForTooltipAndAccessibleName() const { // TODO(crbug.com/1179014): go through ux review and i18n this string. - return base::UTF8ToUTF16("Sign in with your security key"); + return u"Sign in with your security key"; } void WebAuthnIconView::OnWidgetDestroying(views::Widget* widget) { diff --git a/chrome/browser/ui/web_applications/test/web_app_navigation_browsertest.cc b/chrome/browser/ui/web_applications/test/web_app_navigation_browsertest.cc index 9b292453607dc4..6e0ddeef1b24b4 100644 --- a/chrome/browser/ui/web_applications/test/web_app_navigation_browsertest.cc +++ b/chrome/browser/ui/web_applications/test/web_app_navigation_browsertest.cc @@ -228,7 +228,7 @@ AppId WebAppNavigationBrowserTest::InstallTestWebApp( web_app_info->start_url = https_server_.GetURL(app_host, GetAppUrlPath()); web_app_info->scope = https_server_.GetURL(app_host, app_scope); web_app_info->title = base::UTF8ToUTF16(GetAppName()); - web_app_info->description = base::UTF8ToUTF16("Test description"); + web_app_info->description = u"Test description"; web_app_info->open_as_window = true; return InstallWebApp(profile(), std::move(web_app_info)); diff --git a/chrome/browser/ui/web_applications/web_app_browsertest.cc b/chrome/browser/ui/web_applications/web_app_browsertest.cc index 67702fcb08a6f8..94b910e8e74ab5 100644 --- a/chrome/browser/ui/web_applications/web_app_browsertest.cc +++ b/chrome/browser/ui/web_applications/web_app_browsertest.cc @@ -1119,8 +1119,7 @@ IN_PROC_BROWSER_TEST_F(WebAppBrowserTest_AppNameInsteadOfOrigin, const AppId app_id = InstallPWA(app_url); Browser* const app_browser = LaunchWebAppBrowserAndWait(app_id); EXPECT_TRUE(app_browser->app_controller()->HasTitlebarAppOriginText()); - EXPECT_EQ(app_browser->app_controller()->GetLaunchFlashText(), - base::UTF8ToUTF16("A Web App")); + EXPECT_EQ(app_browser->app_controller()->GetLaunchFlashText(), u"A Web App"); } // Check that a subframe on a regular web page can navigate to a URL that diff --git a/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc index 7edd9ccf4a1248..fe798b55c8f3ad 100644 --- a/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.cc @@ -47,7 +47,7 @@ void DemoSetupScreenHandler::OnSetupFailed( CallJS("login.DemoSetupScreen.onSetupFailed", base::JoinString({error.GetLocalizedErrorMessage(), error.GetLocalizedRecoveryMessage()}, - base::UTF8ToUTF16(" ")), + u" "), error.recovery_method() == DemoSetupController::DemoSetupError::RecoveryMethod::kPowerwash); } diff --git a/chrome/browser/ui/webui/help/version_updater_mac.mm b/chrome/browser/ui/webui/help/version_updater_mac.mm index 851728cc7373da..ba104fb06a4506 100644 --- a/chrome/browser/ui/webui/help/version_updater_mac.mm +++ b/chrome/browser/ui/webui/help/version_updater_mac.mm @@ -288,13 +288,13 @@ void UpdateStatusFromChromiumUpdater( if (status == FAILED) { if (!message.empty()) { - message += base::UTF8ToUTF16("

"); + message += u"

"; } message += l10n_util::GetStringUTF16(IDS_UPGRADE_ERROR_DETAILS); - message += base::UTF8ToUTF16("
");
+      message += u"
";
       message += base::UTF8ToUTF16(net::EscapeForHTML(error_messages));
-      message += base::UTF8ToUTF16("
"); + message += u"
"; } } diff --git a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc index 8aa3181da5ca82..8b1b2b7310688e 100644 --- a/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc +++ b/chrome/browser/ui/webui/management/management_ui_handler_unittest.cc @@ -251,7 +251,7 @@ class ManagementUIHandlerTests : public TestingBaseClass { ManagementUIHandlerTests() : TestingBaseClass(), handler_(&policy_service_), - device_domain_(base::UTF8ToUTF16("devicedomain.com")), + device_domain_(u"devicedomain.com"), task_runner_(base::MakeRefCounted()), state_keys_broker_(&session_manager_client_) { ON_CALL(policy_service_, GetPolicies(_)) diff --git a/chrome/browser/ui/webui/memories/memories_ui.cc b/chrome/browser/ui/webui/memories/memories_ui.cc index 9879cf207b79d3..d46c156f6903ab 100644 --- a/chrome/browser/ui/webui/memories/memories_ui.cc +++ b/chrome/browser/ui/webui/memories/memories_ui.cc @@ -34,9 +34,8 @@ content::WebUIDataSource* CreateAndSetupWebUIDataSource(Profile* profile) { // TODO(crbug.com/1173908): Replace these with localized strings. source->AddString("memoryTitleDescription", - base::UTF8ToUTF16("Based on previous web activity")); - source->AddString("topVisitsSectionHeader", - base::UTF8ToUTF16("From Chrome History")); + u"Based on previous web activity"); + source->AddString("topVisitsSectionHeader", u"From Chrome History"); webui::SetupWebUIDataSource( source, base::make_span(kMemoriesResources, kMemoriesResourcesSize), diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc index e44c5cfe25806a..08e8e4becb9f65 100644 --- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc +++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc @@ -242,14 +242,14 @@ content::WebUIDataSource* CreateNewTabPageUiHtmlSource( }; source->AddLocalizedStrings(kStrings); - source->AddString("modulesTasksInfo1", - l10n_util::GetStringFUTF16( - IDS_NTP_MODULES_SHOPPING_TASKS_INFO_1, - base::UTF8ToUTF16("https://myactivity.google.com/"))); - source->AddString("modulesTasksInfo2", - l10n_util::GetStringFUTF16( - IDS_NTP_MODULES_SHOPPING_TASKS_INFO_2, - base::UTF8ToUTF16("https://policies.google.com/"))); + source->AddString( + "modulesTasksInfo1", + l10n_util::GetStringFUTF16(IDS_NTP_MODULES_SHOPPING_TASKS_INFO_1, + u"https://myactivity.google.com/")); + source->AddString( + "modulesTasksInfo2", + l10n_util::GetStringFUTF16(IDS_NTP_MODULES_SHOPPING_TASKS_INFO_2, + u"https://policies.google.com/")); // Register images that are purposefully not inlined in the HTML and instead // are set in Javascript. diff --git a/chrome/browser/ui/webui/settings/safety_check_handler.cc b/chrome/browser/ui/webui/settings/safety_check_handler.cc index b87fd1d316c247..3a44f2f6b9beef 100644 --- a/chrome/browser/ui/webui/settings/safety_check_handler.cc +++ b/chrome/browser/ui/webui/settings/safety_check_handler.cc @@ -569,7 +569,7 @@ std::u16string SafetyCheckHandler::GetStringForParent(ParentStatus status) { std::u16string SafetyCheckHandler::GetStringForUpdates(UpdateStatus status) { switch (status) { case UpdateStatus::kChecking: - return base::UTF8ToUTF16(""); + return u""; case UpdateStatus::kUpdated: #if BUILDFLAG(IS_CHROMEOS_ASH) return ui::SubstituteChromeOSDeviceType(IDS_SETTINGS_UPGRADE_UP_TO_DATE); @@ -605,7 +605,7 @@ std::u16string SafetyCheckHandler::GetStringForUpdates(UpdateStatus status) { // This state is only used on Android for recording metrics. This codepath // is unreachable. case UpdateStatus::kOutdated: - return base::UTF8ToUTF16(""); + return u""; } } @@ -613,7 +613,7 @@ std::u16string SafetyCheckHandler::GetStringForSafeBrowsing( SafeBrowsingStatus status) { switch (status) { case SafeBrowsingStatus::kChecking: - return base::UTF8ToUTF16(""); + return u""; case SafeBrowsingStatus::kEnabled: case SafeBrowsingStatus::kEnabledStandard: return l10n_util::GetStringUTF16( @@ -647,7 +647,7 @@ std::u16string SafetyCheckHandler::GetStringForPasswords( case PasswordsStatus::kChecking: { // Unable to get progress for some reason. if (total.value() == 0) { - return base::UTF8ToUTF16(""); + return u""; } return l10n_util::GetStringFUTF16(IDS_SETTINGS_CHECK_PASSWORDS_PROGRESS, base::FormatNumber(done.value()), @@ -709,7 +709,7 @@ std::u16string SafetyCheckHandler::GetStringForExtensions( ReenabledAdmin reenabled_admin) { switch (status) { case ExtensionsStatus::kChecking: - return base::UTF8ToUTF16(""); + return u""; case ExtensionsStatus::kError: return l10n_util::GetStringUTF16( IDS_SETTINGS_SAFETY_CHECK_EXTENSIONS_ERROR); @@ -748,7 +748,7 @@ std::u16string SafetyCheckHandler::GetStringForChromeCleaner( switch (status) { case ChromeCleanerStatus::kHidden: case ChromeCleanerStatus::kChecking: - return base::UTF8ToUTF16(""); + return u""; case ChromeCleanerStatus::kInfected: return l10n_util::GetStringUTF16( IDS_SETTINGS_SAFETY_CHECK_CHROME_CLEANER_INFECTED); diff --git a/chrome/browser/ui/webui/settings/safety_check_handler_unittest.cc b/chrome/browser/ui/webui/settings/safety_check_handler_unittest.cc index 4089c3e0c705cd..6f093580946773 100644 --- a/chrome/browser/ui/webui/settings/safety_check_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/safety_check_handler_unittest.cc @@ -431,7 +431,7 @@ TEST_F(SafetyCheckHandlerTest, CheckUpdates_Checking) { kUpdates, static_cast(SafetyCheckHandler::UpdateStatus::kChecking)); ASSERT_TRUE(event); - VerifyDisplayString(event, base::UTF8ToUTF16("")); + VerifyDisplayString(event, u""); // Checking state should not get recorded. histogram_tester_.ExpectTotalCount("Settings.SafetyCheck.UpdatesResult", 0); } @@ -773,7 +773,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_ObserverRemovedAfterError) { kPasswords, static_cast(SafetyCheckHandler::PasswordsStatus::kChecking)); ASSERT_TRUE(event); - VerifyDisplayString(event, base::UTF8ToUTF16("")); + VerifyDisplayString(event, u""); histogram_tester_.ExpectTotalCount("Settings.SafetyCheck.PasswordsResult", 0); // Second, an "offline" state. test_leak_service_->set_state_and_notify( @@ -813,7 +813,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_InterruptedAndRefreshed) { kPasswords, static_cast(SafetyCheckHandler::PasswordsStatus::kChecking)); ASSERT_TRUE(event); - VerifyDisplayString(event, base::UTF8ToUTF16("")); + VerifyDisplayString(event, u""); // The check gets interrupted and the page is refreshed. safety_check_->DisallowJavascript(); safety_check_->AllowJavascript(); @@ -1196,8 +1196,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_NoPasswords) { } TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) { - auto credential = password_manager::LeakCheckCredential( - base::UTF8ToUTF16("test"), base::UTF8ToUTF16("test")); + auto credential = password_manager::LeakCheckCredential(u"test", u"test"); auto is_leaked = password_manager::IsLeaked(false); safety_check_->PerformSafetyCheck(); test_passwords_delegate_.SetPasswordCheckState( @@ -1211,7 +1210,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) { kPasswords, static_cast(SafetyCheckHandler::PasswordsStatus::kChecking)); EXPECT_TRUE(event); - VerifyDisplayString(event, base::UTF8ToUTF16("Checking passwords (1 of 3)…")); + VerifyDisplayString(event, u"Checking passwords (1 of 3)…"); test_passwords_delegate_.SetProgress(2, 3); static_cast( @@ -1222,8 +1221,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) { kPasswords, static_cast(SafetyCheckHandler::PasswordsStatus::kChecking)); EXPECT_TRUE(event2); - VerifyDisplayString(event2, - base::UTF8ToUTF16("Checking passwords (2 of 3)…")); + VerifyDisplayString(event2, u"Checking passwords (2 of 3)…"); // Final update comes after status change, so no new progress message should // be present. @@ -1239,8 +1237,7 @@ TEST_F(SafetyCheckHandlerTest, CheckPasswords_Progress) { static_cast(SafetyCheckHandler::PasswordsStatus::kChecking)); EXPECT_TRUE(event3); // Still 2/3 event. - VerifyDisplayString(event3, - base::UTF8ToUTF16("Checking passwords (2 of 3)…")); + VerifyDisplayString(event3, u"Checking passwords (2 of 3)…"); } TEST_F(SafetyCheckHandlerTest, CheckExtensions_NoExtensions) { @@ -1496,7 +1493,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(std::make_tuple( safe_browsing::ChromeCleanerController::IdleReason::kReporterFailed, SafetyCheckHandler::ChromeCleanerStatus::kError, - base::UTF8ToUTF16("Something went wrong. Click for more details.")))); + u"Something went wrong. Click for more details."))); INSTANTIATE_TEST_SUITE_P( CheckChromeCleaner_ScanningFoundNothing, @@ -1514,7 +1511,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(std::make_tuple( safe_browsing::ChromeCleanerController::IdleReason::kScanningFailed, SafetyCheckHandler::ChromeCleanerStatus::kError, - base::UTF8ToUTF16("Something went wrong. Click for more details.")))); + u"Something went wrong. Click for more details."))); INSTANTIATE_TEST_SUITE_P( CheckChromeCleaner_ConnectionLost, @@ -1522,16 +1519,16 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(std::make_tuple( safe_browsing::ChromeCleanerController::IdleReason::kConnectionLost, SafetyCheckHandler::ChromeCleanerStatus::kInfected, - base::UTF8ToUTF16("Browser found harmful software on your computer")))); + u"Browser found harmful software on your computer"))); INSTANTIATE_TEST_SUITE_P( CheckChromeCleaner_UserDeclinedCleanup, SafetyCheckHandlerChromeCleanerIdleTest, - ::testing::Values(std::make_tuple( - safe_browsing::ChromeCleanerController::IdleReason:: - kUserDeclinedCleanup, - SafetyCheckHandler::ChromeCleanerStatus::kInfected, - base::UTF8ToUTF16("Browser found harmful software on your computer")))); + ::testing::Values( + std::make_tuple(safe_browsing::ChromeCleanerController::IdleReason:: + kUserDeclinedCleanup, + SafetyCheckHandler::ChromeCleanerStatus::kInfected, + u"Browser found harmful software on your computer"))); INSTANTIATE_TEST_SUITE_P( CheckChromeCleaner_CleaningFailed, @@ -1539,7 +1536,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(std::make_tuple( safe_browsing::ChromeCleanerController::IdleReason::kCleaningFailed, SafetyCheckHandler::ChromeCleanerStatus::kError, - base::UTF8ToUTF16("Something went wrong. Click for more details.")))); + u"Something went wrong. Click for more details."))); INSTANTIATE_TEST_SUITE_P( CheckChromeCleaner_CleaningSucceed, @@ -1553,11 +1550,11 @@ INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P( CheckChromeCleaner_CleanerDownloadFailed, SafetyCheckHandlerChromeCleanerIdleTest, - ::testing::Values(std::make_tuple( - safe_browsing::ChromeCleanerController::IdleReason:: - kCleanerDownloadFailed, - SafetyCheckHandler::ChromeCleanerStatus::kError, - base::UTF8ToUTF16("Something went wrong. Click for more details.")))); + ::testing::Values( + std::make_tuple(safe_browsing::ChromeCleanerController::IdleReason:: + kCleanerDownloadFailed, + SafetyCheckHandler::ChromeCleanerStatus::kError, + u"Something went wrong. Click for more details."))); class SafetyCheckHandlerChromeCleanerNonIdleTest : public SafetyCheckHandlerTest, @@ -1636,7 +1633,7 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(std::make_tuple( safe_browsing::ChromeCleanerController::State::kInfected, SafetyCheckHandler::ChromeCleanerStatus::kInfected, - base::UTF8ToUTF16("Browser found harmful software on your computer")))); + u"Browser found harmful software on your computer"))); INSTANTIATE_TEST_SUITE_P( CheckChromeCleaner_RebootRequired, @@ -1790,31 +1787,31 @@ TEST_F(SafetyCheckHandlerTest, CheckSafetyCheckStartedWebUiEvents) { kParent, static_cast(SafetyCheckHandler::ParentStatus::kChecking)); ASSERT_TRUE(event_parent); - VerifyDisplayString(event_parent, base::UTF8ToUTF16("Running…")); + VerifyDisplayString(event_parent, u"Running…"); const base::DictionaryValue* event_updates = GetSafetyCheckStatusChangedWithDataIfExists( kUpdates, static_cast(SafetyCheckHandler::UpdateStatus::kChecking)); ASSERT_TRUE(event_updates); - VerifyDisplayString(event_updates, base::UTF8ToUTF16("")); + VerifyDisplayString(event_updates, u""); const base::DictionaryValue* event_pws = GetSafetyCheckStatusChangedWithDataIfExists( kPasswords, static_cast(SafetyCheckHandler::PasswordsStatus::kChecking)); ASSERT_TRUE(event_pws); - VerifyDisplayString(event_pws, base::UTF8ToUTF16("")); + VerifyDisplayString(event_pws, u""); const base::DictionaryValue* event_sb = GetSafetyCheckStatusChangedWithDataIfExists( kSafeBrowsing, static_cast(SafetyCheckHandler::SafeBrowsingStatus::kChecking)); ASSERT_TRUE(event_sb); - VerifyDisplayString(event_sb, base::UTF8ToUTF16("")); + VerifyDisplayString(event_sb, u""); const base::DictionaryValue* event_extensions = GetSafetyCheckStatusChangedWithDataIfExists( kExtensions, static_cast(SafetyCheckHandler::ExtensionsStatus::kChecking)); ASSERT_TRUE(event_extensions); - VerifyDisplayString(event_extensions, base::UTF8ToUTF16("")); + VerifyDisplayString(event_extensions, u""); } TEST_F(SafetyCheckHandlerTest, CheckSafetyCheckCompletedWebUiEvents) { @@ -1837,8 +1834,7 @@ TEST_F(SafetyCheckHandlerTest, CheckSafetyCheckCompletedWebUiEvents) { GetSafetyCheckStatusChangedWithDataIfExists( kParent, static_cast(SafetyCheckHandler::ParentStatus::kAfter)); ASSERT_TRUE(event_parent); - VerifyDisplayString(event_parent, - base::UTF8ToUTF16("Safety check ran a moment ago")); + VerifyDisplayString(event_parent, u"Safety check ran a moment ago"); #if defined(OS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING) // Subsequent Chrome cleaner status updates without the user running safety diff --git a/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc b/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc index 13f0a741dde152..061263c6783fd5 100644 --- a/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/settings_manage_profile_handler_unittest.cc @@ -55,7 +55,7 @@ class ManageProfileHandlerTest : public testing::Test { void SetSignedInProfile() { gfx::Image gaia_image(gfx::test::CreateImage(256, 256)); - entry()->SetAuthInfo("gaia_id", base::UTF8ToUTF16("user@gmail.com"), false); + entry()->SetAuthInfo("gaia_id", u"user@gmail.com", false); entry()->SetGAIAPicture("GAIA_IMAGE_URL_WITH_SIZE", gaia_image); EXPECT_TRUE(entry()->IsUsingDefaultAvatar()); EXPECT_TRUE(entry()->IsUsingGAIAPicture()); diff --git a/chrome/browser/ui/webui/signin/profile_picker_handler_unittest.cc b/chrome/browser/ui/webui/signin/profile_picker_handler_unittest.cc index 86ed0d24b64686..57a1e33f805311 100644 --- a/chrome/browser/ui/webui/signin/profile_picker_handler_unittest.cc +++ b/chrome/browser/ui/webui/signin/profile_picker_handler_unittest.cc @@ -136,7 +136,7 @@ TEST_F(ProfilePickerHandlerTest, RenameProfile) { web_ui()->ClearTrackedCalls(); // The profile list doesn't get re-ordered after a rename. - profile_b->SetLocalProfileName(base::UTF8ToUTF16("X"), false); + profile_b->SetLocalProfileName(u"X", false); VerifyProfileListWasPushed({profile_a, profile_b, profile_c, profile_d}); web_ui()->ClearTrackedCalls(); } diff --git a/chrome/browser/ui/webui/welcome/ntp_background_handler.cc b/chrome/browser/ui/webui/welcome/ntp_background_handler.cc index b970bec874049b..3d90928a40fd52 100644 --- a/chrome/browser/ui/webui/welcome/ntp_background_handler.cc +++ b/chrome/browser/ui/webui/welcome/ntp_background_handler.cc @@ -136,7 +136,7 @@ void NtpBackgroundHandler::HandleSetBackground(const base::ListValue* args) { instant_service->SetCustomBackgroundInfo( NtpBackgrounds[backgroundIndex], l10n_util::GetStringFUTF8(IDS_WELCOME_NTP_BACKGROUND_PHOTO_BY_LABEL, - base::UTF8ToUTF16("Ev Tchebotarev")), + u"Ev Tchebotarev"), "", GURL("https://500px.com/photo/135751035/" "soulseek-by-%E5%B0%A4%E9%87%91%E5%B0%BC-ev-tchebotarev"), @@ -146,7 +146,7 @@ void NtpBackgroundHandler::HandleSetBackground(const base::ListValue* args) { instant_service->SetCustomBackgroundInfo( NtpBackgrounds[backgroundIndex], l10n_util::GetStringFUTF8(IDS_WELCOME_NTP_BACKGROUND_PHOTO_BY_LABEL, - base::UTF8ToUTF16("NASA Image Library")), + u"NASA Image Library"), "", GURL("https://www.google.com/sky/"), ""); break; case static_cast(NtpBackgrounds::kGeometricShapes): @@ -159,7 +159,7 @@ void NtpBackgroundHandler::HandleSetBackground(const base::ListValue* args) { instant_service->SetCustomBackgroundInfo( NtpBackgrounds[backgroundIndex], l10n_util::GetStringFUTF8(IDS_WELCOME_NTP_BACKGROUND_PHOTO_BY_LABEL, - base::UTF8ToUTF16("Giulio Rosso Chioso")), + u"Giulio Rosso Chioso"), "", GURL("https://500px.com/photo/41149196/" "le-piscine-sunset-by-giulio-rosso-chioso"), diff --git a/chrome/browser/vr/elements/content_element_unittest.cc b/chrome/browser/vr/elements/content_element_unittest.cc index 4e16ac6e4d6c6f..bed57e30482b15 100644 --- a/chrome/browser/vr/elements/content_element_unittest.cc +++ b/chrome/browser/vr/elements/content_element_unittest.cc @@ -260,7 +260,7 @@ TEST_F(ContentElementInputEditingTest, IndicesUpdated) { // given callback is triggered right away. SetInput(GetInputInfo("asdf", 4, 4), GetInputInfo("", 0, 0)); TextInputInfo model_actual; - TextInputInfo model_exp(base::UTF8ToUTF16("asdf")); + TextInputInfo model_exp(u"asdf"); content_delegate_->OnWebInputIndicesChanged( 4, 4, -1, -1, base::BindOnce([](TextInputInfo* model, @@ -278,7 +278,7 @@ TEST_F(ContentElementInputEditingTest, IndicesUpdated) { const TextInputInfo& info) { *model = info; }, base::Unretained(&model_actual))); EXPECT_TRUE(input_forwarder_->text_state_requested()); - input_forwarder_->report_text_state(base::UTF8ToUTF16("asdf")); + input_forwarder_->report_text_state(u"asdf"); model_exp.selection_start = 2; model_exp.selection_end = 2; EXPECT_EQ(model_actual, model_exp); diff --git a/chrome/browser/vr/elements/text_input_unittest.cc b/chrome/browser/vr/elements/text_input_unittest.cc index 5ee4c1c65013d3..d09aa9325e2c1b 100644 --- a/chrome/browser/vr/elements/text_input_unittest.cc +++ b/chrome/browser/vr/elements/text_input_unittest.cc @@ -191,7 +191,7 @@ TEST(TextInputTest, HintText) { EXPECT_GT(element->get_hint_element()->GetTargetOpacity(), 0); // When text enters the field, the hint should disappear. - EditedText info(base::UTF8ToUTF16("text")); + EditedText info(u"text"); element->UpdateInput(info); scene.OnBeginFrame(base::TimeTicks(), kStartHeadPose); EXPECT_EQ(element->get_hint_element()->GetTargetOpacity(), 0); @@ -229,7 +229,7 @@ TEST(TextInputTest, CursorBlinking) { EXPECT_TRUE(toggled); // With a selection, the cursor should not be blinking or visible. - EditedText info(base::UTF8ToUTF16("text")); + EditedText info(u"text"); info.current.selection_start = 0; info.current.selection_end = info.current.text.size(); element->UpdateInput(info); @@ -252,7 +252,7 @@ TEST(TextInputTest, CursorPositionUpdatesOnKeyboardInput) { element->set_event_handlers(event_handlers); element->SetSize(1, 0); - EditedText info(base::UTF8ToUTF16("text")); + EditedText info(u"text"); info.current.selection_start = 0; info.current.selection_end = 0; element->UpdateInput(info); @@ -276,7 +276,7 @@ TEST(TextInputTest, CursorPositionUpdatesOnClicks) { element->set_event_handlers(event_handlers); element->SetSize(1, 0); - EditedText info(base::UTF8ToUTF16("text")); + EditedText info(u"text"); element->UpdateInput(info); element->get_text_element()->PrepareToDrawForTest(); @@ -311,8 +311,7 @@ TEST(TextInputTest, TextSelectionUpdatesOnTouchMove) { element->SetSize(1.0, 0); EditedText info(TextInputInfo( - base::UTF8ToUTF16("this is a long text with the cursor at the beginning"), - 0, 0)); + u"this is a long text with the cursor at the beginning", 0, 0)); element->UpdateInput(info); element->get_text_element()->PrepareToDrawForTest(); EXPECT_EQ(element->edited_text().current.SelectionSize(), 0u); diff --git a/chrome/browser/vr/model/text_input_info.cc b/chrome/browser/vr/model/text_input_info.cc index 74dd5409e76003..433fbb92a58b29 100644 --- a/chrome/browser/vr/model/text_input_info.cc +++ b/chrome/browser/vr/model/text_input_info.cc @@ -26,7 +26,7 @@ size_t CommonPrefixLength(const std::u16string a, const std::u16string b) { } // namespace TextInputInfo::TextInputInfo() - : TextInputInfo(base::UTF8ToUTF16(""), + : TextInputInfo(u"", 0, 0, kDefaultCompositionIndex, @@ -93,7 +93,7 @@ std::u16string TextInputInfo::CommittedTextBeforeCursor() const { std::u16string TextInputInfo::ComposingText() const { if (composition_start == composition_end) - return base::UTF8ToUTF16(""); + return u""; return text.substr(composition_start, CompositionSize()); } @@ -175,8 +175,8 @@ TextEdits EditedText::GetDiff() const { previous.CommittedTextBeforeCursor().size() - common_prefix_length; if (to_delete > 0) { DCHECK(!had_composition); - edits.push_back(TextEditAction(TextEditActionType::DELETE_TEXT, - base::UTF8ToUTF16(""), -to_delete)); + edits.push_back( + TextEditAction(TextEditActionType::DELETE_TEXT, u"", -to_delete)); } } diff --git a/chrome/browser/vr/model/text_input_info_unittest.cc b/chrome/browser/vr/model/text_input_info_unittest.cc index d1222fa85de103..402dcd11f65c6f 100644 --- a/chrome/browser/vr/model/text_input_info_unittest.cc +++ b/chrome/browser/vr/model/text_input_info_unittest.cc @@ -31,13 +31,13 @@ class TextInputInfoTest : public testing::Test { TEST(TextInputInfo, Clamping) { // Out of bounds indices. - auto info = TextInputInfo(base::UTF8ToUTF16("hi"), 4, 4, 4, 4); - auto info_expected = TextInputInfo(base::UTF8ToUTF16("hi"), 2, 2, -1, -1); + auto info = TextInputInfo(u"hi", 4, 4, 4, 4); + auto info_expected = TextInputInfo(u"hi", 2, 2, -1, -1); EXPECT_EQ(info, info_expected); // Invalid indices. - info = TextInputInfo(base::UTF8ToUTF16("hi"), 4, 2, 2, 1); - info_expected = TextInputInfo(base::UTF8ToUTF16("hi"), 2, 2, -1, -1); + info = TextInputInfo(u"hi", 4, 2, 2, 1); + info_expected = TextInputInfo(u"hi", 2, 2, -1, -1); EXPECT_EQ(info, info_expected); } @@ -47,26 +47,24 @@ TEST_F(TextInputInfoTest, CommitDiff) { // Add a character. auto edits = EditedText(Text("a", 1, 1), Text("", 0, 0)).GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("a"), 1)); + EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, u"a", 1)); // Add more characters. edits = EditedText(Text("asdf", 4, 4), Text("a", 1, 1)).GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("sdf"), 3)); + EXPECT_EQ(edits[0], + TextEditAction(TextEditActionType::COMMIT_TEXT, u"sdf", 3)); // Delete a character. edits = EditedText(Text("asd", 3, 3), Text("asdf", 4, 4)).GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::DELETE_TEXT, - base::UTF8ToUTF16(""), -1)); + EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::DELETE_TEXT, u"", -1)); // Add characters while the cursor is not at the end. edits = EditedText(Text("asqwed", 5, 5), Text("asd", 2, 2)).GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("qwe"), 3)); + EXPECT_EQ(edits[0], + TextEditAction(TextEditActionType::COMMIT_TEXT, u"qwe", 3)); } TEST_F(TextInputInfoTest, CommitDiffWithSelection) { @@ -74,8 +72,7 @@ TEST_F(TextInputInfoTest, CommitDiffWithSelection) { auto edits = EditedText(Text("This a text", 6, 6), Text("This is text", 5, 7)) .GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("a"), 1)); + EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, u"a", 1)); // There was a selection and the new text is longer than the selection text. // This could happen when the user clicks on a keyboard suggestion. @@ -83,50 +80,49 @@ TEST_F(TextInputInfoTest, CommitDiffWithSelection) { EditedText(Text("This was the text", 12, 12), Text("This is text", 5, 7)) .GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("was the"), 7)); + EXPECT_EQ(edits[0], + TextEditAction(TextEditActionType::COMMIT_TEXT, u"was the", 7)); // There was a selection and the new text is of the same length as the // selection. edits = EditedText(Text("This ha text", 7, 7), Text("This is text", 5, 7)) .GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("ha"), 2)); + EXPECT_EQ(edits[0], + TextEditAction(TextEditActionType::COMMIT_TEXT, u"ha", 2)); // There was a selection and backspace was pressed. edits = EditedText(Text(" text", 0, 0), Text("short text", 0, 5)).GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16(""), 0)); + EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::COMMIT_TEXT, u"", 0)); } TEST_F(TextInputInfoTest, CompositionDiff) { // Start composition auto edits = EditedText(Text("a", 1, 1, 0, 1), Text("", 0, 0)).GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, - base::UTF8ToUTF16("a"), 1)); + EXPECT_EQ(edits[0], + TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, u"a", 1)); // Add more characters. edits = EditedText(Text("asdf", 4, 4, 0, 4), Text("a", 1, 1, 0, 1)).GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, - base::UTF8ToUTF16("asdf"), 3)); + EXPECT_EQ(edits[0], + TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, u"asdf", 3)); // Delete a few characters. edits = EditedText(Text("as", 2, 2, 0, 2), Text("asdf", 4, 4, 0, 4)).GetDiff(); EXPECT_EQ(edits.size(), 1u); - EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, - base::UTF8ToUTF16("as"), -2)); + EXPECT_EQ(edits[0], + TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, u"as", -2)); // Finish composition. edits = EditedText(Text("as ", 3, 3, -1, -1), Text("as", 2, 2, 0, 2)).GetDiff(); EXPECT_EQ(edits.size(), 2u); EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::CLEAR_COMPOSING_TEXT)); - EXPECT_EQ(edits[1], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("as "), 3)); + EXPECT_EQ(edits[1], + TextEditAction(TextEditActionType::COMMIT_TEXT, u"as ", 3)); // Finish composition, but the text is different. This could happen when the // user hits a suggestion that's different from the current composition, but @@ -135,8 +131,8 @@ TEST_F(TextInputInfoTest, CompositionDiff) { EditedText(Text("lk", 2, 2, -1, -1), Text("as", 2, 2, 0, 2)).GetDiff(); EXPECT_EQ(edits.size(), 2u); EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::CLEAR_COMPOSING_TEXT)); - EXPECT_EQ(edits[1], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("lk"), 2)); + EXPECT_EQ(edits[1], + TextEditAction(TextEditActionType::COMMIT_TEXT, u"lk", 2)); // Finish composition, but the new text is shorter than the previous // composition. This could happen when the user hits a suggestion that's @@ -146,8 +142,8 @@ TEST_F(TextInputInfoTest, CompositionDiff) { .GetDiff(); EXPECT_EQ(edits.size(), 2u); EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::CLEAR_COMPOSING_TEXT)); - EXPECT_EQ(edits[1], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("hi"), 2)); + EXPECT_EQ(edits[1], + TextEditAction(TextEditActionType::COMMIT_TEXT, u"hi", 2)); // A new composition without finishing the previous composition. This could // happen when we get coalesced events from the keyboard. For example, when @@ -159,10 +155,10 @@ TEST_F(TextInputInfoTest, CompositionDiff) { .GetDiff(); EXPECT_EQ(edits.size(), 3u); EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::CLEAR_COMPOSING_TEXT)); - EXPECT_EQ(edits[1], TextEditAction(TextEditActionType::COMMIT_TEXT, - base::UTF8ToUTF16("hi"), 2)); - EXPECT_EQ(edits[2], TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, - base::UTF8ToUTF16("i"), 1)); + EXPECT_EQ(edits[1], + TextEditAction(TextEditActionType::COMMIT_TEXT, u"hi", 2)); + EXPECT_EQ(edits[2], + TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, u"i", 1)); // Same as above, but the new composition happens by deleting the current // composition. edits = @@ -170,10 +166,9 @@ TEST_F(TextInputInfoTest, CompositionDiff) { .GetDiff(); EXPECT_EQ(edits.size(), 3u); EXPECT_EQ(edits[0], TextEditAction(TextEditActionType::CLEAR_COMPOSING_TEXT)); - EXPECT_EQ(edits[1], TextEditAction(TextEditActionType::DELETE_TEXT, - base::UTF8ToUTF16(""), -2)); - EXPECT_EQ(edits[2], TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, - base::UTF8ToUTF16("hi"), 2)); + EXPECT_EQ(edits[1], TextEditAction(TextEditActionType::DELETE_TEXT, u"", -2)); + EXPECT_EQ(edits[2], + TextEditAction(TextEditActionType::SET_COMPOSING_TEXT, u"hi", 2)); } } // namespace vr diff --git a/chrome/browser/vr/text_edit_action.cc b/chrome/browser/vr/text_edit_action.cc index ef2d3fcff64d43..db1b0f71a360a8 100644 --- a/chrome/browser/vr/text_edit_action.cc +++ b/chrome/browser/vr/text_edit_action.cc @@ -10,7 +10,7 @@ namespace vr { TextEditAction::TextEditAction(TextEditActionType type) - : TextEditAction(type, base::UTF8ToUTF16(""), 0) {} + : TextEditAction(type, u"", 0) {} TextEditAction::TextEditAction(TextEditActionType type, std::u16string text, int new_cursor_position) diff --git a/chrome/browser/vr/ui_unittest.cc b/chrome/browser/vr/ui_unittest.cc index 41c51b4aa54e13..110b694e6c6fc8 100644 --- a/chrome/browser/vr/ui_unittest.cc +++ b/chrome/browser/vr/ui_unittest.cc @@ -155,21 +155,21 @@ TEST_F(UiTest, PlatformToast) { auto browser_ui = ui_->GetBrowserUiWeakPtr(); // show and hide toast after a timeout. - browser_ui->ShowPlatformToast(base::UTF8ToUTF16("Downloading")); + browser_ui->ShowPlatformToast(u"Downloading"); EXPECT_TRUE(IsVisible(kPlatformToast)); EXPECT_TRUE(RunForSeconds(kToastTimeoutSeconds + kSmallDelaySeconds)); EXPECT_FALSE(IsVisible(kPlatformToast)); // toast can be cancelled. - browser_ui->ShowPlatformToast(base::UTF8ToUTF16("Downloading")); + browser_ui->ShowPlatformToast(u"Downloading"); EXPECT_TRUE(IsVisible(kPlatformToast)); browser_ui->CancelPlatformToast(); EXPECT_FALSE(IsVisible(kPlatformToast)); // toast can refresh visible timeout. - browser_ui->ShowPlatformToast(base::UTF8ToUTF16("Downloading")); + browser_ui->ShowPlatformToast(u"Downloading"); EXPECT_TRUE(RunForSeconds(kSmallDelaySeconds)); - browser_ui->ShowPlatformToast(base::UTF8ToUTF16("Downloading")); + browser_ui->ShowPlatformToast(u"Downloading"); EXPECT_TRUE(RunForSeconds(kToastTimeoutSeconds - kSmallDelaySeconds)); EXPECT_TRUE(IsVisible(kPlatformToast)); EXPECT_TRUE(RunForSeconds(kToastTimeoutSeconds + kSmallDelaySeconds)); diff --git a/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc b/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc index 29e18ea46f16b0..5e56c343e24e9a 100644 --- a/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_data_retriever_unittest.cc @@ -243,7 +243,7 @@ TEST_F(WebAppDataRetrieverTest, GetWebApplicationInfo_TitleAbsentFromRenderer) { web_contents_tester()->SetTitle(web_contents_title); WebApplicationInfo original_web_app_info; - original_web_app_info.title = base::UTF8ToUTF16(""); + original_web_app_info.title = u""; SetRendererWebApplicationInfo(original_web_app_info); @@ -266,10 +266,10 @@ TEST_F(WebAppDataRetrieverTest, web_contents_tester()->NavigateAndCommit(FooUrl()); - web_contents_tester()->SetTitle(base::UTF8ToUTF16("")); + web_contents_tester()->SetTitle(u""); WebApplicationInfo original_web_app_info; - original_web_app_info.title = base::UTF8ToUTF16(""); + original_web_app_info.title = u""; SetRendererWebApplicationInfo(original_web_app_info); diff --git a/chrome/browser/web_applications/components/web_app_icon_generator_unittest.cc b/chrome/browser/web_applications/components/web_app_icon_generator_unittest.cc index a77bd1eac235a9..19e2f26b274791 100644 --- a/chrome/browser/web_applications/components/web_app_icon_generator_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_icon_generator_unittest.cc @@ -152,8 +152,7 @@ void TestIconGeneration(int icon_size, SkColor generated_icon_color = SK_ColorTRANSPARENT; bool is_generated_icon = true; auto size_map = ResizeIconsAndGenerateMissing( - downloaded, TestSizesToGenerate(), - GenerateIconLetterFromAppName(base::UTF8ToUTF16("Test")), + downloaded, TestSizesToGenerate(), GenerateIconLetterFromAppName(u"Test"), &generated_icon_color, &is_generated_icon); EXPECT_FALSE(is_generated_icon); @@ -240,8 +239,7 @@ TEST_F(WebAppIconGeneratorTest, LinkedAppIconsAreNotChanged) { SkColor generated_icon_color = SK_ColorTRANSPARENT; bool is_generated_icon = true; SizeToBitmap size_map = ResizeIconsAndGenerateMissing( - downloaded, sizes, - GenerateIconLetterFromAppName(base::UTF8ToUTF16("Test")), + downloaded, sizes, GenerateIconLetterFromAppName(u"Test"), &generated_icon_color, &is_generated_icon); EXPECT_EQ(sizes.size(), size_map.size()); EXPECT_FALSE(is_generated_icon); @@ -266,8 +264,7 @@ TEST_F(WebAppIconGeneratorTest, IconsResizedFromOddSizes) { SkColor generated_icon_color = SK_ColorTRANSPARENT; bool is_generated_icon = true; SizeToBitmap size_map = ResizeIconsAndGenerateMissing( - downloaded, TestSizesToGenerate(), - GenerateIconLetterFromAppName(base::UTF8ToUTF16("Test")), + downloaded, TestSizesToGenerate(), GenerateIconLetterFromAppName(u"Test"), &generated_icon_color, &is_generated_icon); EXPECT_FALSE(is_generated_icon); @@ -288,8 +285,7 @@ TEST_F(WebAppIconGeneratorTest, IconsResizedFromLarger) { SkColor generated_icon_color = SK_ColorTRANSPARENT; bool is_generated_icon = true; SizeToBitmap size_map = ResizeIconsAndGenerateMissing( - downloaded, TestSizesToGenerate(), - GenerateIconLetterFromAppName(base::UTF8ToUTF16("Test")), + downloaded, TestSizesToGenerate(), GenerateIconLetterFromAppName(u"Test"), &generated_icon_color, &is_generated_icon); EXPECT_FALSE(is_generated_icon); @@ -307,8 +303,7 @@ TEST_F(WebAppIconGeneratorTest, AllIconsGeneratedWhenNotDownloaded) { SkColor generated_icon_color = SK_ColorTRANSPARENT; bool is_generated_icon = false; SizeToBitmap size_map = ResizeIconsAndGenerateMissing( - downloaded, TestSizesToGenerate(), - GenerateIconLetterFromAppName(base::UTF8ToUTF16("Test")), + downloaded, TestSizesToGenerate(), GenerateIconLetterFromAppName(u"Test"), &generated_icon_color, &is_generated_icon); EXPECT_TRUE(is_generated_icon); @@ -328,8 +323,7 @@ TEST_F(WebAppIconGeneratorTest, IconResizedFromLargerAndSmaller) { SkColor generated_icon_color = SK_ColorTRANSPARENT; bool is_generated_icon = true; SizeToBitmap size_map = ResizeIconsAndGenerateMissing( - downloaded, TestSizesToGenerate(), - GenerateIconLetterFromAppName(base::UTF8ToUTF16("Test")), + downloaded, TestSizesToGenerate(), GenerateIconLetterFromAppName(u"Test"), &generated_icon_color, &is_generated_icon); EXPECT_FALSE(is_generated_icon); diff --git a/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc b/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc index 1bad0f007d8ea9..592657bd6359f2 100644 --- a/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_install_utils_unittest.cc @@ -100,15 +100,14 @@ TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest) { { blink::Manifest::FileHandler handler; handler.action = GURL("http://example.com/open-files"); - handler.accept[base::UTF8ToUTF16("image/png")].push_back( - base::UTF8ToUTF16(".png")); - handler.name = base::UTF8ToUTF16("Images"); + handler.accept[u"image/png"].push_back(u".png"); + handler.name = u"Images"; manifest.file_handlers.push_back(handler); } { blink::Manifest::ProtocolHandler protocol_handler; - protocol_handler.protocol = base::UTF8ToUTF16("mailto"); + protocol_handler.protocol = u"mailto"; protocol_handler.url = GURL("http://example.com/handle=%s"); manifest.protocol_handlers.push_back(protocol_handler); } @@ -166,15 +165,14 @@ TEST(WebAppInstallUtils, UpdateWebAppInfoFromManifest) { EXPECT_EQ(1u, web_app_info.file_handlers.size()); auto file_handler = web_app_info.file_handlers; EXPECT_EQ(manifest.file_handlers[0].action, file_handler[0].action); - ASSERT_EQ(file_handler[0].accept.count(base::UTF8ToUTF16("image/png")), 1u); - EXPECT_EQ(file_handler[0].accept[base::UTF8ToUTF16("image/png")][0], - base::UTF8ToUTF16(".png")); - EXPECT_EQ(file_handler[0].name, base::UTF8ToUTF16("Images")); + ASSERT_EQ(file_handler[0].accept.count(u"image/png"), 1u); + EXPECT_EQ(file_handler[0].accept[u"image/png"][0], u".png"); + EXPECT_EQ(file_handler[0].name, u"Images"); // Check protocol handlers were updated EXPECT_EQ(1u, web_app_info.protocol_handlers.size()); auto protocol_handler = web_app_info.protocol_handlers[0]; - EXPECT_EQ(protocol_handler.protocol, base::UTF8ToUTF16("mailto")); + EXPECT_EQ(protocol_handler.protocol, u"mailto"); EXPECT_EQ(protocol_handler.url, GURL("http://example.com/handle=%s")); EXPECT_EQ(1u, web_app_info.url_handlers.size()); @@ -345,15 +343,14 @@ TEST_F(WebAppInstallUtilsWithShortcutsMenu, { blink::Manifest::FileHandler handler; handler.action = GURL("http://example.com/open-files"); - handler.accept[base::UTF8ToUTF16("image/png")].push_back( - base::UTF8ToUTF16(".png")); - handler.name = base::UTF8ToUTF16("Images"); + handler.accept[u"image/png"].push_back(u".png"); + handler.name = u"Images"; manifest.file_handlers.push_back(handler); } { blink::Manifest::ProtocolHandler protocol_handler; - protocol_handler.protocol = base::UTF8ToUTF16("mailto"); + protocol_handler.protocol = u"mailto"; protocol_handler.url = GURL("http://example.com/handle=%s"); manifest.protocol_handlers.push_back(protocol_handler); } @@ -446,15 +443,14 @@ TEST_F(WebAppInstallUtilsWithShortcutsMenu, EXPECT_EQ(1u, web_app_info.file_handlers.size()); auto file_handler = web_app_info.file_handlers; EXPECT_EQ(manifest.file_handlers[0].action, file_handler[0].action); - ASSERT_EQ(file_handler[0].accept.count(base::UTF8ToUTF16("image/png")), 1u); - EXPECT_EQ(file_handler[0].accept[base::UTF8ToUTF16("image/png")][0], - base::UTF8ToUTF16(".png")); - EXPECT_EQ(file_handler[0].name, base::UTF8ToUTF16("Images")); + ASSERT_EQ(file_handler[0].accept.count(u"image/png"), 1u); + EXPECT_EQ(file_handler[0].accept[u"image/png"][0], u".png"); + EXPECT_EQ(file_handler[0].name, u"Images"); // Check protocol handlers were updated EXPECT_EQ(1u, web_app_info.protocol_handlers.size()); auto protocol_handler = web_app_info.protocol_handlers[0]; - EXPECT_EQ(protocol_handler.protocol, base::UTF8ToUTF16("mailto")); + EXPECT_EQ(protocol_handler.protocol, u"mailto"); EXPECT_EQ(protocol_handler.url, GURL("http://example.com/handle=%s")); // Check URL handlers were updated diff --git a/chrome/browser/web_applications/components/web_app_shortcut_linux_unittest.cc b/chrome/browser/web_applications/components/web_app_shortcut_linux_unittest.cc index 5d9724cbb21a30..73d24121e43349 100644 --- a/chrome/browser/web_applications/components/web_app_shortcut_linux_unittest.cc +++ b/chrome/browser/web_applications/components/web_app_shortcut_linux_unittest.cc @@ -143,7 +143,7 @@ class WebAppShortcutLinuxTest : public WebAppTest { std::unique_ptr GetShortcutInfo() { auto shortcut_info = std::make_unique(); shortcut_info->extension_id = GetAppId(); - shortcut_info->title = base::UTF8ToUTF16("app"); + shortcut_info->title = u"app"; shortcut_info->profile_path = base::FilePath("/a/b/c").Append(GetProfilePath()); gfx::ImageFamily image_family; diff --git a/chrome/browser/web_applications/components/web_app_shortcut_mac_unittest.mm b/chrome/browser/web_applications/components/web_app_shortcut_mac_unittest.mm index 43b9a8d428acf3..2a70d89ac81a24 100644 --- a/chrome/browser/web_applications/components/web_app_shortcut_mac_unittest.mm +++ b/chrome/browser/web_applications/components/web_app_shortcut_mac_unittest.mm @@ -403,11 +403,11 @@ void TearDown() override { NiceMock shortcut_creator(app_data_dir_, info_.get()); - info_->title = base::UTF8ToUTF16("../../Evil/"); + info_->title = u"../../Evil/"; EXPECT_EQ(destination_dir_.Append(":..:Evil:.app"), shortcut_creator.GetApplicationsShortcutPath(false)); - info_->title = base::UTF8ToUTF16("...."); + info_->title = u"...."; EXPECT_EQ(destination_dir_.Append(fallback_shim_base_name_), shortcut_creator.GetApplicationsShortcutPath(false)); } diff --git a/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc b/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc index 0b7cbde9f2a5a9..a61fc0cc161dae 100644 --- a/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc +++ b/chrome/browser/web_applications/extensions/pending_app_install_task_unittest.cc @@ -1006,7 +1006,7 @@ TEST_F(PendingAppInstallTaskTest, InstallWithWebAppInfoSucceeds) { auto info = std::make_unique(); info->start_url = WebAppUrl(); info->scope = WebAppUrl().GetWithoutFilename(); - info->title = base::UTF8ToUTF16("Foo Web App"); + info->title = u"Foo Web App"; return info; }); @@ -1056,7 +1056,7 @@ TEST_F(PendingAppInstallTaskTest, InstallWithWebAppInfoFails) { auto info = std::make_unique(); info->start_url = WebAppUrl(); info->scope = WebAppUrl().GetWithoutFilename(); - info->title = base::UTF8ToUTF16("Foo Web App"); + info->title = u"Foo Web App"; return info; }); diff --git a/chrome/browser/web_applications/external_web_app_manager_browsertest.cc b/chrome/browser/web_applications/external_web_app_manager_browsertest.cc index f16367859786cf..05e795c3135650 100644 --- a/chrome/browser/web_applications/external_web_app_manager_browsertest.cc +++ b/chrome/browser/web_applications/external_web_app_manager_browsertest.cc @@ -644,7 +644,7 @@ IN_PROC_BROWSER_TEST_F(ExternalWebAppManagerBrowserTest, // Install user app. auto web_application_info = std::make_unique(); web_application_info->start_url = user_app_start_url; - web_application_info->title = base::UTF8ToUTF16("Test user app"); + web_application_info->title = u"Test user app"; AppId user_app_id = InstallWebApp(profile(), std::move(web_application_info)); // Ensure the UI receives these apps. diff --git a/chrome/browser/web_applications/external_web_app_migration_browsertest.cc b/chrome/browser/web_applications/external_web_app_migration_browsertest.cc index f559da7e189eed..eee3550924ef99 100644 --- a/chrome/browser/web_applications/external_web_app_migration_browsertest.cc +++ b/chrome/browser/web_applications/external_web_app_migration_browsertest.cc @@ -528,7 +528,7 @@ IN_PROC_BROWSER_TEST_F(ExternalWebAppMigrationBrowserTest, options.app_info_factory = base::BindLambdaForTesting([&]() { auto info = std::make_unique(); info->start_url = GetWebAppUrl(); - info->title = base::UTF8ToUTF16("Test app"); + info->title = u"Test app"; return info; }); preinstalled_apps.apps.push_back(std::move(options)); diff --git a/chrome/browser/web_applications/external_web_app_utils_unittest.cc b/chrome/browser/web_applications/external_web_app_utils_unittest.cc index 4d3ced78b77850..8fdedad6af0da5 100644 --- a/chrome/browser/web_applications/external_web_app_utils_unittest.cc +++ b/chrome/browser/web_applications/external_web_app_utils_unittest.cc @@ -197,7 +197,7 @@ TEST_F(ExternalWebAppUtilsTest, MAYBE_OfflineManifestValid) { .value() .Run(); EXPECT_TRUE(app_info); - EXPECT_EQ(app_info->title, base::UTF8ToUTF16("Test App")); + EXPECT_EQ(app_info->title, u"Test App"); EXPECT_EQ(app_info->start_url, GURL("https://test.org/start.html")); EXPECT_EQ(app_info->scope, GURL("https://test.org/")); EXPECT_EQ(app_info->display_mode, DisplayMode::kStandalone); diff --git a/chrome/browser/web_applications/manifest_update_task_unittest.cc b/chrome/browser/web_applications/manifest_update_task_unittest.cc index 71d9cd84357e5e..e1bccd726c6223 100644 --- a/chrome/browser/web_applications/manifest_update_task_unittest.cc +++ b/chrome/browser/web_applications/manifest_update_task_unittest.cc @@ -27,10 +27,9 @@ apps::FileHandlers GetDefaultAppsFileHandlers() { std::vector GetDefaultManifestFileHandlers() { blink::Manifest::FileHandler handler; handler.action = GURL("http://foo.com/?plaintext"); - handler.name = base::UTF8ToUTF16("Text"); - std::vector extensions = {base::UTF8ToUTF16(".txt"), - base::UTF8ToUTF16(".md")}; - handler.accept.emplace(base::UTF8ToUTF16("text/plain"), extensions); + handler.name = u"Text"; + std::vector extensions = {u".txt", u".md"}; + handler.accept.emplace(u"text/plain", extensions); return {handler}; } @@ -61,9 +60,9 @@ TEST_F(ManifestUpdateTaskTest, TestSecondFileHandlerAdded) { GetDefaultManifestFileHandlers(); blink::Manifest::FileHandler second_handler; second_handler.action = GURL("http://foo.com/?csv"); - second_handler.name = base::UTF8ToUTF16("Comma-Separated Value"); - std::vector extensions = {base::UTF8ToUTF16(".csv")}; - second_handler.accept.emplace(base::UTF8ToUTF16("text/csv"), extensions); + second_handler.name = u"Comma-Separated Value"; + std::vector extensions = {u".csv"}; + second_handler.accept.emplace(u"text/csv", extensions); new_handlers.push_back(second_handler); EXPECT_TRUE(internal::HaveFileHandlersChanged(&old_handlers, new_handlers)); @@ -73,7 +72,7 @@ TEST_F(ManifestUpdateTaskTest, TestFileHandlerChangedName) { apps::FileHandlers old_handlers = GetDefaultAppsFileHandlers(); std::vector new_handlers = GetDefaultManifestFileHandlers(); - new_handlers[0].name = base::UTF8ToUTF16("Comma-Separated Values"); + new_handlers[0].name = u"Comma-Separated Values"; // Ignore name changes, because the registrar doesn't store the name. EXPECT_FALSE(internal::HaveFileHandlersChanged(&old_handlers, new_handlers)); @@ -92,8 +91,8 @@ TEST_F(ManifestUpdateTaskTest, TestFileHandlerExtraAccept) { apps::FileHandlers old_handlers = GetDefaultAppsFileHandlers(); std::vector new_handlers = GetDefaultManifestFileHandlers(); - std::vector csv_extensions = {base::UTF8ToUTF16(".csv")}; - new_handlers[0].accept.emplace(base::UTF8ToUTF16("text/csv"), csv_extensions); + std::vector csv_extensions = {u".csv"}; + new_handlers[0].accept.emplace(u"text/csv", csv_extensions); EXPECT_TRUE(internal::HaveFileHandlersChanged(&old_handlers, new_handlers)); } diff --git a/chrome/browser/web_applications/pending_app_manager_impl_unittest.cc b/chrome/browser/web_applications/pending_app_manager_impl_unittest.cc index 71133b332cfaa3..5378b742dd3129 100644 --- a/chrome/browser/web_applications/pending_app_manager_impl_unittest.cc +++ b/chrome/browser/web_applications/pending_app_manager_impl_unittest.cc @@ -95,7 +95,7 @@ std::unique_ptr GetFooWebApplicationInfo() { std::make_unique(); info->start_url = FooWebAppUrl(); info->scope = FooWebAppUrl().GetWithoutFilename(); - info->title = base::UTF8ToUTF16("Foo Web App"); + info->title = u"Foo Web App"; return info; } diff --git a/chrome/browser/web_applications/preinstalled_web_apps/gmail.cc b/chrome/browser/web_applications/preinstalled_web_apps/gmail.cc index 03a5d736cf446f..cb8e25ccfe958f 100644 --- a/chrome/browser/web_applications/preinstalled_web_apps/gmail.cc +++ b/chrome/browser/web_applications/preinstalled_web_apps/gmail.cc @@ -28,7 +28,7 @@ ExternalInstallOptions GetConfigForGmail() { options.only_use_app_info_factory = true; options.app_info_factory = base::BindRepeating([]() { auto info = std::make_unique(); - info->title = base::UTF8ToUTF16("Gmail"); + info->title = u"Gmail"; info->start_url = GURL("https://mail.google.com/?usp=installed_webapp"); info->scope = GURL("https://mail.google.com/"); info->display_mode = DisplayMode::kBrowser; diff --git a/chrome/browser/web_applications/preinstalled_web_apps/youtube.cc b/chrome/browser/web_applications/preinstalled_web_apps/youtube.cc index f85d78b945a67c..4231c46a1f25d2 100644 --- a/chrome/browser/web_applications/preinstalled_web_apps/youtube.cc +++ b/chrome/browser/web_applications/preinstalled_web_apps/youtube.cc @@ -32,7 +32,7 @@ ExternalInstallOptions GetConfigForYouTube() { options.only_use_app_info_factory = true; options.app_info_factory = base::BindRepeating([]() { auto info = std::make_unique(); - info->title = base::UTF8ToUTF16("YouTube"); + info->title = u"YouTube"; info->start_url = GURL("https://www.youtube.com/?feature=ytca"); info->scope = GURL("https://www.youtube.com/"); info->display_mode = DisplayMode::kMinimalUi; diff --git a/chrome/browser/web_applications/system_web_app_manager_unittest.cc b/chrome/browser/web_applications/system_web_app_manager_unittest.cc index eea32721565e3b..55b056805e9209 100644 --- a/chrome/browser/web_applications/system_web_app_manager_unittest.cc +++ b/chrome/browser/web_applications/system_web_app_manager_unittest.cc @@ -73,7 +73,7 @@ std::unique_ptr GetApp1WebApplicationInfo() { std::make_unique(); info->start_url = AppUrl1(); info->scope = AppUrl1().GetWithoutFilename(); - info->title = base::UTF8ToUTF16("Foo Web App"); + info->title = u"Foo Web App"; return info; } @@ -88,7 +88,7 @@ std::unique_ptr GetApp2WebApplicationInfo() { std::make_unique(); info->start_url = AppUrl2(); info->scope = AppUrl2().GetWithoutFilename(); - info->title = base::UTF8ToUTF16("Bar Web App"); + info->title = u"Bar Web App"; return info; } @@ -103,7 +103,7 @@ std::unique_ptr GetApp3WebApplicationInfo() { std::make_unique(); info->start_url = AppUrl3(); info->scope = AppUrl3().GetWithoutFilename(); - info->title = base::UTF8ToUTF16("Bar Web App"); + info->title = u"Bar Web App"; return info; } diff --git a/chrome/browser/web_applications/test/test_system_web_app_installation.cc b/chrome/browser/web_applications/test/test_system_web_app_installation.cc index 6c3b65c7cff493..9cc5c406dc8b08 100644 --- a/chrome/browser/web_applications/test/test_system_web_app_installation.cc +++ b/chrome/browser/web_applications/test/test_system_web_app_installation.cc @@ -126,7 +126,7 @@ std::unique_ptr GenerateWebApplicationInfoForTestApp() { // installation modes. info->start_url = GURL("chrome://test-system-app/pwa.html"); info->scope = GURL("chrome://test-system-app/"); - info->title = base::UTF8ToUTF16("Test System App"); + info->title = u"Test System App"; info->theme_color = 0xFF00FF00; info->display_mode = blink::mojom::DisplayMode::kStandalone; info->open_as_window = true; @@ -267,7 +267,7 @@ TestSystemWebAppInstallation::SetUpAppThatCapturesNavigation() { info->start_url = GURL("chrome://initiating-app/pwa.html"); info->scope = GURL("chrome://initiating-app/"); - info->title = base::UTF8ToUTF16("Test System App"); + info->title = u"Test System App"; info->theme_color = 0xFF00FF00; info->display_mode = blink::mojom::DisplayMode::kStandalone; diff --git a/chrome/browser/web_applications/web_app_install_manager_unittest.cc b/chrome/browser/web_applications/web_app_install_manager_unittest.cc index f3b93e5b868dab..1781aaedb261c9 100644 --- a/chrome/browser/web_applications/web_app_install_manager_unittest.cc +++ b/chrome/browser/web_applications/web_app_install_manager_unittest.cc @@ -1267,7 +1267,7 @@ TEST_F(WebAppInstallManagerTest, InstallWebAppFromInfo) { auto server_web_app_info = std::make_unique(); server_web_app_info->start_url = url; server_web_app_info->scope = url; - server_web_app_info->title = base::UTF8ToUTF16("Test web app"); + server_web_app_info->title = u"Test web app"; InstallResult result = InstallWebAppFromInfo(std::move(server_web_app_info)); EXPECT_EQ(InstallResultCode::kSuccessNewInstall, result.code); diff --git a/chrome/browser/web_applications/web_app_migration_manager_browsertest.cc b/chrome/browser/web_applications/web_app_migration_manager_browsertest.cc index c1da478bbcb505..d8c29be67c69fb 100644 --- a/chrome/browser/web_applications/web_app_migration_manager_browsertest.cc +++ b/chrome/browser/web_applications/web_app_migration_manager_browsertest.cc @@ -377,9 +377,9 @@ IN_PROC_BROWSER_TEST_F(WebAppMigrationManagerBrowserTestWithShortcutsMenu, std::vector shortcuts_menu_item_infos = provider().registrar().GetAppShortcutsMenuItemInfos(app_id); EXPECT_EQ(shortcuts_menu_item_infos.size(), 2u); - EXPECT_EQ(shortcuts_menu_item_infos[0].name, base::UTF8ToUTF16("shortcut1")); + EXPECT_EQ(shortcuts_menu_item_infos[0].name, u"shortcut1"); EXPECT_EQ(shortcuts_menu_item_infos[0].shortcut_icon_infos.size(), 1u); - EXPECT_EQ(shortcuts_menu_item_infos[1].name, base::UTF8ToUTF16("shortcut2")); + EXPECT_EQ(shortcuts_menu_item_infos[1].name, u"shortcut2"); EXPECT_EQ(shortcuts_menu_item_infos[1].shortcut_icon_infos.size(), 2u); const std::vector> shortcuts_menu_icons_sizes = { @@ -405,12 +405,10 @@ IN_PROC_BROWSER_TEST_F(WebAppMigrationManagerBrowserTestWithShortcutsMenu, EXPECT_EQ(DisplayMode::kStandalone, web_app->display_mode()); EXPECT_EQ(web_app->shortcuts_menu_item_infos().size(), 2u); - EXPECT_EQ(web_app->shortcuts_menu_item_infos()[0].name, - base::UTF8ToUTF16("shortcut1")); + EXPECT_EQ(web_app->shortcuts_menu_item_infos()[0].name, u"shortcut1"); EXPECT_EQ(web_app->shortcuts_menu_item_infos()[0].shortcut_icon_infos.size(), 1u); - EXPECT_EQ(web_app->shortcuts_menu_item_infos()[1].name, - base::UTF8ToUTF16("shortcut2")); + EXPECT_EQ(web_app->shortcuts_menu_item_infos()[1].name, u"shortcut2"); EXPECT_EQ(web_app->shortcuts_menu_item_infos()[1].shortcut_icon_infos.size(), 2u); diff --git a/chrome/common/importer/firefox_importer_utils_unittest.cc b/chrome/common/importer/firefox_importer_utils_unittest.cc index fdb4df7fc2de48..a1a7c159d73001 100644 --- a/chrome/common/importer/firefox_importer_utils_unittest.cc +++ b/chrome/common/importer/firefox_importer_utils_unittest.cc @@ -250,9 +250,8 @@ TEST(FirefoxImporterUtilsTest, GetFirefoxProfilePath) { one_of_profiles_is_not_ascii_named.SetString("Profile0.Name", "namey"); one_of_profiles_is_not_ascii_named.SetString("Profile0.IsRelative", "0"); one_of_profiles_is_not_ascii_named.SetString("Profile1.Path", - UTF8ToUTF16("second.профиль")); - one_of_profiles_is_not_ascii_named.SetString("Profile1.Name", - UTF8ToUTF16("профиль")); + u"second.профиль"); + one_of_profiles_is_not_ascii_named.SetString("Profile1.Name", u"профиль"); one_of_profiles_is_not_ascii_named.SetString("Profile1.IsRelative", "0"); std::vector one_of_profiles_is_not_ascii_named_details = GetFirefoxDetailsFromDictionary(one_of_profiles_is_not_ascii_named, @@ -263,5 +262,5 @@ TEST(FirefoxImporterUtilsTest, GetFirefoxProfilePath) { ASCIIToUTF16("namey")}, FirefoxDetail{base::FilePath(FILE_PATH_LITERAL("second." "профиль")), - UTF8ToUTF16("профиль")})); + u"профиль"})); } diff --git a/chrome/renderer/chrome_content_renderer_client_unittest.cc b/chrome/renderer/chrome_content_renderer_client_unittest.cc index 78f70041d64066..35a99d4deb563e 100644 --- a/chrome/renderer/chrome_content_renderer_client_unittest.cc +++ b/chrome/renderer/chrome_content_renderer_client_unittest.cc @@ -76,7 +76,7 @@ void AddContentTypeHandler(content::WebPluginInfo* info, content::WebPluginMimeType mime_type_info; mime_type_info.mime_type = mime_type; mime_type_info.additional_params.emplace_back( - base::UTF8ToUTF16("nacl"), base::UTF8ToUTF16(manifest_url)); + u"nacl", base::UTF8ToUTF16(manifest_url)); info->mime_types.push_back(mime_type_info); } diff --git a/chrome/test/media_router/media_router_integration_ui_browsertest.cc b/chrome/test/media_router/media_router_integration_ui_browsertest.cc index 53ee280a811df3..17a5ea6c0c7362 100644 --- a/chrome/test/media_router/media_router_integration_ui_browsertest.cc +++ b/chrome/test/media_router/media_router_integration_ui_browsertest.cc @@ -59,10 +59,9 @@ IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, std::string issue_title = test_ui_->GetIssueTextForSink(receiver_); // TODO(imcheng): Fix host name for file schemes (crbug.com/560576). - ASSERT_EQ( - l10n_util::GetStringFUTF8(IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT, - base::UTF8ToUTF16("file:///")), - issue_title); + ASSERT_EQ(l10n_util::GetStringFUTF8( + IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT, u"file:///"), + issue_title); // Route will still get created, it just takes longer than usual. test_ui_->WaitForAnyRoute(); diff --git a/chromecast/browser/cast_web_contents_browsertest.cc b/chromecast/browser/cast_web_contents_browsertest.cc index a38ef0cbb2a53d..03ac912b248a9e 100644 --- a/chromecast/browser/cast_web_contents_browsertest.cc +++ b/chromecast/browser/cast_web_contents_browsertest.cc @@ -954,8 +954,7 @@ IN_PROC_BROWSER_TEST_F(CastWebContentsBrowserTest, ExecuteJavaScript) { // Execute a script snippet to return the variable's value. base::RunLoop run_loop2; cast_web_contents_->ExecuteJavaScript( - base::UTF8ToUTF16("the_var;"), - base::BindLambdaForTesting([&](base::Value result_value) { + u"the_var;", base::BindLambdaForTesting([&](base::Value result_value) { std::string result_json; ASSERT_TRUE(base::JSONWriter::Write(result_value, &result_json)); EXPECT_EQ(result_json, kSoyMilkJsonStringLiteral); diff --git a/chromecast/ui/media_overlay_impl.cc b/chromecast/ui/media_overlay_impl.cc index 4522a6e48f01b4..f6d9140b8fed60 100644 --- a/chromecast/ui/media_overlay_impl.cc +++ b/chromecast/ui/media_overlay_impl.cc @@ -104,7 +104,7 @@ void MediaOverlayImpl::AddVolumeBar(views::View* container) { } void MediaOverlayImpl::AddToast(views::View* container) { - toast_label_ = new views::Label(base::UTF8ToUTF16("")); + toast_label_ = new views::Label(u""); toast_label_->SetFontList(toast_font_list_); toast_label_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_CENTER); diff --git a/chromeos/components/diagnostics_ui/backend/power_manager_client_conversions_unittest.cc b/chromeos/components/diagnostics_ui/backend/power_manager_client_conversions_unittest.cc index 50ac58a041eb9e..52f8ae5481070f 100644 --- a/chromeos/components/diagnostics_ui/backend/power_manager_client_conversions_unittest.cc +++ b/chromeos/components/diagnostics_ui/backend/power_manager_client_conversions_unittest.cc @@ -91,12 +91,12 @@ TEST_F(PowerManagerClientConversionsTest, PowerTime) { // Battery charging with 11220 seconds (3h 7m) remaining. props = ConstructPowerSupplyProperties(false, 11220, 0); - EXPECT_EQ(base::UTF8ToUTF16("3 hours and 7 minutes"), + EXPECT_EQ(u"3 hours and 7 minutes", ConstructPowerTime(mojom::BatteryState::kCharging, props)); // Battery discharging with 10380 seconds (2h 53m) remaining. props = ConstructPowerSupplyProperties(false, 0, 10380); - EXPECT_EQ(base::UTF8ToUTF16("2 hours and 53 minutes"), + EXPECT_EQ(u"2 hours and 53 minutes", ConstructPowerTime(mojom::BatteryState::kDischarging, props)); } diff --git a/chromeos/components/local_search_service/content_extraction_utils_unittest.cc b/chromeos/components/local_search_service/content_extraction_utils_unittest.cc index 1a349a224ea61a..08e93a9cd616da 100644 --- a/chromeos/components/local_search_service/content_extraction_utils_unittest.cc +++ b/chromeos/components/local_search_service/content_extraction_utils_unittest.cc @@ -25,7 +25,7 @@ TEST(ContentExtractionUtilsTest, ConsolidateTokenTest) { bool found = false; for (const auto& token : tokens) { - if (token.content == base::UTF8ToUTF16("duplicate")) { + if (token.content == u"duplicate") { found = true; EXPECT_EQ(token.positions[0].weight, kDefaultWeight); EXPECT_EQ(token.positions[0].position.content_id, "3rd test"); @@ -40,20 +40,19 @@ TEST(ContentExtractionUtilsTest, ConsolidateTokenTest) { } { std::vector sources = { - Token(base::UTF8ToUTF16("A"), + Token(u"A", {WeightedPosition(kDefaultWeight, Position("ID1", 1u, 1u)), WeightedPosition(kDefaultWeight, Position("ID1", 3u, 1u))}), - Token(base::UTF8ToUTF16("B"), - {WeightedPosition(kDefaultWeight, Position("ID1", 5, 1))}), + Token(u"B", {WeightedPosition(kDefaultWeight, Position("ID1", 5, 1))}), // A different weight for content "ID2". - Token(base::UTF8ToUTF16("A"), + Token(u"A", {WeightedPosition(kDefaultWeight / 2, Position("ID2", 10, 1))})}; const auto tokens = ConsolidateToken(sources); EXPECT_EQ(tokens.size(), 2u); bool found = false; for (const auto& token : tokens) { - if (token.content == base::UTF8ToUTF16("A")) { + if (token.content == u"A") { found = true; EXPECT_EQ(token.positions[0].weight, kDefaultWeight); EXPECT_EQ(token.positions[0].position.content_id, "ID1"); @@ -82,18 +81,18 @@ TEST(ContentExtractionUtilsTest, ExtractContentTest) { ExtractContent("first test", text, kDefaultWeight / 2, "en"); EXPECT_EQ(tokens.size(), 7u); - EXPECT_EQ(tokens[1].content, base::UTF8ToUTF16("english")); + EXPECT_EQ(tokens[1].content, u"english"); EXPECT_EQ(tokens[1].positions[0].weight, kDefaultWeight / 2); EXPECT_EQ(tokens[1].positions[0].position.content_id, "first test"); EXPECT_EQ(tokens[1].positions[0].position.start, 10u); EXPECT_EQ(tokens[1].positions[0].position.length, 7u); } { - const std::u16string text(base::UTF8ToUTF16("@#$%@^你好!!!")); + const std::u16string text(u"@#$%@^你好!!!"); const auto tokens = ExtractContent("2nd test", text, kDefaultWeight, "zh"); EXPECT_EQ(tokens.size(), 1u); - EXPECT_EQ(tokens[0].content, base::UTF8ToUTF16("你好")); + EXPECT_EQ(tokens[0].content, u"你好"); EXPECT_EQ(tokens[0].positions[0].weight, kDefaultWeight); EXPECT_EQ(tokens[0].positions[0].position.content_id, "2nd test"); EXPECT_EQ(tokens[0].positions[0].position.start, 6u); @@ -103,38 +102,35 @@ TEST(ContentExtractionUtilsTest, ExtractContentTest) { TEST(ContentExtractionUtilsTest, StopwordTest) { // Non English. - EXPECT_FALSE(IsStopword(base::UTF8ToUTF16("was"), "vn")); + EXPECT_FALSE(IsStopword(u"was", "vn")); // English. - EXPECT_TRUE(IsStopword(base::UTF8ToUTF16("i"), "en-US")); - EXPECT_TRUE(IsStopword(base::UTF8ToUTF16("my"), "en")); - EXPECT_FALSE(IsStopword(base::UTF8ToUTF16("stopword"), "en")); + EXPECT_TRUE(IsStopword(u"i", "en-US")); + EXPECT_TRUE(IsStopword(u"my", "en")); + EXPECT_FALSE(IsStopword(u"stopword", "en")); } TEST(ContentExtractionUtilsTest, NormalizerTest) { // Test diacritic removed. - EXPECT_EQ( - Normalizer(base::UTF8ToUTF16("các dấu câu đã được loại bỏ thành công")), - base::UTF8ToUTF16("cac dau cau da duoc loai bo thanh cong")); + EXPECT_EQ(Normalizer(u"các dấu câu đã được loại bỏ thành công"), + u"cac dau cau da duoc loai bo thanh cong"); // Test hyphens removed. - EXPECT_EQ(Normalizer(base::UTF8ToUTF16(u8"wi\u2015fi----"), true), - base::UTF8ToUTF16("wifi")); + EXPECT_EQ(Normalizer(base::UTF8ToUTF16(u8"wi\u2015fi----"), true), u"wifi"); // Keep hyphen. - EXPECT_EQ(Normalizer(base::UTF8ToUTF16("wi-fi"), false), - base::UTF8ToUTF16("wi-fi")); + EXPECT_EQ(Normalizer(u"wi-fi", false), u"wi-fi"); // Case folding test. - EXPECT_EQ(Normalizer(base::UTF8ToUTF16("This Is sOmE WEIRD LooKing text")), - base::UTF8ToUTF16("this is some weird looking text")); + EXPECT_EQ(Normalizer(u"This Is sOmE WEIRD LooKing text"), + u"this is some weird looking text"); // Combine test. EXPECT_EQ( Normalizer(base::UTF8ToUTF16( "Đây là MỘT trình duyệt tuyệt vời và mượt\u2014\u058Amà"), true), - base::UTF8ToUTF16("day la mot trinh duyet tuyet voi va muotma")); + u"day la mot trinh duyet tuyet voi va muotma"); } } // namespace local_search_service diff --git a/chromeos/components/local_search_service/inverted_index_search_unittest.cc b/chromeos/components/local_search_service/inverted_index_search_unittest.cc index 205c96b914cd42..057d831ea4ebd2 100644 --- a/chromeos/components/local_search_service/inverted_index_search_unittest.cc +++ b/chromeos/components/local_search_service/inverted_index_search_unittest.cc @@ -151,14 +151,13 @@ TEST_F(InvertedIndexSearchTest, Add) { { // "network" does not exist in the index. const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("network")); + search_->FindTermForTesting(u"network"); EXPECT_TRUE(doc_with_freq.empty()); } { // "help" exists in the index. - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("help")); + const TermOccurrence doc_with_freq = search_->FindTermForTesting(u"help"); EXPECT_EQ(doc_with_freq.size(), 2u); EXPECT_EQ(doc_with_freq[0].first, "id1"); EXPECT_EQ(doc_with_freq[0].second, 3u); @@ -168,26 +167,24 @@ TEST_F(InvertedIndexSearchTest, Add) { { // "wifi" exists in the index but "wi-fi" doesn't because of normalization. - TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("wifi")); + TermOccurrence doc_with_freq = search_->FindTermForTesting(u"wifi"); EXPECT_EQ(doc_with_freq.size(), 2u); EXPECT_EQ(doc_with_freq[0].first, "id1"); EXPECT_EQ(doc_with_freq[0].second, 2u); EXPECT_EQ(doc_with_freq[1].first, "id2"); EXPECT_EQ(doc_with_freq[1].second, 1u); - doc_with_freq = search_->FindTermForTesting(base::UTF8ToUTF16("wi-fi")); + doc_with_freq = search_->FindTermForTesting(u"wi-fi"); EXPECT_TRUE(doc_with_freq.empty()); // "WiFi" doesn't exist because the index stores normalized word. - doc_with_freq = search_->FindTermForTesting(base::UTF8ToUTF16("WiFi")); + doc_with_freq = search_->FindTermForTesting(u"WiFi"); EXPECT_TRUE(doc_with_freq.empty()); } { // "this" does not exist in the index because it's a stopword - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("this")); + const TermOccurrence doc_with_freq = search_->FindTermForTesting(u"this"); EXPECT_TRUE(doc_with_freq.empty()); } } @@ -215,23 +212,21 @@ TEST_F(InvertedIndexSearchTest, Update) { { const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("bluetooth")); + search_->FindTermForTesting(u"bluetooth"); EXPECT_EQ(doc_with_freq.size(), 1u); EXPECT_EQ(doc_with_freq[0].first, "id1"); EXPECT_EQ(doc_with_freq[0].second, 1u); } { - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("wifi")); + const TermOccurrence doc_with_freq = search_->FindTermForTesting(u"wifi"); EXPECT_EQ(doc_with_freq.size(), 1u); EXPECT_EQ(doc_with_freq[0].first, "id2"); EXPECT_EQ(doc_with_freq[0].second, 1u); } { - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("google")); + const TermOccurrence doc_with_freq = search_->FindTermForTesting(u"google"); EXPECT_EQ(doc_with_freq.size(), 2u); EXPECT_EQ(doc_with_freq[0].first, "id1"); EXPECT_EQ(doc_with_freq[0].second, 2u); @@ -254,8 +249,7 @@ TEST_F(InvertedIndexSearchTest, Delete) { Delete(search_.get(), &task_environment_, {"id1"}, 1u); { - const TermOccurrence doc_with_freq = - search_->FindTermForTesting(base::UTF8ToUTF16("wifi")); + const TermOccurrence doc_with_freq = search_->FindTermForTesting(u"wifi"); EXPECT_EQ(doc_with_freq.size(), 1u); EXPECT_EQ(doc_with_freq[0].first, "id2"); EXPECT_EQ(doc_with_freq[0].second, 1u); diff --git a/chromeos/components/local_search_service/inverted_index_unittest.cc b/chromeos/components/local_search_service/inverted_index_unittest.cc index 574200bba01624..6ce90eb88c8bcb 100644 --- a/chromeos/components/local_search_service/inverted_index_unittest.cc +++ b/chromeos/components/local_search_service/inverted_index_unittest.cc @@ -42,7 +42,7 @@ class InvertedIndexTest : public ::testing::Test { index_.doc_length_ = std::unordered_map({{"doc1", 8}, {"doc2", 6}}); - index_.dictionary_[base::UTF8ToUTF16("A")] = PostingList( + index_.dictionary_[u"A"] = PostingList( {{"doc1", Posting({WeightedPosition(kDefaultWeight, Position("header", 1, 1)), WeightedPosition(kDefaultWeight, Position("header", 3, 1)), @@ -53,7 +53,7 @@ class InvertedIndexTest : public ::testing::Test { {WeightedPosition(kDefaultWeight, Position("header", 2, 1)), WeightedPosition(kDefaultWeight, Position("header", 4, 1))})}}); - index_.dictionary_[base::UTF8ToUTF16("B")] = PostingList( + index_.dictionary_[u"B"] = PostingList( {{"doc1", Posting( {WeightedPosition(kDefaultWeight, Position("header", 2, 1)), @@ -61,16 +61,16 @@ class InvertedIndexTest : public ::testing::Test { WeightedPosition(kDefaultWeight, Position("header", 6, 1)), WeightedPosition(kDefaultWeight, Position("body", 8, 1))})}}); - index_.dictionary_[base::UTF8ToUTF16("C")] = PostingList( + index_.dictionary_[u"C"] = PostingList( {{"doc2", Posting( {WeightedPosition(kDefaultWeight, Position("header", 1, 1)), WeightedPosition(kDefaultWeight, Position("body", 3, 1)), WeightedPosition(kDefaultWeight, Position("header", 5, 1)), WeightedPosition(kDefaultWeight, Position("body", 7, 1))})}}); - index_.terms_to_be_updated_.insert(base::UTF8ToUTF16("A")); - index_.terms_to_be_updated_.insert(base::UTF8ToUTF16("B")); - index_.terms_to_be_updated_.insert(base::UTF8ToUTF16("C")); + index_.terms_to_be_updated_.insert(u"A"); + index_.terms_to_be_updated_.insert(u"B"); + index_.terms_to_be_updated_.insert(u"C"); // Manually set |is_index_built_| below because the docs above were not // added to the index using the AddOrUpdate method. @@ -223,7 +223,7 @@ class InvertedIndexTest : public ::testing::Test { }; TEST_F(InvertedIndexTest, FindTermTest) { - PostingList result = FindTerm(base::UTF8ToUTF16("A")); + PostingList result = FindTerm(u"A"); ASSERT_EQ(result.size(), 2u); EXPECT_EQ(result["doc1"][0].weight, kDefaultWeight); EXPECT_EQ(result["doc1"][0].position.start, 1u); @@ -241,8 +241,8 @@ TEST_F(InvertedIndexTest, FindTermTest) { } TEST_F(InvertedIndexTest, AddNewDocumentTest) { - const std::u16string a_utf16(base::UTF8ToUTF16("A")); - const std::u16string d_utf16(base::UTF8ToUTF16("D")); + const std::u16string a_utf16(u"A"); + const std::u16string d_utf16(u"D"); AddDocuments({{"doc3", {{a_utf16, @@ -282,19 +282,19 @@ TEST_F(InvertedIndexTest, AddNewDocumentTest) { // Add multiple documents AddDocuments({{"doc4", - {{base::UTF8ToUTF16("E"), + {{u"E", {{kDefaultWeight, {"header", 1, 1}}, {kDefaultWeight / 2, {"body", 2, 1}}, {kDefaultWeight, {"header", 4, 1}}}}, - {base::UTF8ToUTF16("F"), + {u"F", {{kDefaultWeight, {"header", 3, 1}}, {kDefaultWeight / 2, {"body", 5, 1}}}}}}, {"doc5", - {{base::UTF8ToUTF16("E"), + {{u"E", {{kDefaultWeight, {"header", 1, 1}}, {kDefaultWeight / 2, {"body", 2, 1}}, {kDefaultWeight, {"header", 4, 1}}}}, - {base::UTF8ToUTF16("G"), + {u"G", {{kDefaultWeight, {"header", 3, 1}}, {kDefaultWeight / 2, {"body", 5, 1}}}}}}}); EXPECT_EQ(GetDocumentsToUpdate().size(), 0u); @@ -306,17 +306,17 @@ TEST_F(InvertedIndexTest, AddNewDocumentTest) { EXPECT_TRUE(UpdateDocumentsCompleted()); // Find "E" - result = FindTerm(base::UTF8ToUTF16("E")); + result = FindTerm(u"E"); ASSERT_EQ(result.size(), 2u); // Find "F" - result = FindTerm(base::UTF8ToUTF16("F")); + result = FindTerm(u"F"); ASSERT_EQ(result.size(), 1u); } TEST_F(InvertedIndexTest, AddNewDocumentTestCallback) { - const std::u16string a_utf16(base::UTF8ToUTF16("A")); - const std::u16string d_utf16(base::UTF8ToUTF16("D")); + const std::u16string a_utf16(u"A"); + const std::u16string d_utf16(u"D"); AddDocumentsAndCheck({{"doc3", {{a_utf16, @@ -349,34 +349,34 @@ TEST_F(InvertedIndexTest, AddNewDocumentTestCallback) { // Add multiple documents AddDocumentsAndCheck({{"doc4", - {{base::UTF8ToUTF16("E"), + {{u"E", {{kDefaultWeight, {"header", 1, 1}}, {kDefaultWeight / 2, {"body", 2, 1}}, {kDefaultWeight, {"header", 4, 1}}}}, - {base::UTF8ToUTF16("F"), + {u"F", {{kDefaultWeight, {"header", 3, 1}}, {kDefaultWeight / 2, {"body", 5, 1}}}}}}, {"doc5", - {{base::UTF8ToUTF16("E"), + {{u"E", {{kDefaultWeight, {"header", 1, 1}}, {kDefaultWeight / 2, {"body", 2, 1}}, {kDefaultWeight, {"header", 4, 1}}}}, - {base::UTF8ToUTF16("G"), + {u"G", {{kDefaultWeight, {"header", 3, 1}}, {kDefaultWeight / 2, {"body", 5, 1}}}}}}}); // Find "E" - result = FindTerm(base::UTF8ToUTF16("E")); + result = FindTerm(u"E"); ASSERT_EQ(result.size(), 2u); // Find "F" - result = FindTerm(base::UTF8ToUTF16("F")); + result = FindTerm(u"F"); ASSERT_EQ(result.size(), 1u); } TEST_F(InvertedIndexTest, ReplaceDocumentTest) { - const std::u16string a_utf16(base::UTF8ToUTF16("A")); - const std::u16string d_utf16(base::UTF8ToUTF16("D")); + const std::u16string a_utf16(u"A"); + const std::u16string d_utf16(u"D"); AddDocuments({{"doc1", {{a_utf16, @@ -404,7 +404,7 @@ TEST_F(InvertedIndexTest, ReplaceDocumentTest) { EXPECT_EQ(result["doc1"][2].position.start, 4u); // Find "B" - result = FindTerm(base::UTF8ToUTF16("B")); + result = FindTerm(u"B"); ASSERT_EQ(result.size(), 0u); // Find "D" @@ -417,8 +417,8 @@ TEST_F(InvertedIndexTest, ReplaceDocumentTest) { } TEST_F(InvertedIndexTest, ReplaceDocumentTestCallback) { - const std::u16string a_utf16(base::UTF8ToUTF16("A")); - const std::u16string d_utf16(base::UTF8ToUTF16("D")); + const std::u16string a_utf16(u"A"); + const std::u16string d_utf16(u"D"); AddDocumentsAndCheck({{"doc1", {{a_utf16, @@ -443,7 +443,7 @@ TEST_F(InvertedIndexTest, ReplaceDocumentTestCallback) { EXPECT_EQ(result["doc1"][2].position.start, 4u); // Find "B" - result = FindTerm(base::UTF8ToUTF16("B")); + result = FindTerm(u"B"); ASSERT_EQ(result.size(), 0u); // Find "D" @@ -468,7 +468,7 @@ TEST_F(InvertedIndexTest, RemoveDocumentTest) { EXPECT_EQ(GetDocLength()["doc2"], 6u); // Find "A" - PostingList result = FindTerm(base::UTF8ToUTF16("A")); + PostingList result = FindTerm(u"A"); ASSERT_EQ(result.size(), 1u); EXPECT_EQ(result["doc2"][0].weight, kDefaultWeight); EXPECT_EQ(result["doc2"][0].position.start, 2u); @@ -476,11 +476,11 @@ TEST_F(InvertedIndexTest, RemoveDocumentTest) { EXPECT_EQ(result["doc2"][1].position.start, 4u); // Find "B" - result = FindTerm(base::UTF8ToUTF16("B")); + result = FindTerm(u"B"); ASSERT_EQ(result.size(), 0u); // Find "C" - result = FindTerm(base::UTF8ToUTF16("C")); + result = FindTerm(u"C"); ASSERT_EQ(result.size(), 1u); EXPECT_EQ(result["doc2"][0].weight, kDefaultWeight); EXPECT_EQ(result["doc2"][0].position.start, 1u); @@ -510,7 +510,7 @@ TEST_F(InvertedIndexTest, RemoveDocumentTestCallback) { EXPECT_EQ(GetDocLength()["doc2"], 6u); // Find "A" - PostingList result = FindTerm(base::UTF8ToUTF16("A")); + PostingList result = FindTerm(u"A"); ASSERT_EQ(result.size(), 1u); EXPECT_EQ(result["doc2"][0].weight, kDefaultWeight); EXPECT_EQ(result["doc2"][0].position.start, 2u); @@ -518,11 +518,11 @@ TEST_F(InvertedIndexTest, RemoveDocumentTestCallback) { EXPECT_EQ(result["doc2"][1].position.start, 4u); // Find "B" - result = FindTerm(base::UTF8ToUTF16("B")); + result = FindTerm(u"B"); ASSERT_EQ(result.size(), 0u); // Find "C" - result = FindTerm(base::UTF8ToUTF16("C")); + result = FindTerm(u"C"); ASSERT_EQ(result.size(), 1u); EXPECT_EQ(result["doc2"][0].weight, kDefaultWeight); EXPECT_EQ(result["doc2"][0].position.start, 1u); @@ -547,21 +547,21 @@ TEST_F(InvertedIndexTest, TfidfFromZeroTest) { Wait(); EXPECT_TRUE(BuildIndexCompleted()); - std::vector results = GetTfidf(base::UTF8ToUTF16("A")); + std::vector results = GetTfidf(u"A"); EXPECT_THAT(GetScoresFromTfidfResult(results), testing::UnorderedElementsAre(0.5, 0.33)); - results = GetTfidf(base::UTF8ToUTF16("B")); + results = GetTfidf(u"B"); EXPECT_EQ(results.size(), 1u); EXPECT_THAT(GetScoresFromTfidfResult(results), testing::UnorderedElementsAre(0.7)); - results = GetTfidf(base::UTF8ToUTF16("C")); + results = GetTfidf(u"C"); EXPECT_EQ(results.size(), 1u); EXPECT_THAT(GetScoresFromTfidfResult(results), testing::UnorderedElementsAre(0.94)); - results = GetTfidf(base::UTF8ToUTF16("D")); + results = GetTfidf(u"D"); EXPECT_EQ(results.size(), 0u); } @@ -576,11 +576,11 @@ TEST_F(InvertedIndexTest, UpdateIndexTest) { // Replaces "doc1" AddDocuments({{"doc1", - {{base::UTF8ToUTF16("A"), + {{u"A", {{kDefaultWeight / 2, {"header", 1, 1}}, {kDefaultWeight / 4, {"body", 2, 1}}, {kDefaultWeight / 2, {"header", 4, 1}}}}, - {base::UTF8ToUTF16("D"), + {u"D", {{kDefaultWeight, {"header", 3, 1}}, {kDefaultWeight, {"body", 5, 1}}}}}}}); EXPECT_EQ(GetDocumentsToUpdate().size(), 0u); @@ -594,7 +594,7 @@ TEST_F(InvertedIndexTest, UpdateIndexTest) { EXPECT_EQ(GetTfidfCache().size(), 3u); - std::vector results = GetTfidf(base::UTF8ToUTF16("A")); + std::vector results = GetTfidf(u"A"); const double expected_tfidf_A_doc1 = std::roundf( TfIdfScore( @@ -617,11 +617,11 @@ TEST_F(InvertedIndexTest, UpdateIndexTest) { testing::UnorderedElementsAre(expected_tfidf_A_doc1, expected_tfidf_A_doc2)); - results = GetTfidf(base::UTF8ToUTF16("B")); + results = GetTfidf(u"B"); EXPECT_THAT(GetScoresFromTfidfResult(results), testing::UnorderedElementsAre()); - results = GetTfidf(base::UTF8ToUTF16("C")); + results = GetTfidf(u"C"); const double expected_tfidf_C_doc2 = std::roundf( TfIdfScore(/*num_docs=*/2, @@ -633,7 +633,7 @@ TEST_F(InvertedIndexTest, UpdateIndexTest) { EXPECT_THAT(GetScoresFromTfidfResult(results), testing::UnorderedElementsAre(expected_tfidf_C_doc2)); - results = GetTfidf(base::UTF8ToUTF16("D")); + results = GetTfidf(u"D"); const double expected_tfidf_D_doc1 = std::roundf( TfIdfScore(/*num_docs=*/2, @@ -653,11 +653,11 @@ TEST_F(InvertedIndexTest, UpdateIndexTestCallback) { // Replaces "doc1" AddDocumentsAndCheck({{"doc1", - {{base::UTF8ToUTF16("A"), + {{u"A", {{kDefaultWeight / 2, {"header", 1, 1}}, {kDefaultWeight / 4, {"body", 2, 1}}, {kDefaultWeight / 2, {"header", 4, 1}}}}, - {base::UTF8ToUTF16("D"), + {u"D", {{kDefaultWeight, {"header", 3, 1}}, {kDefaultWeight, {"body", 5, 1}}}}}}}); @@ -666,7 +666,7 @@ TEST_F(InvertedIndexTest, UpdateIndexTestCallback) { EXPECT_EQ(GetTfidfCache().size(), 3u); - std::vector results = GetTfidf(base::UTF8ToUTF16("A")); + std::vector results = GetTfidf(u"A"); const double expected_tfidf_A_doc1 = std::roundf( TfIdfScore( @@ -689,11 +689,11 @@ TEST_F(InvertedIndexTest, UpdateIndexTestCallback) { testing::UnorderedElementsAre(expected_tfidf_A_doc1, expected_tfidf_A_doc2)); - results = GetTfidf(base::UTF8ToUTF16("B")); + results = GetTfidf(u"B"); EXPECT_THAT(GetScoresFromTfidfResult(results), testing::UnorderedElementsAre()); - results = GetTfidf(base::UTF8ToUTF16("C")); + results = GetTfidf(u"C"); const double expected_tfidf_C_doc2 = std::roundf( TfIdfScore(/*num_docs=*/2, @@ -705,7 +705,7 @@ TEST_F(InvertedIndexTest, UpdateIndexTestCallback) { EXPECT_THAT(GetScoresFromTfidfResult(results), testing::UnorderedElementsAre(expected_tfidf_C_doc2)); - results = GetTfidf(base::UTF8ToUTF16("D")); + results = GetTfidf(u"D"); const double expected_tfidf_D_doc1 = std::roundf( TfIdfScore(/*num_docs=*/2, @@ -725,11 +725,11 @@ TEST_F(InvertedIndexTest, UpdateDocumentsTest) { // Replaces "doc1" and remove "doc2" UpdateDocumentsAndCheck({{"doc1", - {{base::UTF8ToUTF16("A"), + {{u"A", {{kDefaultWeight / 2, {"header", 1, 1}}, {kDefaultWeight / 4, {"body", 2, 1}}, {kDefaultWeight / 2, {"header", 4, 1}}}}, - {base::UTF8ToUTF16("D"), + {u"D", {{kDefaultWeight, {"header", 3, 1}}, {kDefaultWeight, {"body", 5, 1}}}}}}, {"doc2", {}}}, @@ -738,7 +738,7 @@ TEST_F(InvertedIndexTest, UpdateDocumentsTest) { EXPECT_EQ(GetTfidfCache().size(), 2u); - std::vector results = GetTfidf(base::UTF8ToUTF16("C")); + std::vector results = GetTfidf(u"C"); EXPECT_EQ(results.size(), 0u); } @@ -752,8 +752,8 @@ TEST_F(InvertedIndexTest, ClearInvertedIndexTest) { EXPECT_EQ(GetTfidfCache().size(), 3u); // Add a document and clear the index simultaneously. - const std::u16string a_utf16(base::UTF8ToUTF16("A")); - const std::u16string d_utf16(base::UTF8ToUTF16("D")); + const std::u16string a_utf16(u"A"); + const std::u16string d_utf16(u"D"); AddDocuments({{"doc3", {{a_utf16, {{kDefaultWeight, {"header", 1, 1}}, @@ -778,8 +778,8 @@ TEST_F(InvertedIndexTest, ClearInvertedIndexTestCallback) { EXPECT_EQ(GetTfidfCache().size(), 3u); // Add a document and clear the index simultaneously. - const std::u16string a_utf16(base::UTF8ToUTF16("A")); - const std::u16string d_utf16(base::UTF8ToUTF16("D")); + const std::u16string a_utf16(u"A"); + const std::u16string d_utf16(u"D"); AddDocumentsAndCheck({{"doc3", {{a_utf16, {{kDefaultWeight, {"header", 1, 1}}, @@ -800,10 +800,10 @@ TEST_F(InvertedIndexTest, ClearInvertedIndexTestCallback) { TEST_F(InvertedIndexTest, FindMatchingDocumentsApproximatelyTest) { const double prefix_threshold = 1.0; const double block_threshold = 1.0; - const std::u16string a_utf16(base::UTF8ToUTF16("A")); - const std::u16string b_utf16(base::UTF8ToUTF16("B")); - const std::u16string c_utf16(base::UTF8ToUTF16("C")); - const std::u16string d_utf16(base::UTF8ToUTF16("D")); + const std::u16string a_utf16(u"A"); + const std::u16string b_utf16(u"B"); + const std::u16string c_utf16(u"C"); + const std::u16string d_utf16(u"D"); // Replace doc1, same occurrences, just different weights. AddDocumentsAndCheck({{"doc1", diff --git a/chromeos/components/local_search_service/public/mojom/types_mojom_traits_unittest.cc b/chromeos/components/local_search_service/public/mojom/types_mojom_traits_unittest.cc index 5c95db80c31cc1..57c4dd3f8e9e03 100644 --- a/chromeos/components/local_search_service/public/mojom/types_mojom_traits_unittest.cc +++ b/chromeos/components/local_search_service/public/mojom/types_mojom_traits_unittest.cc @@ -13,7 +13,7 @@ namespace chromeos { namespace local_search_service { TEST(LocalSearchMojomTraitsTest, ContentTraits) { - Content input("id", base::UTF8ToUTF16("content"), 0.3); + Content input("id", u"content", 0.3); Content output; ASSERT_TRUE( @@ -24,9 +24,8 @@ TEST(LocalSearchMojomTraitsTest, ContentTraits) { } TEST(LocalSearchMojomTraitsTest, DataTraits) { - std::vector contents{ - Content("id1", base::UTF8ToUTF16("contents1"), 0.1), - Content("id2", base::UTF8ToUTF16("contents2"), 0.2)}; + std::vector contents{Content("id1", u"contents1", 0.1), + Content("id2", u"contents2", 0.2)}; { // Empty locale. diff --git a/chromeos/components/local_search_service/search_utils_unittest.cc b/chromeos/components/local_search_service/search_utils_unittest.cc index c046efee131e99..5104425d3c9369 100644 --- a/chromeos/components/local_search_service/search_utils_unittest.cc +++ b/chromeos/components/local_search_service/search_utils_unittest.cc @@ -13,67 +13,50 @@ namespace local_search_service { TEST(SearchUtilsTest, PrefixMatch) { // Query is a prefix of text, score is the ratio. - EXPECT_NEAR(ExactPrefixMatchScore(base::UTF8ToUTF16("musi"), - base::UTF8ToUTF16("music")), - 0.8, 0.001); + EXPECT_NEAR(ExactPrefixMatchScore(u"musi", u"music"), 0.8, 0.001); // Text is a prefix of query, score is 0. - EXPECT_EQ(ExactPrefixMatchScore(base::UTF8ToUTF16("music"), - base::UTF8ToUTF16("musi")), - 0); + EXPECT_EQ(ExactPrefixMatchScore(u"music", u"musi"), 0); // Case matters. - EXPECT_EQ(ExactPrefixMatchScore(base::UTF8ToUTF16("musi"), - base::UTF8ToUTF16("Music")), - 0); + EXPECT_EQ(ExactPrefixMatchScore(u"musi", u"Music"), 0); // Query isn't a prefix. - EXPECT_EQ(ExactPrefixMatchScore(base::UTF8ToUTF16("wide"), - base::UTF8ToUTF16("wifi")), - 0); + EXPECT_EQ(ExactPrefixMatchScore(u"wide", u"wifi"), 0); // Text is empty. - EXPECT_EQ( - ExactPrefixMatchScore(base::UTF8ToUTF16("music"), base::UTF8ToUTF16("")), - 0); + EXPECT_EQ(ExactPrefixMatchScore(u"music", u""), 0); // Query is empty. - EXPECT_EQ( - ExactPrefixMatchScore(base::UTF8ToUTF16(""), base::UTF8ToUTF16("abc")), - 0); + EXPECT_EQ(ExactPrefixMatchScore(u"", u"abc"), 0); } TEST(SearchUtilsTest, BlockMatch) { - EXPECT_NEAR( - BlockMatchScore(base::UTF8ToUTF16("wifi"), base::UTF8ToUTF16("wi-fi")), - 0.804, 0.001); + EXPECT_NEAR(BlockMatchScore(u"wifi", u"wi-fi"), 0.804, 0.001); // Case matters. - EXPECT_NEAR( - BlockMatchScore(base::UTF8ToUTF16("wifi"), base::UTF8ToUTF16("Wi-Fi")), - 0.402, 0.001); + EXPECT_NEAR(BlockMatchScore(u"wifi", u"Wi-Fi"), 0.402, 0.001); } TEST(SearchUtilsTest, IsRelevantApproximately) { // Relevant because prefix requirement is met. EXPECT_TRUE(IsRelevantApproximately( - base::UTF8ToUTF16("wifi"), base::UTF8ToUTF16("wi-fi"), - 0 /* prefix_threshold */, 0.99 /* block_threshold */)); + u"wifi", u"wi-fi", 0 /* prefix_threshold */, 0.99 /* block_threshold */)); // Relevant because prefix requirement is met. - EXPECT_TRUE(IsRelevantApproximately( - base::UTF8ToUTF16("musi"), base::UTF8ToUTF16("music"), - 0.8 /* prefix_threshold */, 0.999 /* block_threshold */)); + EXPECT_TRUE(IsRelevantApproximately(u"musi", u"music", + 0.8 /* prefix_threshold */, + 0.999 /* block_threshold */)); // Relevant because block match requirement is met. - EXPECT_TRUE(IsRelevantApproximately( - base::UTF8ToUTF16("wifi"), base::UTF8ToUTF16("wi-fi"), - 0.2 /* prefix_threshold */, 0.001 /* block_threshold */)); + EXPECT_TRUE(IsRelevantApproximately(u"wifi", u"wi-fi", + 0.2 /* prefix_threshold */, + 0.001 /* block_threshold */)); // Neither prefix nor block match requirement is met. - EXPECT_FALSE(IsRelevantApproximately( - base::UTF8ToUTF16("wifi"), base::UTF8ToUTF16("wi-fi"), - 0.2 /* prefix_threshold */, 0.99 /* block_threshold */)); + EXPECT_FALSE(IsRelevantApproximately(u"wifi", u"wi-fi", + 0.2 /* prefix_threshold */, + 0.99 /* block_threshold */)); } } // namespace local_search_service diff --git a/chromeos/components/phonehub/message_sender_unittest.cc b/chromeos/components/phonehub/message_sender_unittest.cc index 18ccce22422028..9136cd0ea44202 100644 --- a/chromeos/components/phonehub/message_sender_unittest.cc +++ b/chromeos/components/phonehub/message_sender_unittest.cc @@ -104,7 +104,7 @@ TEST_F(MessageSenderImplTest, SendDismissNotificationRequest) { TEST_F(MessageSenderImplTest, SendNotificationInlineReplyRequest) { const int expected_id = 24; - const std::u16string expected_reply(base::UTF8ToUTF16("Test message")); + const std::u16string expected_reply(u"Test message"); proto::NotificationInlineReplyRequest request; request.set_notification_id(expected_id); diff --git a/chromeos/components/phonehub/mutable_phone_model_unittest.cc b/chromeos/components/phonehub/mutable_phone_model_unittest.cc index 24bdeda6099d9d..67e88de66a2efb 100644 --- a/chromeos/components/phonehub/mutable_phone_model_unittest.cc +++ b/chromeos/components/phonehub/mutable_phone_model_unittest.cc @@ -50,7 +50,7 @@ class MutablePhoneModelTest : public testing::Test { }; TEST_F(MutablePhoneModelTest, PhoneName) { - const std::u16string fake_phone_name = base::UTF8ToUTF16("Phone name"); + const std::u16string fake_phone_name = u"Phone name"; // Set the phone name to be null (the default value); observers should // not be notified, since this is not a change. diff --git a/chromeos/components/phonehub/notification_manager_impl_unittest.cc b/chromeos/components/phonehub/notification_manager_impl_unittest.cc index 22cb39c6247abf..50f346a01a5831 100644 --- a/chromeos/components/phonehub/notification_manager_impl_unittest.cc +++ b/chromeos/components/phonehub/notification_manager_impl_unittest.cc @@ -233,7 +233,7 @@ TEST_F(NotificationManagerImplTest, SendInlineReply) { EXPECT_EQ(NotificationState::kAdded, GetNotificationState(expected_id1)); // Simulate sending an inline reply to a notification. - const std::u16string& expected_reply(base::UTF8ToUTF16("test reply")); + const std::u16string& expected_reply(u"test reply"); manager().SendInlineReply(expected_id1, expected_reply); EXPECT_EQ(1u, fake_user_action_recorder_.num_notification_replies()); EXPECT_EQ(1u, GetNumNotifications()); diff --git a/chromeos/components/phonehub/phone_status_processor_unittest.cc b/chromeos/components/phonehub/phone_status_processor_unittest.cc index b79a82aa3c6901..fa8341e70cc52d 100644 --- a/chromeos/components/phonehub/phone_status_processor_unittest.cc +++ b/chromeos/components/phonehub/phone_status_processor_unittest.cc @@ -187,7 +187,7 @@ TEST_F(PhoneStatusProcessorTest, PhoneStatusSnapshotUpdate) { EXPECT_EQ(PhoneStatusModel::ChargingState::kChargingAc, phone_status_model->charging_state()); EXPECT_EQ(24u, phone_status_model->battery_percentage()); - EXPECT_EQ(base::UTF8ToUTF16("google"), + EXPECT_EQ(u"google", phone_status_model->mobile_connection_metadata()->mobile_provider); EXPECT_EQ(PhoneStatusModel::SignalStrength::kFourBars, phone_status_model->mobile_connection_metadata()->signal_strength); @@ -257,7 +257,7 @@ TEST_F(PhoneStatusProcessorTest, PhoneStatusUpdate) { EXPECT_EQ(PhoneStatusModel::ChargingState::kChargingAc, phone_status_model->charging_state()); EXPECT_EQ(24u, phone_status_model->battery_percentage()); - EXPECT_EQ(base::UTF8ToUTF16("google"), + EXPECT_EQ(u"google", phone_status_model->mobile_connection_metadata()->mobile_provider); EXPECT_EQ(PhoneStatusModel::SignalStrength::kFourBars, phone_status_model->mobile_connection_metadata()->signal_strength); @@ -288,7 +288,7 @@ TEST_F(PhoneStatusProcessorTest, PhoneStatusUpdate) { EXPECT_EQ(PhoneStatusModel::ChargingState::kChargingAc, phone_status_model->charging_state()); EXPECT_EQ(24u, phone_status_model->battery_percentage()); - EXPECT_EQ(base::UTF8ToUTF16("google"), + EXPECT_EQ(u"google", phone_status_model->mobile_connection_metadata()->mobile_provider); EXPECT_EQ(PhoneStatusModel::SignalStrength::kFourBars, phone_status_model->mobile_connection_metadata()->signal_strength); @@ -332,7 +332,7 @@ TEST_F(PhoneStatusProcessorTest, PhoneName) { fake_multidevice_setup_client_->SetHostStatusWithDevice( std::make_pair(HostStatus::kHostVerified, kFakePhoneA)); - EXPECT_EQ(base::UTF8ToUTF16("Phone A"), mutable_phone_model_->phone_name()); + EXPECT_EQ(u"Phone A", mutable_phone_model_->phone_name()); } TEST_F(PhoneStatusProcessorTest, NotificationAccess) { diff --git a/chromeos/components/string_matching/fuzzy_tokenized_string_match.cc b/chromeos/components/string_matching/fuzzy_tokenized_string_match.cc index c9e32d0de55beb..7a9f002f6c2555 100644 --- a/chromeos/components/string_matching/fuzzy_tokenized_string_match.cc +++ b/chromeos/components/string_matching/fuzzy_tokenized_string_match.cc @@ -64,19 +64,17 @@ double FuzzyTokenizedStringMatch::TokenSetRatio( query_token.end(), std::back_inserter(text_diff_query)); const std::u16string intersection_string = - base::JoinString(intersection, base::UTF8ToUTF16(" ")); + base::JoinString(intersection, u" "); const std::u16string query_rewritten = intersection.empty() - ? base::JoinString(query_diff_text, base::UTF8ToUTF16(" ")) - : base::StrCat( - {intersection_string, base::UTF8ToUTF16(" "), - base::JoinString(query_diff_text, base::UTF8ToUTF16(" "))}); + ? base::JoinString(query_diff_text, u" ") + : base::StrCat({intersection_string, u" ", + base::JoinString(query_diff_text, u" ")}); const std::u16string text_rewritten = intersection.empty() - ? base::JoinString(text_diff_query, base::UTF8ToUTF16(" ")) - : base::StrCat( - {intersection_string, base::UTF8ToUTF16(" "), - base::JoinString(text_diff_query, base::UTF8ToUTF16(" "))}); + ? base::JoinString(text_diff_query, u" ") + : base::StrCat({intersection_string, u" ", + base::JoinString(text_diff_query, u" ")}); if (partial) { return std::max({PartialRatio(intersection_string, query_rewritten, @@ -110,9 +108,9 @@ double FuzzyTokenizedStringMatch::TokenSortRatio( bool use_edit_distance, double num_matching_blocks_penalty) { const std::u16string query_sorted = - base::JoinString(ProcessAndSort(query), base::UTF8ToUTF16(" ")); + base::JoinString(ProcessAndSort(query), u" "); const std::u16string text_sorted = - base::JoinString(ProcessAndSort(text), base::UTF8ToUTF16(" ")); + base::JoinString(ProcessAndSort(text), u" "); if (partial) { return PartialRatio(query_sorted, text_sorted, partial_match_penalty_rate, @@ -155,8 +153,7 @@ double FuzzyTokenizedStringMatch::PartialRatio( // Penalizes the match if it is not close to the beginning of a token. int current = long_start - 1; while (current >= 0 && - !base::EqualsCaseInsensitiveASCII(longer.substr(current, 1), - base::UTF8ToUTF16(" "))) { + !base::EqualsCaseInsensitiveASCII(longer.substr(current, 1), u" ")) { current--; } const double penalty = @@ -186,10 +183,8 @@ double FuzzyTokenizedStringMatch::WeightedRatio( const double unbase_scale = 0.95; // Since query.text() and text.text() is not normalized, we use query.tokens() // and text.tokens() instead. - const std::u16string query_normalized( - base::JoinString(query.tokens(), base::UTF8ToUTF16(" "))); - const std::u16string text_normalized( - base::JoinString(text.tokens(), base::UTF8ToUTF16(" "))); + const std::u16string query_normalized(base::JoinString(query.tokens(), u" ")); + const std::u16string text_normalized(base::JoinString(text.tokens(), u" ")); double weighted_ratio = SequenceMatcher(query_normalized, text_normalized, use_edit_distance, num_matching_blocks_penalty) diff --git a/chromeos/components/string_matching/fuzzy_tokenized_string_match_unittest.cc b/chromeos/components/string_matching/fuzzy_tokenized_string_match_unittest.cc index fb8b42456e97e0..38e754958f6df7 100644 --- a/chromeos/components/string_matching/fuzzy_tokenized_string_match_unittest.cc +++ b/chromeos/components/string_matching/fuzzy_tokenized_string_match_unittest.cc @@ -23,19 +23,15 @@ class FuzzyTokenizedStringMatchTest : public testing::Test {}; // TODO(crbug.com/1018613): update the tests once params are consolidated. TEST_F(FuzzyTokenizedStringMatchTest, PartialRatioTest) { FuzzyTokenizedStringMatch match; - EXPECT_NEAR(match.PartialRatio(base::UTF8ToUTF16("abcde"), - base::UTF8ToUTF16("ababcXXXbcdeY"), + EXPECT_NEAR(match.PartialRatio(u"abcde", u"ababcXXXbcdeY", kPartialMatchPenaltyRate, false, 0.0), 0.6, 0.01); - EXPECT_NEAR(match.PartialRatio(base::UTF8ToUTF16("big string"), - base::UTF8ToUTF16("strength"), + EXPECT_NEAR(match.PartialRatio(u"big string", u"strength", kPartialMatchPenaltyRate, false, 0.0), 0.71, 0.01); - EXPECT_EQ(match.PartialRatio(base::UTF8ToUTF16("abc"), base::UTF8ToUTF16(""), - kPartialMatchPenaltyRate, false, 0.0), - 0); - EXPECT_NEAR(match.PartialRatio(base::UTF8ToUTF16("different in order"), - base::UTF8ToUTF16("order text"), + EXPECT_EQ( + match.PartialRatio(u"abc", u"", kPartialMatchPenaltyRate, false, 0.0), 0); + EXPECT_NEAR(match.PartialRatio(u"different in order", u"order text", kPartialMatchPenaltyRate, false, 0.0), 0.67, 0.01); } @@ -43,8 +39,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, PartialRatioTest) { TEST_F(FuzzyTokenizedStringMatchTest, TokenSetRatioTest) { FuzzyTokenizedStringMatch match; { - std::u16string query(base::UTF8ToUTF16("order different in")); - std::u16string text(base::UTF8ToUTF16("text order")); + std::u16string query(u"order different in"); + std::u16string text(u"text order"); EXPECT_EQ(match.TokenSetRatio(TokenizedString(query), TokenizedString(text), true, kPartialMatchPenaltyRate, false, 0.0), 1); @@ -54,9 +50,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, TokenSetRatioTest) { 0.67, 0.01); } { - std::u16string query(base::UTF8ToUTF16("short text")); - std::u16string text( - base::UTF8ToUTF16("this text is really really really long")); + std::u16string query(u"short text"); + std::u16string text(u"this text is really really really long"); EXPECT_EQ(match.TokenSetRatio(TokenizedString(query), TokenizedString(text), true, kPartialMatchPenaltyRate, false, 0.0), 1); @@ -66,8 +61,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, TokenSetRatioTest) { 0.57, 0.01); } { - std::u16string query(base::UTF8ToUTF16("common string")); - std::u16string text(base::UTF8ToUTF16("nothing is shared")); + std::u16string query(u"common string"); + std::u16string text(u"nothing is shared"); EXPECT_NEAR( match.TokenSetRatio(TokenizedString(query), TokenizedString(text), true, kPartialMatchPenaltyRate, false, 0.0), @@ -78,9 +73,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, TokenSetRatioTest) { 0.33, 0.01); } { - std::u16string query( - base::UTF8ToUTF16("token shared token same shared same")); - std::u16string text(base::UTF8ToUTF16("token shared token text text long")); + std::u16string query(u"token shared token same shared same"); + std::u16string text(u"token shared token text text long"); EXPECT_EQ(match.TokenSetRatio(TokenizedString(query), TokenizedString(text), true, kPartialMatchPenaltyRate, false, 0.0), 1); @@ -94,8 +88,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, TokenSetRatioTest) { TEST_F(FuzzyTokenizedStringMatchTest, TokenSortRatioTest) { FuzzyTokenizedStringMatch match; { - std::u16string query(base::UTF8ToUTF16("order different in")); - std::u16string text(base::UTF8ToUTF16("text order")); + std::u16string query(u"order different in"); + std::u16string text(u"text order"); EXPECT_NEAR( match.TokenSortRatio(TokenizedString(query), TokenizedString(text), true, kPartialMatchPenaltyRate, false, 0.0), @@ -106,9 +100,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, TokenSortRatioTest) { 0.36, 0.01); } { - std::u16string query(base::UTF8ToUTF16("short text")); - std::u16string text( - base::UTF8ToUTF16("this text is really really really long")); + std::u16string query(u"short text"); + std::u16string text(u"this text is really really really long"); EXPECT_EQ( match.TokenSortRatio(TokenizedString(query), TokenizedString(text), true, kPartialMatchPenaltyRate, false, 0.0), @@ -119,8 +112,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, TokenSortRatioTest) { 0.33, 0.01); } { - std::u16string query(base::UTF8ToUTF16("common string")); - std::u16string text(base::UTF8ToUTF16("nothing is shared")); + std::u16string query(u"common string"); + std::u16string text(u"nothing is shared"); EXPECT_NEAR( match.TokenSortRatio(TokenizedString(query), TokenizedString(text), true, kPartialMatchPenaltyRate, false, 0.0), @@ -135,31 +128,31 @@ TEST_F(FuzzyTokenizedStringMatchTest, TokenSortRatioTest) { TEST_F(FuzzyTokenizedStringMatchTest, WeightedRatio) { FuzzyTokenizedStringMatch match; { - std::u16string query(base::UTF8ToUTF16("anonymous")); - std::u16string text(base::UTF8ToUTF16("famous")); + std::u16string query(u"anonymous"); + std::u16string text(u"famous"); EXPECT_NEAR( match.WeightedRatio(TokenizedString(query), TokenizedString(text), kPartialMatchPenaltyRate, false, 0.0), 0.67, 0.01); } { - std::u16string query(base::UTF8ToUTF16("Clash.of.clan")); - std::u16string text(base::UTF8ToUTF16("ClashOfTitan")); + std::u16string query(u"Clash.of.clan"); + std::u16string text(u"ClashOfTitan"); EXPECT_NEAR( match.WeightedRatio(TokenizedString(query), TokenizedString(text), kPartialMatchPenaltyRate, false, 0.0), 0.81, 0.01); } { - std::u16string query(base::UTF8ToUTF16("final fantasy")); - std::u16string text(base::UTF8ToUTF16("finalfantasy")); + std::u16string query(u"final fantasy"); + std::u16string text(u"finalfantasy"); EXPECT_NEAR( match.WeightedRatio(TokenizedString(query), TokenizedString(text), kPartialMatchPenaltyRate, false, 0.0), 0.96, 0.01); } { - std::u16string query(base::UTF8ToUTF16("short text!!!")); + std::u16string query(u"short text!!!"); std::u16string text( base::UTF8ToUTF16("this sentence is much much much much much longer " "than the text before")); @@ -172,57 +165,57 @@ TEST_F(FuzzyTokenizedStringMatchTest, WeightedRatio) { TEST_F(FuzzyTokenizedStringMatchTest, PrefixMatcherTest) { { - std::u16string query(base::UTF8ToUTF16("clas")); - std::u16string text(base::UTF8ToUTF16("Clash of Clan")); + std::u16string query(u"clas"); + std::u16string text(u"Clash of Clan"); EXPECT_NEAR(FuzzyTokenizedStringMatch::PrefixMatcher(TokenizedString(query), TokenizedString(text)), 0.94, 0.01); } { - std::u16string query(base::UTF8ToUTF16("clash clan")); - std::u16string text(base::UTF8ToUTF16("Clash of Clan")); + std::u16string query(u"clash clan"); + std::u16string text(u"Clash of Clan"); EXPECT_EQ(FuzzyTokenizedStringMatch::PrefixMatcher(TokenizedString(query), TokenizedString(text)), 0.0); } { - std::u16string query(base::UTF8ToUTF16("c o c")); - std::u16string text(base::UTF8ToUTF16("Clash of Clan")); + std::u16string query(u"c o c"); + std::u16string text(u"Clash of Clan"); EXPECT_NEAR(FuzzyTokenizedStringMatch::PrefixMatcher(TokenizedString(query), TokenizedString(text)), 0.84, 0.01); } { - std::u16string query(base::UTF8ToUTF16("wifi")); - std::u16string text(base::UTF8ToUTF16("wi-fi")); + std::u16string query(u"wifi"); + std::u16string text(u"wi-fi"); EXPECT_NEAR(FuzzyTokenizedStringMatch::PrefixMatcher(TokenizedString(query), TokenizedString(text)), 0.91, 0.01); } { - std::u16string query(base::UTF8ToUTF16("clam")); - std::u16string text(base::UTF8ToUTF16("Clash of Clan")); + std::u16string query(u"clam"); + std::u16string text(u"Clash of Clan"); EXPECT_EQ(FuzzyTokenizedStringMatch::PrefixMatcher(TokenizedString(query), TokenizedString(text)), 0.0); } { - std::u16string query(base::UTF8ToUTF16("rp")); - std::u16string text(base::UTF8ToUTF16("Remove Google Play Store")); + std::u16string query(u"rp"); + std::u16string text(u"Remove Google Play Store"); EXPECT_EQ(FuzzyTokenizedStringMatch::PrefixMatcher(TokenizedString(query), TokenizedString(text)), 0.0); } { - std::u16string query(base::UTF8ToUTF16("remove play")); - std::u16string text(base::UTF8ToUTF16("Remove Google Play Store")); + std::u16string query(u"remove play"); + std::u16string text(u"Remove Google Play Store"); EXPECT_EQ(FuzzyTokenizedStringMatch::PrefixMatcher(TokenizedString(query), TokenizedString(text)), 0.0); } { - std::u16string query(base::UTF8ToUTF16("google play")); - std::u16string text(base::UTF8ToUTF16("Remove Google Play Store")); + std::u16string query(u"google play"); + std::u16string text(u"Remove Google Play Store"); EXPECT_NEAR(FuzzyTokenizedStringMatch::PrefixMatcher(TokenizedString(query), TokenizedString(text)), 0.99, 0.01); @@ -232,22 +225,22 @@ TEST_F(FuzzyTokenizedStringMatchTest, PrefixMatcherTest) { TEST_F(FuzzyTokenizedStringMatchTest, ParamThresholdTest1) { FuzzyTokenizedStringMatch match; { - std::u16string query(base::UTF8ToUTF16("anonymous")); - std::u16string text(base::UTF8ToUTF16("famous")); + std::u16string query(u"anonymous"); + std::u16string text(u"famous"); EXPECT_FALSE(match.IsRelevant(TokenizedString(query), TokenizedString(text), 0.4, false, true, false, kPartialMatchPenaltyRate, 0.0)); } { - std::u16string query(base::UTF8ToUTF16("CC")); - std::u16string text(base::UTF8ToUTF16("Clash Of Clan")); + std::u16string query(u"CC"); + std::u16string text(u"Clash Of Clan"); EXPECT_FALSE(match.IsRelevant(TokenizedString(query), TokenizedString(text), 0.25, false, true, false, kPartialMatchPenaltyRate, 0.0)); } { - std::u16string query(base::UTF8ToUTF16("Clash.of.clan")); - std::u16string text(base::UTF8ToUTF16("ClashOfTitan")); + std::u16string query(u"Clash.of.clan"); + std::u16string text(u"ClashOfTitan"); EXPECT_TRUE(match.IsRelevant(TokenizedString(query), TokenizedString(text), 0.4, false, true, false, kPartialMatchPenaltyRate, 0.0)); @@ -257,22 +250,22 @@ TEST_F(FuzzyTokenizedStringMatchTest, ParamThresholdTest1) { TEST_F(FuzzyTokenizedStringMatchTest, ParamThresholdTest2) { FuzzyTokenizedStringMatch match; { - std::u16string query(base::UTF8ToUTF16("anonymous")); - std::u16string text(base::UTF8ToUTF16("famous")); + std::u16string query(u"anonymous"); + std::u16string text(u"famous"); EXPECT_FALSE(match.IsRelevant(TokenizedString(query), TokenizedString(text), 0.5, false, true, false, kPartialMatchPenaltyRate, 0.0)); } { - std::u16string query(base::UTF8ToUTF16("CC")); - std::u16string text(base::UTF8ToUTF16("Clash Of Clan")); + std::u16string query(u"CC"); + std::u16string text(u"Clash Of Clan"); EXPECT_FALSE(match.IsRelevant(TokenizedString(query), TokenizedString(text), 0.25, false, true, false, kPartialMatchPenaltyRate)); } { - std::u16string query(base::UTF8ToUTF16("Clash.of.clan")); - std::u16string text(base::UTF8ToUTF16("ClashOfTitan")); + std::u16string query(u"Clash.of.clan"); + std::u16string text(u"ClashOfTitan"); EXPECT_FALSE(match.IsRelevant(TokenizedString(query), TokenizedString(text), 0.5, false, true, false, kPartialMatchPenaltyRate, 0.0)); @@ -281,8 +274,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, ParamThresholdTest2) { TEST_F(FuzzyTokenizedStringMatchTest, OtherParamTest) { FuzzyTokenizedStringMatch match; - std::u16string query(base::UTF8ToUTF16("anonymous")); - std::u16string text(base::UTF8ToUTF16("famous")); + std::u16string query(u"anonymous"); + std::u16string text(u"famous"); EXPECT_FALSE(match.IsRelevant(TokenizedString(query), TokenizedString(text), 0.35, false, false, true, kPartialMatchPenaltyRate, 0.0)); @@ -291,8 +284,8 @@ TEST_F(FuzzyTokenizedStringMatchTest, OtherParamTest) { TEST_F(FuzzyTokenizedStringMatchTest, ExactTextMatchTest) { FuzzyTokenizedStringMatch match; - std::u16string query(base::UTF8ToUTF16("yat")); - std::u16string text(base::UTF8ToUTF16("YaT")); + std::u16string query(u"yat"); + std::u16string text(u"YaT"); EXPECT_TRUE(match.IsRelevant(TokenizedString(query), TokenizedString(text), 0.35, false, false, true, kPartialMatchPenaltyRate, 0.0)); diff --git a/chromeos/components/string_matching/sequence_matcher_unittest.cc b/chromeos/components/string_matching/sequence_matcher_unittest.cc index 91b4661d369915..89e6e1c22cd8db 100644 --- a/chromeos/components/string_matching/sequence_matcher_unittest.cc +++ b/chromeos/components/string_matching/sequence_matcher_unittest.cc @@ -26,85 +26,68 @@ class SequenceMatcherTest : public testing::Test {}; TEST_F(SequenceMatcherTest, TestEditDistance) { // Transposition - ASSERT_EQ( - SequenceMatcher(base::UTF8ToUTF16("abcd"), base::UTF8ToUTF16("abdc"), - kDefaultUseEditDistance, 0.0) - .EditDistance(), - 1); + ASSERT_EQ(SequenceMatcher(u"abcd", u"abdc", kDefaultUseEditDistance, 0.0) + .EditDistance(), + 1); // Deletion - ASSERT_EQ( - SequenceMatcher(base::UTF8ToUTF16("abcde"), base::UTF8ToUTF16("abcd"), - kDefaultUseEditDistance, 0.0) - .EditDistance(), - 1); - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16("12"), base::UTF8ToUTF16(""), - kDefaultUseEditDistance, 0.0) + ASSERT_EQ(SequenceMatcher(u"abcde", u"abcd", kDefaultUseEditDistance, 0.0) .EditDistance(), - 2); - - // Insertion + 1); ASSERT_EQ( - SequenceMatcher(base::UTF8ToUTF16("abc"), base::UTF8ToUTF16("abxbc"), - kDefaultUseEditDistance, 0.0) - .EditDistance(), + SequenceMatcher(u"12", u"", kDefaultUseEditDistance, 0.0).EditDistance(), 2); - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16(""), base::UTF8ToUTF16("abxbc"), - kDefaultUseEditDistance, 0.0) + + // Insertion + ASSERT_EQ(SequenceMatcher(u"abc", u"abxbc", kDefaultUseEditDistance, 0.0) + .EditDistance(), + 2); + ASSERT_EQ(SequenceMatcher(u"", u"abxbc", kDefaultUseEditDistance, 0.0) .EditDistance(), 5); // Substitution - ASSERT_EQ( - SequenceMatcher(base::UTF8ToUTF16("book"), base::UTF8ToUTF16("back"), - kDefaultUseEditDistance, 0.0) - .EditDistance(), - 2); + ASSERT_EQ(SequenceMatcher(u"book", u"back", kDefaultUseEditDistance, 0.0) + .EditDistance(), + 2); // Combination - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16("caclulation"), - base::UTF8ToUTF16("calculator"), - kDefaultUseEditDistance, 0.0) - .EditDistance(), - 3); - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16("sunday"), - base::UTF8ToUTF16("saturday"), + ASSERT_EQ(SequenceMatcher(u"caclulation", u"calculator", kDefaultUseEditDistance, 0.0) .EditDistance(), 3); + ASSERT_EQ( + SequenceMatcher(u"sunday", u"saturday", kDefaultUseEditDistance, 0.0) + .EditDistance(), + 3); } TEST_F(SequenceMatcherTest, TestFindLongestMatch) { - SequenceMatcher sequence_match(base::UTF8ToUTF16("miscellanious"), - base::UTF8ToUTF16("miscellaneous"), + SequenceMatcher sequence_match(u"miscellanious", u"miscellaneous", kDefaultUseEditDistance, 0.0); ASSERT_TRUE(MatchEqual(sequence_match.FindLongestMatch(0, 13, 0, 13), Match(0, 0, 9))); ASSERT_TRUE(MatchEqual(sequence_match.FindLongestMatch(7, 13, 7, 13), Match(10, 10, 3))); - ASSERT_TRUE(MatchEqual( - SequenceMatcher(base::UTF8ToUTF16(""), base::UTF8ToUTF16("abcd"), - kDefaultUseEditDistance, 0.0) - .FindLongestMatch(0, 0, 0, 4), - Match(0, 0, 0))); - ASSERT_TRUE(MatchEqual(SequenceMatcher(base::UTF8ToUTF16("abababbababa"), - base::UTF8ToUTF16("ababbaba"), + ASSERT_TRUE( + MatchEqual(SequenceMatcher(u"", u"abcd", kDefaultUseEditDistance, 0.0) + .FindLongestMatch(0, 0, 0, 4), + Match(0, 0, 0))); + ASSERT_TRUE(MatchEqual(SequenceMatcher(u"abababbababa", u"ababbaba", kDefaultUseEditDistance, 0.0) .FindLongestMatch(0, 12, 0, 8), Match(2, 0, 8))); ASSERT_TRUE(MatchEqual( - SequenceMatcher(base::UTF8ToUTF16("aaaaaa"), base::UTF8ToUTF16("aaaaa"), - kDefaultUseEditDistance, 0.0) + SequenceMatcher(u"aaaaaa", u"aaaaa", kDefaultUseEditDistance, 0.0) .FindLongestMatch(0, 6, 0, 5), Match(0, 0, 5))); } TEST_F(SequenceMatcherTest, TestGetMatchingBlocks) { - SequenceMatcher sequence_match( - base::UTF8ToUTF16("This is a demo sentence!!!"), - base::UTF8ToUTF16("This demo sentence is good!!!"), - kDefaultUseEditDistance, 0.0); + SequenceMatcher sequence_match(u"This is a demo sentence!!!", + u"This demo sentence is good!!!", + kDefaultUseEditDistance, 0.0); const std::vector true_matches = {Match(0, 0, 4), Match(9, 4, 14), Match(23, 26, 3), Match(26, 29, 0)}; const std::vector matches = sequence_match.GetMatchingBlocks(); @@ -116,12 +99,9 @@ TEST_F(SequenceMatcherTest, TestGetMatchingBlocks) { TEST_F(SequenceMatcherTest, TestSequenceMatcherRatio) { ASSERT_EQ( - SequenceMatcher(base::UTF8ToUTF16("abcd"), base::UTF8ToUTF16("adbc"), - kDefaultUseEditDistance, 0.0) - .Ratio(), + SequenceMatcher(u"abcd", u"adbc", kDefaultUseEditDistance, 0.0).Ratio(), 0.75); - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16("white cats"), - base::UTF8ToUTF16("cats white"), + ASSERT_EQ(SequenceMatcher(u"white cats", u"cats white", kDefaultUseEditDistance, 0.0) .Ratio(), 0.5); @@ -129,83 +109,68 @@ TEST_F(SequenceMatcherTest, TestSequenceMatcherRatio) { TEST_F(SequenceMatcherTest, TestSequenceMatcherRatioWithoutPenalty) { // Two matching blocks, total matching blocks length is 4. - EXPECT_NEAR(SequenceMatcher(base::UTF8ToUTF16("word"), - base::UTF8ToUTF16("hello world"), - kDefaultUseEditDistance, 0.0) - .Ratio(), - 0.533, 0.001); + EXPECT_NEAR( + SequenceMatcher(u"word", u"hello world", kDefaultUseEditDistance, 0.0) + .Ratio(), + 0.533, 0.001); // One matching block, length is 4. - EXPECT_NEAR(SequenceMatcher(base::UTF8ToUTF16("worl"), - base::UTF8ToUTF16("hello world"), - kDefaultUseEditDistance, 0.0) - .Ratio(), - 0.533, 0.001); + EXPECT_NEAR( + SequenceMatcher(u"worl", u"hello world", kDefaultUseEditDistance, 0.0) + .Ratio(), + 0.533, 0.001); // No matching block at all. EXPECT_NEAR( - SequenceMatcher(base::UTF8ToUTF16("abcd"), base::UTF8ToUTF16("xyz"), - kDefaultUseEditDistance, 0.0) - .Ratio(), + SequenceMatcher(u"abcd", u"xyz", kDefaultUseEditDistance, 0.0).Ratio(), 0.0, 0.001); } TEST_F(SequenceMatcherTest, TestSequenceMatcherRatioWithPenalty) { // Two matching blocks, total matching blocks length is 4. - EXPECT_NEAR(SequenceMatcher(base::UTF8ToUTF16("word"), - base::UTF8ToUTF16("hello world"), - kDefaultUseEditDistance, 0.1) - .Ratio(), - 0.4825, 0.0001); + EXPECT_NEAR( + SequenceMatcher(u"word", u"hello world", kDefaultUseEditDistance, 0.1) + .Ratio(), + 0.4825, 0.0001); // One matching block, length is 4. - EXPECT_NEAR(SequenceMatcher(base::UTF8ToUTF16("worl"), - base::UTF8ToUTF16("hello world"), - kDefaultUseEditDistance, 0.1) - .Ratio(), - 0.533, 0.001); + EXPECT_NEAR( + SequenceMatcher(u"worl", u"hello world", kDefaultUseEditDistance, 0.1) + .Ratio(), + 0.533, 0.001); // No matching block at all. EXPECT_NEAR( - SequenceMatcher(base::UTF8ToUTF16("abcd"), base::UTF8ToUTF16("xyz"), - kDefaultUseEditDistance, 0.1) - .Ratio(), + SequenceMatcher(u"abcd", u"xyz", kDefaultUseEditDistance, 0.1).Ratio(), 0.0, 0.001); } TEST_F(SequenceMatcherTest, TestEditDistanceRatio) { - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16("abcd"), - base::UTF8ToUTF16("adbc"), true, 0.0) - .Ratio(), - 0.5); - EXPECT_NEAR(SequenceMatcher(base::UTF8ToUTF16("white cats"), - base::UTF8ToUTF16("cats white"), true, 0.0) - .Ratio(), + ASSERT_EQ(SequenceMatcher(u"abcd", u"adbc", true, 0.0).Ratio(), 0.5); + EXPECT_NEAR(SequenceMatcher(u"white cats", u"cats white", true, 0.0).Ratio(), 0.2, 0.01); // Totally different - EXPECT_NEAR(SequenceMatcher(base::UTF8ToUTF16("dog"), - base::UTF8ToUTF16("elphant"), true, 0.0) - .Ratio(), - 0.0, 0.01); + EXPECT_NEAR(SequenceMatcher(u"dog", u"elphant", true, 0.0).Ratio(), 0.0, + 0.01); } TEST_F(SequenceMatcherTest, TestEmptyStrings) { - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16(""), base::UTF8ToUTF16(""), + ASSERT_EQ(SequenceMatcher(u"", u"", /*use_edit_distance=*/true, 0.0) .Ratio(), 0.0); - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16(""), base::UTF8ToUTF16("abcd"), + ASSERT_EQ(SequenceMatcher(u"", u"abcd", /*use_edit_distance=*/true, 0.0) .Ratio(), 0.0); - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16(""), base::UTF8ToUTF16(""), + ASSERT_EQ(SequenceMatcher(u"", u"", /*use_edit_distance=*/false, 0.0) .Ratio(), 0.0); - ASSERT_EQ(SequenceMatcher(base::UTF8ToUTF16(""), base::UTF8ToUTF16("abcd"), + ASSERT_EQ(SequenceMatcher(u"", u"abcd", /*use_edit_distance=*/false, 0.0) .Ratio(), 0.0); diff --git a/chromeos/components/string_matching/term_break_iterator_unittest.cc b/chromeos/components/string_matching/term_break_iterator_unittest.cc index 272ebc72b04356..5cc4ee494c6786 100644 --- a/chromeos/components/string_matching/term_break_iterator_unittest.cc +++ b/chromeos/components/string_matching/term_break_iterator_unittest.cc @@ -19,56 +19,56 @@ TEST(TermBreakIteratorTest, EmptyWord) { } TEST(TermBreakIteratorTest, Simple) { - std::u16string word(UTF8ToUTF16("simple")); + std::u16string word(u"simple"); TermBreakIterator iter(word); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("simple"), iter.GetCurrentTerm()); + EXPECT_EQ(u"simple", iter.GetCurrentTerm()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. } TEST(TermBreakIteratorTest, CamelCase) { - std::u16string word(UTF8ToUTF16("CamelCase")); + std::u16string word(u"CamelCase"); TermBreakIterator iter(word); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("Camel"), iter.GetCurrentTerm()); + EXPECT_EQ(u"Camel", iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("Case"), iter.GetCurrentTerm()); + EXPECT_EQ(u"Case", iter.GetCurrentTerm()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. } TEST(TermBreakIteratorTest, LowerToUpper) { - std::u16string word(UTF8ToUTF16("lowerToUpper")); + std::u16string word(u"lowerToUpper"); TermBreakIterator iter(word); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("lower"), iter.GetCurrentTerm()); + EXPECT_EQ(u"lower", iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("To"), iter.GetCurrentTerm()); + EXPECT_EQ(u"To", iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("Upper"), iter.GetCurrentTerm()); + EXPECT_EQ(u"Upper", iter.GetCurrentTerm()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. } TEST(TermBreakIteratorTest, AlphaNumber) { - std::u16string word(UTF8ToUTF16("Chromium26.0.0.0")); + std::u16string word(u"Chromium26.0.0.0"); TermBreakIterator iter(word); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("Chromium"), iter.GetCurrentTerm()); + EXPECT_EQ(u"Chromium", iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("26.0.0.0"), iter.GetCurrentTerm()); + EXPECT_EQ(u"26.0.0.0", iter.GetCurrentTerm()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. } TEST(TermBreakIteratorTest, StartsWithNumber) { - std::u16string word(UTF8ToUTF16("123startWithNumber")); + std::u16string word(u"123startWithNumber"); TermBreakIterator iter(word); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("123"), iter.GetCurrentTerm()); + EXPECT_EQ(u"123", iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("start"), iter.GetCurrentTerm()); + EXPECT_EQ(u"start", iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("With"), iter.GetCurrentTerm()); + EXPECT_EQ(u"With", iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("Number"), iter.GetCurrentTerm()); + EXPECT_EQ(u"Number", iter.GetCurrentTerm()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. } @@ -77,11 +77,11 @@ TEST(TermBreakIteratorTest, CaseAndNoCase) { std::u16string word(UTF8ToUTF16("English\xe4\xb8\xad\xe6\x96\x87Word")); TermBreakIterator iter(word); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("English"), iter.GetCurrentTerm()); + EXPECT_EQ(u"English", iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); EXPECT_EQ(UTF8ToUTF16("\xe4\xb8\xad\xe6\x96\x87"), iter.GetCurrentTerm()); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(UTF8ToUTF16("Word"), iter.GetCurrentTerm()); + EXPECT_EQ(u"Word", iter.GetCurrentTerm()); EXPECT_FALSE(iter.Advance()); // Test unexpected advance after end. } diff --git a/chromeos/components/string_matching/tokenized_string_unittest.cc b/chromeos/components/string_matching/tokenized_string_unittest.cc index faf129f6ec29a3..e6d29f3b6b093d 100644 --- a/chromeos/components/string_matching/tokenized_string_unittest.cc +++ b/chromeos/components/string_matching/tokenized_string_unittest.cc @@ -39,95 +39,85 @@ TEST(TokenizedStringTest, Empty) { TEST(TokenizedStringTest, Basic) { { - std::u16string text(base::UTF8ToUTF16("a")); + std::u16string text(u"a"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16("a{0,1}"), GetContent(tokens)); + EXPECT_EQ(u"a{0,1}", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("a{0,1}"), GetContent(token_words)); + EXPECT_EQ(u"a{0,1}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16("ScratchPad")); + std::u16string text(u"ScratchPad"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16("scratch{0,7} pad{7,10}"), GetContent(tokens)); + EXPECT_EQ(u"scratch{0,7} pad{7,10}", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("scratchpad{0,10}"), GetContent(token_words)); + EXPECT_EQ(u"scratchpad{0,10}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16("Chess2.0")); + std::u16string text(u"Chess2.0"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16("chess{0,5} 2.0{5,8}"), GetContent(tokens)); + EXPECT_EQ(u"chess{0,5} 2.0{5,8}", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("chess2.0{0,8}"), GetContent(token_words)); + EXPECT_EQ(u"chess2.0{0,8}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16("Cut the rope")); + std::u16string text(u"Cut the rope"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16("cut{0,3} the{4,7} rope{8,12}"), - GetContent(tokens)); + EXPECT_EQ(u"cut{0,3} the{4,7} rope{8,12}", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("cut{0,3} the{4,7} rope{8,12}"), - GetContent(token_words)); + EXPECT_EQ(u"cut{0,3} the{4,7} rope{8,12}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16("AutoCAD WS")); + std::u16string text(u"AutoCAD WS"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16("auto{0,4} cad{4,7} ws{8,10}"), - GetContent(tokens)); + EXPECT_EQ(u"auto{0,4} cad{4,7} ws{8,10}", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("autocad{0,7} ws{8,10}"), - GetContent(token_words)); + EXPECT_EQ(u"autocad{0,7} ws{8,10}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16("Great TweetDeck")); + std::u16string text(u"Great TweetDeck"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16("great{0,5} tweet{6,11} deck{11,15}"), - GetContent(tokens)); + EXPECT_EQ(u"great{0,5} tweet{6,11} deck{11,15}", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("great{0,5} tweetdeck{6,15}"), - GetContent(token_words)); + EXPECT_EQ(u"great{0,5} tweetdeck{6,15}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16("Draw-It!")); + std::u16string text(u"Draw-It!"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16("draw{0,4} it{5,7}"), GetContent(tokens)); + EXPECT_EQ(u"draw{0,4} it{5,7}", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("draw-it{0,7}"), GetContent(token_words)); + EXPECT_EQ(u"draw-it{0,7}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16("Faxing & Signing")); + std::u16string text(u"Faxing & Signing"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16("faxing{0,6} signing{9,16}"), - GetContent(tokens)); + EXPECT_EQ(u"faxing{0,6} signing{9,16}", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("faxing{0,6} signing{9,16}"), - GetContent(token_words)); + EXPECT_EQ(u"faxing{0,6} signing{9,16}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16("!@#$%^&*()<<<**>>>")); + std::u16string text(u"!@#$%^&*()<<<**>>>"); TokenizedString tokens(text); - EXPECT_EQ(base::UTF8ToUTF16(""), GetContent(tokens)); + EXPECT_EQ(u"", GetContent(tokens)); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16(""), GetContent(token_words)); + EXPECT_EQ(u"", GetContent(token_words)); } } TEST(TokenizedStringTest, TokenizeWords) { { - std::u16string text(base::UTF8ToUTF16("?! wi-fi abc@gmail.com?!")); + std::u16string text(u"?! wi-fi abc@gmail.com?!"); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("wi-fi{3,8} abc@gmail.com{9,22}"), - GetContent(token_words)); + EXPECT_EQ(u"wi-fi{3,8} abc@gmail.com{9,22}", GetContent(token_words)); } { std::u16string text(base::UTF8ToUTF16("Hello?! \t \b World! ")); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16("hello{0,5} world{14,19}"), - GetContent(token_words)); + EXPECT_EQ(u"hello{0,5} world{14,19}", GetContent(token_words)); } { - std::u16string text(base::UTF8ToUTF16(" ?|! *&")); + std::u16string text(u" ?|! *&"); TokenizedString token_words(text, TokenizedString::Mode::kWords); - EXPECT_EQ(base::UTF8ToUTF16(""), GetContent(token_words)); + EXPECT_EQ(u"", GetContent(token_words)); } } diff --git a/chromeos/network/cellular_esim_profile_unittest.cc b/chromeos/network/cellular_esim_profile_unittest.cc index b25cc5c12438f1..e11d2012ed516a 100644 --- a/chromeos/network/cellular_esim_profile_unittest.cc +++ b/chromeos/network/cellular_esim_profile_unittest.cc @@ -13,10 +13,10 @@ namespace chromeos { TEST(CellularESimProfileTest, ConvertToAndFromDictionary) { - CellularESimProfile profile( - CellularESimProfile::State::kPending, dbus::ObjectPath("/test/path/123"), - "eid", "iccid", base::UTF8ToUTF16("name"), base::UTF8ToUTF16("nickname"), - base::UTF8ToUTF16("serviceProvider"), "activationCode"); + CellularESimProfile profile(CellularESimProfile::State::kPending, + dbus::ObjectPath("/test/path/123"), "eid", + "iccid", u"name", u"nickname", u"serviceProvider", + "activationCode"); base::Value dictionary = profile.ToDictionaryValue(); base::Optional from_dictionary = @@ -27,10 +27,9 @@ TEST(CellularESimProfileTest, ConvertToAndFromDictionary) { EXPECT_EQ(dbus::ObjectPath("/test/path/123"), from_dictionary->path()); EXPECT_EQ("eid", from_dictionary->eid()); EXPECT_EQ("iccid", from_dictionary->iccid()); - EXPECT_EQ(base::UTF8ToUTF16("name"), from_dictionary->name()); - EXPECT_EQ(base::UTF8ToUTF16("nickname"), from_dictionary->nickname()); - EXPECT_EQ(base::UTF8ToUTF16("serviceProvider"), - from_dictionary->service_provider()); + EXPECT_EQ(u"name", from_dictionary->name()); + EXPECT_EQ(u"nickname", from_dictionary->nickname()); + EXPECT_EQ(u"serviceProvider", from_dictionary->service_provider()); EXPECT_EQ("activationCode", from_dictionary->activation_code()); } diff --git a/chromeos/policy/weekly_time/time_utils_unittest.cc b/chromeos/policy/weekly_time/time_utils_unittest.cc index 5f29a4630c0235..c286f649ac6169 100644 --- a/chromeos/policy/weekly_time/time_utils_unittest.cc +++ b/chromeos/policy/weekly_time/time_utils_unittest.cc @@ -89,17 +89,17 @@ TEST_F(TimeUtilsTimezoneFunctionsTest, ToLocalizedStringDaylightSavings) { base::i18n::SetICUDefaultLocale("en_US"); icu::TimeZone::adoptDefault( icu::TimeZone::createTimeZone("America/Los_Angeles")); - EXPECT_EQ(base::UTF8ToUTF16("Friday 8:50 AM"), + EXPECT_EQ(u"Friday 8:50 AM", WeeklyTimeToLocalizedString(test_weekly_time, &test_clock_)); base::i18n::SetICUDefaultLocale("de_DE"); - EXPECT_EQ(base::UTF8ToUTF16("Freitag, 08:50"), + EXPECT_EQ(u"Freitag, 08:50", WeeklyTimeToLocalizedString(test_weekly_time, &test_clock_)); base::i18n::SetICUDefaultLocale("en_GB"); icu::TimeZone::adoptDefault( icu::TimeZone::createTimeZone("America/New_York")); - EXPECT_EQ(base::UTF8ToUTF16("Friday 11:50"), + EXPECT_EQ(u"Friday 11:50", WeeklyTimeToLocalizedString(test_weekly_time, &test_clock_)); } @@ -114,7 +114,7 @@ TEST_F(TimeUtilsTimezoneFunctionsTest, ToLocalizedStringNoDaylightSavings) { base::i18n::SetICUDefaultLocale("en_US"); icu::TimeZone::adoptDefault( icu::TimeZone::createTimeZone("America/Los_Angeles")); - EXPECT_EQ(base::UTF8ToUTF16("Friday 7:50 AM"), + EXPECT_EQ(u"Friday 7:50 AM", WeeklyTimeToLocalizedString(test_weekly_time, &test_clock_)); } diff --git a/chromeos/services/assistant/media_host_unittest.cc b/chromeos/services/assistant/media_host_unittest.cc index 02fdad1651c0a8..a66ac93294b9cd 100644 --- a/chromeos/services/assistant/media_host_unittest.cc +++ b/chromeos/services/assistant/media_host_unittest.cc @@ -336,7 +336,7 @@ TEST_F(MediaHostTest, ShouldSetTitleWhenCallingSetExternalPlaybackState) { .WillOnce([&](MediaStatePtr state) { actual_state = std::move(state); }); media_session::MediaMetadata meta_data; - meta_data.title = base::UTF8ToUTF16("the title"); + meta_data.title = u"the title"; MediaSessionMetadataChanged(meta_data); ASSERT_FALSE(actual_state.is_null()); @@ -474,9 +474,9 @@ TEST_F(MediaHostTest, ShouldForwardLibassistantMediaSessionUpdates) { base::Optional expected_output = media_session::MediaMetadata(); - expected_output->title = base::UTF8ToUTF16("the title"); - expected_output->artist = base::UTF8ToUTF16("the artist"); - expected_output->album = base::UTF8ToUTF16("the album"); + expected_output->title = u"the title"; + expected_output->artist = u"the artist"; + expected_output->album = u"the album"; EXPECT_CALL(media_session_observer, MediaSessionMetadataChanged(expected_output)); diff --git a/chromeos/services/cellular_setup/esim_profile_unittest.cc b/chromeos/services/cellular_setup/esim_profile_unittest.cc index 98b593bc0e5ab8..7b70698c02ab56 100644 --- a/chromeos/services/cellular_setup/esim_profile_unittest.cc +++ b/chromeos/services/cellular_setup/esim_profile_unittest.cc @@ -424,7 +424,7 @@ TEST_F(ESimProfileTest, DisableProfile) { } TEST_F(ESimProfileTest, SetProfileNickName) { - const std::u16string test_nickname = base::UTF8ToUTF16("Test nickname"); + const std::u16string test_nickname = u"Test nickname"; base::HistogramTester histogram_tester; HermesEuiccClient::TestInterface* euicc_test = diff --git a/components/arc/ime/arc_ime_service_unittest.cc b/components/arc/ime/arc_ime_service_unittest.cc index 3b460668b356d9..a20af3fd48d701 100644 --- a/components/arc/ime/arc_ime_service_unittest.cc +++ b/components/arc/ime/arc_ime_service_unittest.cc @@ -239,7 +239,7 @@ TEST_F(ArcImeServiceTest, HasCompositionText) { instance_->OnWindowFocused(arc_win_.get(), nullptr); ui::CompositionText composition; - composition.text = base::UTF8ToUTF16("nonempty text"); + composition.text = u"nonempty text"; EXPECT_FALSE(instance_->HasCompositionText()); @@ -256,7 +256,7 @@ TEST_F(ArcImeServiceTest, HasCompositionText) { instance_->SetCompositionText(composition); EXPECT_TRUE(instance_->HasCompositionText()); instance_->InsertText( - base::UTF8ToUTF16("another text"), + u"another text", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); EXPECT_FALSE(instance_->HasCompositionText()); @@ -284,7 +284,7 @@ TEST_F(ArcImeServiceTest, ConfirmCompositionText) { instance_->OnWindowFocused(arc_win_.get(), nullptr); ui::CompositionText composition; - composition.text = base::UTF8ToUTF16("nonempty text"); + composition.text = u"nonempty text"; EXPECT_FALSE(instance_->HasCompositionText()); instance_->SetCompositionText(composition); EXPECT_TRUE(instance_->HasCompositionText()); diff --git a/components/autofill/content/renderer/form_autofill_util_browsertest.cc b/components/autofill/content/renderer/form_autofill_util_browsertest.cc index a76524fc48e7f9..73849ce490c0bd 100644 --- a/components/autofill/content/renderer/form_autofill_util_browsertest.cc +++ b/components/autofill/content/renderer/form_autofill_util_browsertest.cc @@ -317,17 +317,13 @@ TEST_F(FormAutofillUtilsTest, GetButtonTitles) { GetButtonTitles(form_target, web_frame->GetDocument(), &cache); autofill::ButtonTitleList expected = { - {base::UTF8ToUTF16("Clear field"), - ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, - {base::UTF8ToUTF16("Show password"), - ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, - {base::UTF8ToUTF16("Sign Up"), - ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE}, - {base::UTF8ToUTF16("Register"), - ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE}, - {base::UTF8ToUTF16("Create account"), ButtonTitleType::HYPERLINK}, - {base::UTF8ToUTF16("Join"), ButtonTitleType::DIV}, - {base::UTF8ToUTF16("Start"), ButtonTitleType::SPAN}}; + {u"Clear field", ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, + {u"Show password", ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, + {u"Sign Up", ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE}, + {u"Register", ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE}, + {u"Create account", ButtonTitleType::HYPERLINK}, + {u"Join", ButtonTitleType::DIV}, + {u"Start", ButtonTitleType::SPAN}}; EXPECT_EQ(expected, actual); VerifyButtonTitleCache(form_target, expected, cache); @@ -389,12 +385,9 @@ TEST_F(FormAutofillUtilsTest, GetButtonTitles_Formless) { autofill::ButtonTitleList actual = GetButtonTitles(form_target, web_frame->GetDocument(), &cache); autofill::ButtonTitleList expected = { - {base::UTF8ToUTF16("Show password"), - ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, - {base::UTF8ToUTF16("Sign Up"), - ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE}, - {base::UTF8ToUTF16("Register"), - ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE}}; + {u"Show password", ButtonTitleType::INPUT_ELEMENT_BUTTON_TYPE}, + {u"Sign Up", ButtonTitleType::BUTTON_ELEMENT_SUBMIT_TYPE}, + {u"Register", ButtonTitleType::BUTTON_ELEMENT_BUTTON_TYPE}}; EXPECT_EQ(expected, actual); VerifyButtonTitleCache(form_target, expected, cache); @@ -537,9 +530,9 @@ TEST_F(FormAutofillUtilsTest, IsFocusable) { dummy_fieldsets, control_elements, nullptr, web_frame->GetDocument(), nullptr, EXTRACT_NONE, &target, nullptr)); ASSERT_EQ(2u, target.fields.size()); - EXPECT_EQ(base::UTF8ToUTF16("name1"), target.fields[0].name); + EXPECT_EQ(u"name1", target.fields[0].name); EXPECT_TRUE(target.fields[0].is_focusable); - EXPECT_EQ(base::UTF8ToUTF16("name2"), target.fields[1].name); + EXPECT_EQ(u"name2", target.fields[1].name); EXPECT_FALSE(target.fields[1].is_focusable); } @@ -634,8 +627,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaLabel) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); - EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), - base::UTF8ToUTF16("the label")); + EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), u"the label"); } // Tests that aria-labelledby works. Simple case: only one id referenced. @@ -649,8 +641,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaLabelledBySingle) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); - EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), - base::UTF8ToUTF16("Name")); + EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), u"Name"); } // Tests that aria-labelledby works: Complex case: multiple ids referenced. @@ -664,8 +655,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaLabelledByMulti) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); - EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), - base::UTF8ToUTF16("Billing Name")); + EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), u"Billing Name"); } // Tests that aria-labelledby takes precedence over aria-label @@ -680,8 +670,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaLabelledByTakesPrecedence) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); - EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), - base::UTF8ToUTF16("Name")); + EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), u"Name"); } // Tests that an invalid aria-labelledby reference gets ignored (as opposed to @@ -696,8 +685,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaLabelledByInvalid) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); - EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), - base::UTF8ToUTF16("")); + EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), u""); } // Tests that invalid aria-labelledby references fall back to aria-label. @@ -712,8 +700,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaLabelledByFallback) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); - EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), - base::UTF8ToUTF16("valid")); + EXPECT_EQ(autofill::form_util::GetAriaLabel(doc, element), u"valid"); } // Tests that aria-describedby works: Simple case: a single id referenced. @@ -725,7 +712,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaDescribedBySingle) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); EXPECT_EQ(autofill::form_util::GetAriaDescription(doc, element), - base::UTF8ToUTF16("aria description")); + u"aria description"); } // Tests that aria-describedby works: Complex case: multiple ids referenced. @@ -738,7 +725,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaDescribedByMulti) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); EXPECT_EQ(autofill::form_util::GetAriaDescription(doc, element), - base::UTF8ToUTF16("aria description")); + u"aria description"); } // Tests that invalid aria-describedby returns the empty string. @@ -747,8 +734,7 @@ TEST_F(FormAutofillUtilsTest, GetAriaDescribedByInvalid) { WebDocument doc = GetMainFrame()->GetDocument(); auto element = doc.GetElementById("input").To(); - EXPECT_EQ(autofill::form_util::GetAriaDescription(doc, element), - base::UTF8ToUTF16("")); + EXPECT_EQ(autofill::form_util::GetAriaDescription(doc, element), u""); } TEST_F(FormAutofillUtilsTest, IsFormVisible) { @@ -857,10 +843,10 @@ TEST_F(FormAutofillUtilsTest, GetDataListSuggestions) { GetDataListSuggestions(web_control, &values, &labels); ASSERT_EQ(values.size(), 2u); ASSERT_EQ(labels.size(), 2u); - EXPECT_EQ(values[0], base::UTF8ToUTF16("1")); - EXPECT_EQ(values[1], base::UTF8ToUTF16("2")); - EXPECT_EQ(labels[0], base::UTF8ToUTF16("")); - EXPECT_EQ(labels[1], base::UTF8ToUTF16("")); + EXPECT_EQ(values[0], u"1"); + EXPECT_EQ(values[1], u"2"); + EXPECT_EQ(labels[0], u""); + EXPECT_EQ(labels[1], u""); } TEST_F(FormAutofillUtilsTest, GetDataListSuggestionsWithLabels) { @@ -875,10 +861,10 @@ TEST_F(FormAutofillUtilsTest, GetDataListSuggestionsWithLabels) { GetDataListSuggestions(web_control, &values, &labels); ASSERT_EQ(values.size(), 2u); ASSERT_EQ(labels.size(), 2u); - EXPECT_EQ(values[0], base::UTF8ToUTF16("1")); - EXPECT_EQ(values[1], base::UTF8ToUTF16("2")); - EXPECT_EQ(labels[0], base::UTF8ToUTF16("one")); - EXPECT_EQ(labels[1], base::UTF8ToUTF16("two")); + EXPECT_EQ(values[0], u"1"); + EXPECT_EQ(values[1], u"2"); + EXPECT_EQ(labels[0], u"one"); + EXPECT_EQ(labels[1], u"two"); } TEST_F(FormAutofillUtilsTest, ExtractDataList) { @@ -898,10 +884,10 @@ TEST_F(FormAutofillUtilsTest, ExtractDataList) { auto& labels = form_data.fields.back().datalist_labels; ASSERT_EQ(values.size(), 2u); ASSERT_EQ(labels.size(), 2u); - EXPECT_EQ(values[0], base::UTF8ToUTF16("1")); - EXPECT_EQ(values[1], base::UTF8ToUTF16("2")); - EXPECT_EQ(labels[0], base::UTF8ToUTF16("one")); - EXPECT_EQ(labels[1], base::UTF8ToUTF16("two")); + EXPECT_EQ(values[0], u"1"); + EXPECT_EQ(values[1], u"2"); + EXPECT_EQ(labels[0], u"one"); + EXPECT_EQ(labels[1], u"two"); EXPECT_EQ(form_field_data.datalist_values, values); EXPECT_EQ(form_field_data.datalist_labels, labels); } diff --git a/components/autofill/core/browser/address_normalizer_impl_unittest.cc b/components/autofill/core/browser/address_normalizer_impl_unittest.cc index dc3206e2822602..486f6dc03a7417 100644 --- a/components/autofill/core/browser/address_normalizer_impl_unittest.cc +++ b/components/autofill/core/browser/address_normalizer_impl_unittest.cc @@ -259,8 +259,7 @@ TEST_F(AddressNormalizerTest, FormatPhone_AddressNormalizedAsync) { WaitForAddressValidatorInitialization(); AutofillProfile profile = autofill::test::GetFullProfile(); - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("(515) 223-1234")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"(515) 223-1234"); profile.SetRawInfo(ADDRESS_HOME_STATE, base::ASCIIToUTF16("California")); const std::string kCountryCode = base::UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)); @@ -292,8 +291,7 @@ TEST_F(AddressNormalizerTest, FormatInvalidPhone_AddressNormalizedAsync) { AutofillProfile profile = autofill::test::GetFullProfile(); // The number below is not a valid US number. - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("(515) 123-1234")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"(515) 123-1234"); profile.SetRawInfo(ADDRESS_HOME_STATE, base::ASCIIToUTF16("California")); const std::string kCountryCode = base::UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)); @@ -324,8 +322,7 @@ TEST_F(AddressNormalizerTest, FormatPhone_AddressNotNormalizedAsync) { AutofillProfile profile = autofill::test::GetFullProfile(); profile.SetRawInfo(ADDRESS_HOME_STATE, base::ASCIIToUTF16("California")); - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("515-223-1234")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"515-223-1234"); // Make sure the rules will not be loaded in the NormalizeAddressAsync // call. @@ -358,8 +355,7 @@ TEST_F(AddressNormalizerTest, NormalizeAddressSync_RulesNotLoaded) { AutofillProfile profile = autofill::test::GetFullProfile(); profile.SetRawInfo(ADDRESS_HOME_STATE, base::ASCIIToUTF16("California")); - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("515-223-1234")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"515-223-1234"); // Do the normalization. EXPECT_FALSE(normalizer()->NormalizeAddressSync(&profile)); @@ -380,8 +376,7 @@ TEST_F(AddressNormalizerTest, NormalizeAddressSync_RulesLoaded) { AutofillProfile profile = autofill::test::GetFullProfile(); profile.SetRawInfo(ADDRESS_HOME_STATE, base::ASCIIToUTF16("California")); - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("515-223-1234")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"515-223-1234"); const std::string kCountryCode = base::UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)); @@ -405,8 +400,7 @@ TEST_F(AddressNormalizerTest, NormalizeAddressSync_RulesLoaded) { TEST_F(AddressNormalizerTest, NormalizeAddressSync_UninitializedValidator) { AutofillProfile profile = autofill::test::GetFullProfile(); profile.SetRawInfo(ADDRESS_HOME_STATE, base::ASCIIToUTF16("California")); - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("515-223-1234")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"515-223-1234"); const std::string kCountryCode = base::UTF16ToUTF8(profile.GetRawInfo(ADDRESS_HOME_COUNTRY)); diff --git a/components/autofill/core/browser/address_rewriter_unittest.cc b/components/autofill/core/browser/address_rewriter_unittest.cc index 23851b72059770..fdd1ead86a064a 100644 --- a/components/autofill/core/browser/address_rewriter_unittest.cc +++ b/components/autofill/core/browser/address_rewriter_unittest.cc @@ -11,9 +11,9 @@ using base::UTF8ToUTF16; using autofill::AddressRewriter; TEST(AddressRewriterTest, InvalidCountryCode) { - AddressRewriter ad = AddressRewriter::ForCountryCode(UTF8ToUTF16("ZZZZ")); - const std::u16string kSomeRandomText = UTF8ToUTF16("some random text"); - const std::u16string kOtherRandomText = UTF8ToUTF16("other random text"); + AddressRewriter ad = AddressRewriter::ForCountryCode(u"ZZZZ"); + const std::u16string kSomeRandomText = u"some random text"; + const std::u16string kOtherRandomText = u"other random text"; EXPECT_EQ(ad.Rewrite(kSomeRandomText), ad.Rewrite(kSomeRandomText)); EXPECT_EQ(ad.Rewrite(kOtherRandomText), ad.Rewrite(kOtherRandomText)); @@ -26,285 +26,243 @@ TEST(AddressRewriterTest, LastRule) { AddressRewriter large_rewrite = AddressRewriter::ForCustomRules("1\tonelongrewrite\n2\tshort\n"); - EXPECT_EQ(last_rule.Rewrite(UTF8ToUTF16("3")), - last_rule.Rewrite(UTF8ToUTF16("4"))); + EXPECT_EQ(last_rule.Rewrite(u"3"), last_rule.Rewrite(u"4")); // Checks if last rule works when previous rewrite is larger than last rule. - EXPECT_EQ(large_rewrite.Rewrite(UTF8ToUTF16("2")), - large_rewrite.Rewrite(UTF8ToUTF16("short"))); + EXPECT_EQ(large_rewrite.Rewrite(u"2"), large_rewrite.Rewrite(u"short")); } TEST(AddressRewriterTest, AD) { - AddressRewriter ad = AddressRewriter::ForCountryCode(UTF8ToUTF16("ad")); - EXPECT_EQ(ad.Rewrite(UTF8ToUTF16("parroquia de andorra la vella")), - ad.Rewrite(UTF8ToUTF16("andorra la vella"))); - EXPECT_EQ(ad.Rewrite(UTF8ToUTF16("principal de andorra")), - ad.Rewrite(UTF8ToUTF16("an"))); - EXPECT_EQ(ad.Rewrite(UTF8ToUTF16("or")), ad.Rewrite(UTF8ToUTF16("ordino"))); + AddressRewriter ad = AddressRewriter::ForCountryCode(u"ad"); + EXPECT_EQ(ad.Rewrite(u"parroquia de andorra la vella"), + ad.Rewrite(u"andorra la vella")); + EXPECT_EQ(ad.Rewrite(u"principal de andorra"), ad.Rewrite(u"an")); + EXPECT_EQ(ad.Rewrite(u"or"), ad.Rewrite(u"ordino")); } TEST(AddressRewriterTest, AR) { - AddressRewriter ar = AddressRewriter::ForCountryCode(UTF8ToUTF16("ar")); + AddressRewriter ar = AddressRewriter::ForCountryCode(u"ar"); EXPECT_EQ(ar.Rewrite(UTF8ToUTF16( "tierra del fuego antartida e islas del atlantico sur")), - ar.Rewrite(UTF8ToUTF16("tierra del fuego"))); - EXPECT_EQ(ar.Rewrite(UTF8ToUTF16("ciudad autonoma de buenos aires")), - ar.Rewrite(UTF8ToUTF16("capital federal"))); + ar.Rewrite(u"tierra del fuego")); + EXPECT_EQ(ar.Rewrite(u"ciudad autonoma de buenos aires"), + ar.Rewrite(u"capital federal")); } TEST(AddressRewriterTest, AU) { - AddressRewriter au = AddressRewriter::ForCountryCode(UTF8ToUTF16("au")); - EXPECT_EQ(au.Rewrite(UTF8ToUTF16("australian capital territory")), - au.Rewrite(UTF8ToUTF16("act"))); - EXPECT_EQ(au.Rewrite(UTF8ToUTF16("jervis bay territory")), - au.Rewrite(UTF8ToUTF16("jbt"))); + AddressRewriter au = AddressRewriter::ForCountryCode(u"au"); + EXPECT_EQ(au.Rewrite(u"australian capital territory"), au.Rewrite(u"act")); + EXPECT_EQ(au.Rewrite(u"jervis bay territory"), au.Rewrite(u"jbt")); } TEST(AddressRewriterTest, BE) { - AddressRewriter be = AddressRewriter::ForCountryCode(UTF8ToUTF16("be")); - EXPECT_EQ(be.Rewrite(UTF8ToUTF16("brussels hoofdstedelijk gewest")), - be.Rewrite(UTF8ToUTF16("region de bruxelles capitale"))); - EXPECT_EQ(be.Rewrite(UTF8ToUTF16("arrondissement administratif de foo")), - be.Rewrite(UTF8ToUTF16("foo"))); + AddressRewriter be = AddressRewriter::ForCountryCode(u"be"); + EXPECT_EQ(be.Rewrite(u"brussels hoofdstedelijk gewest"), + be.Rewrite(u"region de bruxelles capitale")); + EXPECT_EQ(be.Rewrite(u"arrondissement administratif de foo"), + be.Rewrite(u"foo")); } TEST(AddressRewriterTest, BR) { - AddressRewriter br = AddressRewriter::ForCountryCode(UTF8ToUTF16("br")); - EXPECT_EQ(br.Rewrite(UTF8ToUTF16("rio grande do norte")), - br.Rewrite(UTF8ToUTF16("rn"))); + AddressRewriter br = AddressRewriter::ForCountryCode(u"br"); + EXPECT_EQ(br.Rewrite(u"rio grande do norte"), br.Rewrite(u"rn")); } TEST(AddressRewriterTest, CA) { - AddressRewriter ca = AddressRewriter::ForCountryCode(UTF8ToUTF16("ca")); - EXPECT_EQ(ca.Rewrite(UTF8ToUTF16("qc")), ca.Rewrite(UTF8ToUTF16("quebec"))); - EXPECT_EQ(ca.Rewrite(UTF8ToUTF16("prince edward island")), - ca.Rewrite(UTF8ToUTF16("pei"))); - EXPECT_EQ(ca.Rewrite(UTF8ToUTF16("prince edward island")), - ca.Rewrite(UTF8ToUTF16("ile du prince edouard"))); - EXPECT_EQ(ca.Rewrite(UTF8ToUTF16("cul-de-sac")), - ca.Rewrite(UTF8ToUTF16("cul de sac"))); - EXPECT_EQ(ca.Rewrite(UTF8ToUTF16("st")), ca.Rewrite(UTF8ToUTF16("street"))); - EXPECT_EQ(ca.Rewrite(UTF8ToUTF16("sainte")), - ca.Rewrite(UTF8ToUTF16("saint"))); + AddressRewriter ca = AddressRewriter::ForCountryCode(u"ca"); + EXPECT_EQ(ca.Rewrite(u"qc"), ca.Rewrite(u"quebec")); + EXPECT_EQ(ca.Rewrite(u"prince edward island"), ca.Rewrite(u"pei")); + EXPECT_EQ(ca.Rewrite(u"prince edward island"), + ca.Rewrite(u"ile du prince edouard")); + EXPECT_EQ(ca.Rewrite(u"cul-de-sac"), ca.Rewrite(u"cul de sac")); + EXPECT_EQ(ca.Rewrite(u"st"), ca.Rewrite(u"street")); + EXPECT_EQ(ca.Rewrite(u"sainte"), ca.Rewrite(u"saint")); } TEST(AddressRewriterTest, CH) { - AddressRewriter ch = AddressRewriter::ForCountryCode(UTF8ToUTF16("ch")); - EXPECT_EQ(ch.Rewrite(UTF8ToUTF16("appenzell rhodes exterieures")), - ch.Rewrite(UTF8ToUTF16("appenzell ausserrhoden"))); - EXPECT_EQ(ch.Rewrite(UTF8ToUTF16("prettigovia davos")), - ch.Rewrite(UTF8ToUTF16("prattigau davos"))); + AddressRewriter ch = AddressRewriter::ForCountryCode(u"ch"); + EXPECT_EQ(ch.Rewrite(u"appenzell rhodes exterieures"), + ch.Rewrite(u"appenzell ausserrhoden")); + EXPECT_EQ(ch.Rewrite(u"prettigovia davos"), ch.Rewrite(u"prattigau davos")); } TEST(AddressRewriterTest, CL) { - AddressRewriter cl = AddressRewriter::ForCountryCode(UTF8ToUTF16("cl")); - EXPECT_EQ( - cl.Rewrite(UTF8ToUTF16("aisen del general carlos ibanez del campo")), - cl.Rewrite(UTF8ToUTF16("xi"))); - EXPECT_EQ(cl.Rewrite(UTF8ToUTF16("libertador general bernardo o'higgins")), - cl.Rewrite(UTF8ToUTF16("vi"))); - EXPECT_EQ(cl.Rewrite(UTF8ToUTF16("metropolitana de santiago de chile")), - cl.Rewrite(UTF8ToUTF16("metropolitana de santiago"))); + AddressRewriter cl = AddressRewriter::ForCountryCode(u"cl"); + EXPECT_EQ(cl.Rewrite(u"aisen del general carlos ibanez del campo"), + cl.Rewrite(u"xi")); + EXPECT_EQ(cl.Rewrite(u"libertador general bernardo o'higgins"), + cl.Rewrite(u"vi")); + EXPECT_EQ(cl.Rewrite(u"metropolitana de santiago de chile"), + cl.Rewrite(u"metropolitana de santiago")); } TEST(AddressRewriterTest, CO) { - AddressRewriter co = AddressRewriter::ForCountryCode(UTF8ToUTF16("co")); - EXPECT_EQ(co.Rewrite(UTF8ToUTF16("columbia")), - co.Rewrite(UTF8ToUTF16("colombia"))); + AddressRewriter co = AddressRewriter::ForCountryCode(u"co"); + EXPECT_EQ(co.Rewrite(u"columbia"), co.Rewrite(u"colombia")); } TEST(AddressRewriterTest, DE) { - AddressRewriter de = AddressRewriter::ForCountryCode(UTF8ToUTF16("de")); - EXPECT_EQ(de.Rewrite(UTF8ToUTF16("federal republic of germany")), - de.Rewrite(UTF8ToUTF16("deutschland"))); - EXPECT_EQ(de.Rewrite(UTF8ToUTF16("germany")), - de.Rewrite(UTF8ToUTF16("bundesrepublik deutschland"))); + AddressRewriter de = AddressRewriter::ForCountryCode(u"de"); + EXPECT_EQ(de.Rewrite(u"federal republic of germany"), + de.Rewrite(u"deutschland")); + EXPECT_EQ(de.Rewrite(u"germany"), de.Rewrite(u"bundesrepublik deutschland")); } TEST(AddressRewriterTest, DK) { - AddressRewriter dk = AddressRewriter::ForCountryCode(UTF8ToUTF16("dk")); - EXPECT_EQ(dk.Rewrite(UTF8ToUTF16("denmark")), - dk.Rewrite(UTF8ToUTF16("danmark"))); + AddressRewriter dk = AddressRewriter::ForCountryCode(u"dk"); + EXPECT_EQ(dk.Rewrite(u"denmark"), dk.Rewrite(u"danmark")); } TEST(AddressRewriterTest, ES) { - AddressRewriter es = AddressRewriter::ForCountryCode(UTF8ToUTF16("es")); - EXPECT_EQ(es.Rewrite(UTF8ToUTF16("balearic islands")), - es.Rewrite(UTF8ToUTF16("islas baleares"))); + AddressRewriter es = AddressRewriter::ForCountryCode(u"es"); + EXPECT_EQ(es.Rewrite(u"balearic islands"), es.Rewrite(u"islas baleares")); } TEST(AddressRewriterTest, FR) { - AddressRewriter fr = AddressRewriter::ForCountryCode(UTF8ToUTF16("fr")); - EXPECT_EQ(fr.Rewrite(UTF8ToUTF16("quatorzieme")), - fr.Rewrite(UTF8ToUTF16("14"))); + AddressRewriter fr = AddressRewriter::ForCountryCode(u"fr"); + EXPECT_EQ(fr.Rewrite(u"quatorzieme"), fr.Rewrite(u"14")); } TEST(AddressRewriterTest, GB) { - AddressRewriter gb = AddressRewriter::ForCountryCode(UTF8ToUTF16("gb")); - EXPECT_EQ(gb.Rewrite(UTF8ToUTF16("north east lincolnshire")), - gb.Rewrite(UTF8ToUTF16("gb-nel"))); + AddressRewriter gb = AddressRewriter::ForCountryCode(u"gb"); + EXPECT_EQ(gb.Rewrite(u"north east lincolnshire"), gb.Rewrite(u"gb-nel")); - EXPECT_NE(gb.Rewrite(UTF8ToUTF16("norfolk")), - gb.Rewrite(UTF8ToUTF16("suffolk"))); + EXPECT_NE(gb.Rewrite(u"norfolk"), gb.Rewrite(u"suffolk")); } TEST(AddressRewriterTest, GR) { - AddressRewriter gr = AddressRewriter::ForCountryCode(UTF8ToUTF16("gr")); - EXPECT_EQ(gr.Rewrite(UTF8ToUTF16("aitolia kai akarnania")), - gr.Rewrite(UTF8ToUTF16("aitoloakarnania"))); + AddressRewriter gr = AddressRewriter::ForCountryCode(u"gr"); + EXPECT_EQ(gr.Rewrite(u"aitolia kai akarnania"), + gr.Rewrite(u"aitoloakarnania")); } TEST(AddressRewriterTest, HK) { - AddressRewriter hk = AddressRewriter::ForCountryCode(UTF8ToUTF16("hk")); - EXPECT_EQ(hk.Rewrite(UTF8ToUTF16("hong kong")), - hk.Rewrite(UTF8ToUTF16("hk"))); + AddressRewriter hk = AddressRewriter::ForCountryCode(u"hk"); + EXPECT_EQ(hk.Rewrite(u"hong kong"), hk.Rewrite(u"hk")); } TEST(AddressRewriterTest, ID) { - AddressRewriter id = AddressRewriter::ForCountryCode(UTF8ToUTF16("id")); - EXPECT_EQ(id.Rewrite(UTF8ToUTF16("nanggroe aceh darussalam")), - id.Rewrite(UTF8ToUTF16("aceh"))); + AddressRewriter id = AddressRewriter::ForCountryCode(u"id"); + EXPECT_EQ(id.Rewrite(u"nanggroe aceh darussalam"), id.Rewrite(u"aceh")); } TEST(AddressRewriterTest, IE) { - AddressRewriter ie = AddressRewriter::ForCountryCode(UTF8ToUTF16("ie")); - EXPECT_EQ(ie.Rewrite(UTF8ToUTF16("avenue")), ie.Rewrite(UTF8ToUTF16("ave"))); + AddressRewriter ie = AddressRewriter::ForCountryCode(u"ie"); + EXPECT_EQ(ie.Rewrite(u"avenue"), ie.Rewrite(u"ave")); } TEST(AddressRewriterTest, IN) { - AddressRewriter in = AddressRewriter::ForCountryCode(UTF8ToUTF16("in")); - EXPECT_EQ(in.Rewrite(UTF8ToUTF16("thiruvananthapuram")), - in.Rewrite(UTF8ToUTF16("tiruvananthapuram"))); - EXPECT_EQ(in.Rewrite(UTF8ToUTF16("jammu & kashmir")), - in.Rewrite(UTF8ToUTF16("j&k"))); - EXPECT_EQ(in.Rewrite(UTF8ToUTF16("cross-road")), - in.Rewrite(UTF8ToUTF16("xrd"))); - EXPECT_EQ(in.Rewrite(UTF8ToUTF16("j & k")), in.Rewrite(UTF8ToUTF16("j&k"))); - EXPECT_EQ(in.Rewrite(UTF8ToUTF16("i.n.d.i.a")), - in.Rewrite(UTF8ToUTF16("india"))); - EXPECT_NE(in.Rewrite(UTF8ToUTF16("i\\_n\\_d\\_i\\_a")), - in.Rewrite(UTF8ToUTF16("india"))); + AddressRewriter in = AddressRewriter::ForCountryCode(u"in"); + EXPECT_EQ(in.Rewrite(u"thiruvananthapuram"), + in.Rewrite(u"tiruvananthapuram")); + EXPECT_EQ(in.Rewrite(u"jammu & kashmir"), in.Rewrite(u"j&k")); + EXPECT_EQ(in.Rewrite(u"cross-road"), in.Rewrite(u"xrd")); + EXPECT_EQ(in.Rewrite(u"j & k"), in.Rewrite(u"j&k")); + EXPECT_EQ(in.Rewrite(u"i.n.d.i.a"), in.Rewrite(u"india")); + EXPECT_NE(in.Rewrite(UTF8ToUTF16("i\\_n\\_d\\_i\\_a")), in.Rewrite(u"india")); } TEST(AddressRewriterTest, IT) { - AddressRewriter it = AddressRewriter::ForCountryCode(UTF8ToUTF16("it")); - EXPECT_EQ(it.Rewrite(UTF8ToUTF16("trentino alto adige")), - it.Rewrite(UTF8ToUTF16("trentino sudtirol"))); + AddressRewriter it = AddressRewriter::ForCountryCode(u"it"); + EXPECT_EQ(it.Rewrite(u"trentino alto adige"), + it.Rewrite(u"trentino sudtirol")); } TEST(AddressRewriterTest, LU) { - AddressRewriter lu = AddressRewriter::ForCountryCode(UTF8ToUTF16("lu")); - EXPECT_EQ(lu.Rewrite(UTF8ToUTF16("esplanade")), - lu.Rewrite(UTF8ToUTF16("espl"))); + AddressRewriter lu = AddressRewriter::ForCountryCode(u"lu"); + EXPECT_EQ(lu.Rewrite(u"esplanade"), lu.Rewrite(u"espl")); } TEST(AddressRewriterTest, MX) { - AddressRewriter mx = AddressRewriter::ForCountryCode(UTF8ToUTF16("mx")); - EXPECT_EQ(mx.Rewrite(UTF8ToUTF16("estado de mexico")), - mx.Rewrite(UTF8ToUTF16("mexico"))); + AddressRewriter mx = AddressRewriter::ForCountryCode(u"mx"); + EXPECT_EQ(mx.Rewrite(u"estado de mexico"), mx.Rewrite(u"mexico")); } TEST(AddressRewriterTest, MY) { - AddressRewriter my = AddressRewriter::ForCountryCode(UTF8ToUTF16("my")); - EXPECT_EQ(my.Rewrite(UTF8ToUTF16("malaysia")), my.Rewrite(UTF8ToUTF16("my"))); + AddressRewriter my = AddressRewriter::ForCountryCode(u"my"); + EXPECT_EQ(my.Rewrite(u"malaysia"), my.Rewrite(u"my")); } TEST(AddressRewriterTest, NL) { - AddressRewriter nl = AddressRewriter::ForCountryCode(UTF8ToUTF16("nl")); - EXPECT_EQ(nl.Rewrite(UTF8ToUTF16("nordholland")), - nl.Rewrite(UTF8ToUTF16("noord holland"))); + AddressRewriter nl = AddressRewriter::ForCountryCode(u"nl"); + EXPECT_EQ(nl.Rewrite(u"nordholland"), nl.Rewrite(u"noord holland")); } TEST(AddressRewriterTest, NZ) { - AddressRewriter nz = AddressRewriter::ForCountryCode(UTF8ToUTF16("nz")); - EXPECT_EQ(nz.Rewrite(UTF8ToUTF16("oceanbeach")), - nz.Rewrite(UTF8ToUTF16("ocean beach"))); + AddressRewriter nz = AddressRewriter::ForCountryCode(u"nz"); + EXPECT_EQ(nz.Rewrite(u"oceanbeach"), nz.Rewrite(u"ocean beach")); } TEST(AddressRewriterTest, PE) { - AddressRewriter pe = AddressRewriter::ForCountryCode(UTF8ToUTF16("pe")); - EXPECT_EQ(pe.Rewrite(UTF8ToUTF16("avenida")), pe.Rewrite(UTF8ToUTF16("av"))); + AddressRewriter pe = AddressRewriter::ForCountryCode(u"pe"); + EXPECT_EQ(pe.Rewrite(u"avenida"), pe.Rewrite(u"av")); } TEST(AddressRewriterTest, PH) { - AddressRewriter ph = AddressRewriter::ForCountryCode(UTF8ToUTF16("ph")); - EXPECT_EQ(ph.Rewrite(UTF8ToUTF16("philippines")), - ph.Rewrite(UTF8ToUTF16("ph"))); + AddressRewriter ph = AddressRewriter::ForCountryCode(u"ph"); + EXPECT_EQ(ph.Rewrite(u"philippines"), ph.Rewrite(u"ph")); } TEST(AddressRewriterTest, PL) { - AddressRewriter pl = AddressRewriter::ForCountryCode(UTF8ToUTF16("pl")); - EXPECT_EQ(pl.Rewrite(UTF8ToUTF16("warmian masurian")), - pl.Rewrite(UTF8ToUTF16("warminsko"))); + AddressRewriter pl = AddressRewriter::ForCountryCode(u"pl"); + EXPECT_EQ(pl.Rewrite(u"warmian masurian"), pl.Rewrite(u"warminsko")); } TEST(AddressRewriterTest, PR) { - AddressRewriter pr = AddressRewriter::ForCountryCode(UTF8ToUTF16("pr")); - EXPECT_EQ(pr.Rewrite(UTF8ToUTF16("san juan antiguo")), - pr.Rewrite(UTF8ToUTF16("old san juan"))); + AddressRewriter pr = AddressRewriter::ForCountryCode(u"pr"); + EXPECT_EQ(pr.Rewrite(u"san juan antiguo"), pr.Rewrite(u"old san juan")); } TEST(AddressRewriterTest, PT) { - AddressRewriter pt = AddressRewriter::ForCountryCode(UTF8ToUTF16("pt")); - EXPECT_EQ(pt.Rewrite(UTF8ToUTF16("doctor")), - pt.Rewrite(UTF8ToUTF16("doutor"))); + AddressRewriter pt = AddressRewriter::ForCountryCode(u"pt"); + EXPECT_EQ(pt.Rewrite(u"doctor"), pt.Rewrite(u"doutor")); } TEST(AddressRewriterTest, RO) { - AddressRewriter ro = AddressRewriter::ForCountryCode(UTF8ToUTF16("ro")); - EXPECT_EQ(ro.Rewrite(UTF8ToUTF16("romania")), ro.Rewrite(UTF8ToUTF16("ro"))); + AddressRewriter ro = AddressRewriter::ForCountryCode(u"ro"); + EXPECT_EQ(ro.Rewrite(u"romania"), ro.Rewrite(u"ro")); } TEST(AddressRewriterTest, RU) { - AddressRewriter ru = AddressRewriter::ForCountryCode(UTF8ToUTF16("ru")); + AddressRewriter ru = AddressRewriter::ForCountryCode(u"ru"); // TODO(rogerm): UTF8 matching isnt' working as expected. Fix it! - EXPECT_NE(ru.Rewrite(UTF8ToUTF16("россия")), - ru.Rewrite(UTF8ToUTF16("russia"))); + EXPECT_NE(ru.Rewrite(u"россия"), ru.Rewrite(u"russia")); } TEST(AddressRewriterTest, SE) { - AddressRewriter se = AddressRewriter::ForCountryCode(UTF8ToUTF16("se")); - EXPECT_EQ(se.Rewrite(UTF8ToUTF16("oestergoetland")), - se.Rewrite(UTF8ToUTF16("vastergoetland"))); + AddressRewriter se = AddressRewriter::ForCountryCode(u"se"); + EXPECT_EQ(se.Rewrite(u"oestergoetland"), se.Rewrite(u"vastergoetland")); } TEST(AddressRewriterTest, TH) { - AddressRewriter th = AddressRewriter::ForCountryCode(UTF8ToUTF16("th")); + AddressRewriter th = AddressRewriter::ForCountryCode(u"th"); // TODO(rogerm): UTF8 matching isnt' working as expected. Fix it! - EXPECT_NE(th.Rewrite(UTF8ToUTF16("ประเทศไทย")), - th.Rewrite(UTF8ToUTF16("thailand"))); + EXPECT_NE(th.Rewrite(u"ประเทศไทย"), th.Rewrite(u"thailand")); } TEST(AddressRewriterTest, TR) { - AddressRewriter tr = AddressRewriter::ForCountryCode(UTF8ToUTF16("tr")); - EXPECT_EQ(tr.Rewrite(UTF8ToUTF16("turkiye")), - tr.Rewrite(UTF8ToUTF16("turkey"))); + AddressRewriter tr = AddressRewriter::ForCountryCode(u"tr"); + EXPECT_EQ(tr.Rewrite(u"turkiye"), tr.Rewrite(u"turkey")); } TEST(AddressRewriterTest, US) { - AddressRewriter us = AddressRewriter::ForCountryCode(UTF8ToUTF16("us")); - EXPECT_EQ(us.Rewrite(UTF8ToUTF16("ca")), - us.Rewrite(UTF8ToUTF16("california"))); - EXPECT_EQ(us.Rewrite(UTF8ToUTF16("west virginia")), - us.Rewrite(UTF8ToUTF16("wv"))); - EXPECT_EQ(us.Rewrite(UTF8ToUTF16("virginia")), us.Rewrite(UTF8ToUTF16("va"))); - EXPECT_EQ(us.Rewrite(UTF8ToUTF16("washington d c")), - us.Rewrite(UTF8ToUTF16("washington dc"))); + AddressRewriter us = AddressRewriter::ForCountryCode(u"us"); + EXPECT_EQ(us.Rewrite(u"ca"), us.Rewrite(u"california")); + EXPECT_EQ(us.Rewrite(u"west virginia"), us.Rewrite(u"wv")); + EXPECT_EQ(us.Rewrite(u"virginia"), us.Rewrite(u"va")); + EXPECT_EQ(us.Rewrite(u"washington d c"), us.Rewrite(u"washington dc")); // Similar names, but not the same. - EXPECT_NE(us.Rewrite(UTF8ToUTF16("west virginia")), - us.Rewrite(UTF8ToUTF16("virginia"))); - EXPECT_NE(us.Rewrite(UTF8ToUTF16("washington")), - us.Rewrite(UTF8ToUTF16("washington dc"))); + EXPECT_NE(us.Rewrite(u"west virginia"), us.Rewrite(u"virginia")); + EXPECT_NE(us.Rewrite(u"washington"), us.Rewrite(u"washington dc")); } TEST(AddressRewriterTest, VN) { - AddressRewriter vn = AddressRewriter::ForCountryCode(UTF8ToUTF16("vn")); - EXPECT_EQ(vn.Rewrite(UTF8ToUTF16("viet nam")), - vn.Rewrite(UTF8ToUTF16("vietnam"))); + AddressRewriter vn = AddressRewriter::ForCountryCode(u"vn"); + EXPECT_EQ(vn.Rewrite(u"viet nam"), vn.Rewrite(u"vietnam")); } TEST(AddressRewriterTest, ZA) { - AddressRewriter za = AddressRewriter::ForCountryCode(UTF8ToUTF16("za")); - EXPECT_EQ(za.Rewrite(UTF8ToUTF16("republic of south africa")), - za.Rewrite(UTF8ToUTF16("south africa"))); + AddressRewriter za = AddressRewriter::ForCountryCode(u"za"); + EXPECT_EQ(za.Rewrite(u"republic of south africa"), + za.Rewrite(u"south africa")); } diff --git a/components/autofill/core/browser/autofill_download_manager_unittest.cc b/components/autofill/core/browser/autofill_download_manager_unittest.cc index 0ade6a258411e6..ddaf6fd8c7f5c5 100644 --- a/components/autofill/core/browser/autofill_download_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_download_manager_unittest.cc @@ -263,38 +263,38 @@ TEST_F(AutofillDownloadManagerTest, QueryAndUploadTest) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("username"); - field.name = UTF8ToUTF16("username"); + field.label = u"username"; + field.name = u"username"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("First Name"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name"; + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("email"); - field.name = UTF8ToUTF16("email"); + field.label = u"email"; + field.name = u"email"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("email2"); - field.name = UTF8ToUTF16("email2"); + field.label = u"email2"; + field.name = u"email2"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("password"); - field.name = UTF8ToUTF16("password"); + field.label = u"password"; + field.name = u"password"; field.form_control_type = "password"; form.fields.push_back(field); field.label = std::u16string(); - field.name = UTF8ToUTF16("Submit"); + field.name = u"Submit"; field.form_control_type = "submit"; form.fields.push_back(field); @@ -303,23 +303,23 @@ TEST_F(AutofillDownloadManagerTest, QueryAndUploadTest) { form.fields.clear(); - field.label = UTF8ToUTF16("address"); - field.name = UTF8ToUTF16("address"); + field.label = u"address"; + field.name = u"address"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("address2"); - field.name = UTF8ToUTF16("address2"); + field.label = u"address2"; + field.name = u"address2"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("city"); - field.name = UTF8ToUTF16("city"); + field.label = u"city"; + field.name = u"city"; field.form_control_type = "text"; form.fields.push_back(field); field.label = std::u16string(); - field.name = UTF8ToUTF16("Submit"); + field.name = u"Submit"; field.form_control_type = "submit"; form.fields.push_back(field); @@ -327,18 +327,18 @@ TEST_F(AutofillDownloadManagerTest, QueryAndUploadTest) { form.fields.clear(); - field.label = UTF8ToUTF16("username"); - field.name = UTF8ToUTF16("username"); + field.label = u"username"; + field.name = u"username"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("password"); - field.name = UTF8ToUTF16("password"); + field.label = u"password"; + field.name = u"password"; field.form_control_type = "password"; form.fields.push_back(field); field.label = std::u16string(); - field.name = UTF8ToUTF16("Submit"); + field.name = u"Submit"; field.form_control_type = "submit"; form.fields.push_back(field); @@ -449,8 +449,8 @@ TEST_F(AutofillDownloadManagerTest, QueryAndUploadTest) { responses_.pop_front(); // Modify form structures to miss the cache. - field.label = UTF8ToUTF16("Address line 2"); - field.name = UTF8ToUTF16("address2"); + field.label = u"Address line 2"; + field.name = u"address2"; field.form_control_type = "text"; form.fields.push_back(field); form_structures.push_back(std::make_unique(form)); @@ -501,8 +501,8 @@ TEST_F(AutofillDownloadManagerTest, QueryAndUploadTest) { fl2.InitAndDisableFeature(features::kAutofillCacheQueryResponses); // Don't hit the in-mem cache. - field.label = UTF8ToUTF16("Address line 3"); - field.name = UTF8ToUTF16("address3"); + field.label = u"Address line 3"; + field.name = u"address3"; field.form_control_type = "text"; form.fields.push_back(field); form_structures.push_back(std::make_unique(form)); @@ -524,13 +524,13 @@ TEST_F(AutofillDownloadManagerTest, QueryAPITest) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("First Name"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name"; + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); @@ -623,8 +623,8 @@ TEST_F(AutofillDownloadManagerTest, QueryAPITestWhenTooLongUrl) { // Build the form structures that we want to query. FormData form; FormFieldData field; - field.label = UTF8ToUTF16("First Name"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); @@ -732,13 +732,13 @@ TEST_F(AutofillDownloadManagerTest, UploadToAPITest) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("First Name"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name"; + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); FormStructure form_structure(form); @@ -808,14 +808,14 @@ TEST_F(AutofillDownloadManagerTest, UploadWithRawMetadata) { << is_raw_metadata_uploading_enabled); // Build the form structures that we want to upload. FormData form; - form.name = UTF8ToUTF16("form1"); + form.name = u"form1"; FormFieldData field; - field.name = UTF8ToUTF16("firstname"); + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); - field.name = UTF8ToUTF16("lastname"); + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); FormStructure form_structure(form); @@ -871,23 +871,23 @@ TEST_F(AutofillDownloadManagerTest, UploadWithRawMetadata) { TEST_F(AutofillDownloadManagerTest, BackoffLogic_Query) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("address"); - field.name = UTF8ToUTF16("address"); + field.label = u"address"; + field.name = u"address"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("address2"); - field.name = UTF8ToUTF16("address2"); + field.label = u"address2"; + field.name = u"address2"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("city"); - field.name = UTF8ToUTF16("city"); + field.label = u"city"; + field.name = u"city"; field.form_control_type = "text"; form.fields.push_back(field); field.label = std::u16string(); - field.name = UTF8ToUTF16("Submit"); + field.name = u"Submit"; field.form_control_type = "submit"; form.fields.push_back(field); @@ -942,23 +942,23 @@ TEST_F(AutofillDownloadManagerTest, BackoffLogic_Query) { TEST_F(AutofillDownloadManagerTest, BackoffLogic_Upload) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("address"); - field.name = UTF8ToUTF16("address"); + field.label = u"address"; + field.name = u"address"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("address2"); - field.name = UTF8ToUTF16("address2"); + field.label = u"address2"; + field.name = u"address2"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("city"); - field.name = UTF8ToUTF16("city"); + field.label = u"city"; + field.name = u"city"; field.form_control_type = "text"; form.fields.push_back(field); field.label = std::u16string(); - field.name = UTF8ToUTF16("Submit"); + field.name = u"Submit"; field.form_control_type = "submit"; form.fields.push_back(field); @@ -1030,23 +1030,23 @@ TEST_F(AutofillDownloadManagerTest, BackoffLogic_Upload) { TEST_F(AutofillDownloadManagerTest, RetryLimit_Query) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("address"); - field.name = UTF8ToUTF16("address"); + field.label = u"address"; + field.name = u"address"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("address2"); - field.name = UTF8ToUTF16("address2"); + field.label = u"address2"; + field.name = u"address2"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("city"); - field.name = UTF8ToUTF16("city"); + field.label = u"city"; + field.name = u"city"; field.form_control_type = "text"; form.fields.push_back(field); field.label = std::u16string(); - field.name = UTF8ToUTF16("Submit"); + field.name = u"Submit"; field.form_control_type = "submit"; form.fields.push_back(field); @@ -1107,23 +1107,23 @@ TEST_F(AutofillDownloadManagerTest, RetryLimit_Query) { TEST_F(AutofillDownloadManagerTest, RetryLimit_Upload) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("address"); - field.name = UTF8ToUTF16("address"); + field.label = u"address"; + field.name = u"address"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("address2"); - field.name = UTF8ToUTF16("address2"); + field.label = u"address2"; + field.name = u"address2"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("city"); - field.name = UTF8ToUTF16("city"); + field.label = u"city"; + field.name = u"city"; field.form_control_type = "text"; form.fields.push_back(field); field.label = std::u16string(); - field.name = UTF8ToUTF16("Submit"); + field.name = u"Submit"; field.form_control_type = "submit"; form.fields.push_back(field); @@ -1231,32 +1231,32 @@ TEST_F(AutofillDownloadManagerTest, CacheQueryTest) { FormFieldData field; field.form_control_type = "text"; - field.label = UTF8ToUTF16("username"); - field.name = UTF8ToUTF16("username"); + field.label = u"username"; + field.name = u"username"; form.fields.push_back(field); - field.label = UTF8ToUTF16("First Name"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name"; + field.name = u"firstname"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name"; + field.name = u"lastname"; form.fields.push_back(field); std::vector> form_structures0; form_structures0.push_back(std::make_unique(form)); // Add a slightly different form, which should result in a different request. - field.label = UTF8ToUTF16("email"); - field.name = UTF8ToUTF16("email"); + field.label = u"email"; + field.name = u"email"; form.fields.push_back(field); std::vector> form_structures1; form_structures1.push_back(std::make_unique(form)); // Add another slightly different form, which should also result in a // different request. - field.label = UTF8ToUTF16("email2"); - field.name = UTF8ToUTF16("email2"); + field.label = u"email2"; + field.name = u"email2"; form.fields.push_back(field); std::vector> form_structures2; form_structures2.push_back(std::make_unique(form)); @@ -1579,8 +1579,8 @@ TEST_P(AutofillServerCommunicationTest, Query) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); @@ -1594,18 +1594,18 @@ TEST_P(AutofillServerCommunicationTest, Upload) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name:"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name:"; + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Email:"); - field.name = UTF8ToUTF16("email"); + field.label = u"Email:"; + field.name = u"email"; field.form_control_type = "text"; form.fields.push_back(field); @@ -1626,8 +1626,8 @@ using AutofillQueryTest = AutofillServerCommunicationTest; TEST_P(AutofillQueryTest, CacheableResponse) { FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; FormData form; @@ -1666,8 +1666,8 @@ TEST_P(AutofillQueryTest, CacheableResponse) { TEST_P(AutofillQueryTest, SendsExperiment) { FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; FormData form; @@ -1737,8 +1737,8 @@ TEST_P(AutofillQueryTest, SendsExperiment) { TEST_P(AutofillQueryTest, ExpiredCacheInResponse) { FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; FormData form; @@ -1790,45 +1790,45 @@ TEST_P(AutofillQueryTest, RichMetadata_Enabled) { FormData form; form.url = GURL("https://origin.com"); form.action = GURL("https://origin.com/submit-me"); - form.id_attribute = UTF8ToUTF16("form-id-attribute"); - form.name_attribute = UTF8ToUTF16("form-name-attribute"); + form.id_attribute = u"form-id-attribute"; + form.name_attribute = u"form-name-attribute"; form.name = form.name_attribute; // Add field 0. FormFieldData field; - field.id_attribute = UTF8ToUTF16("field-id-attribute-1"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-1"); + field.id_attribute = u"field-id-attribute-1"; + field.name_attribute = u"field-name-attribute-1"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-description"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-description"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); // Add field 1. - field.id_attribute = UTF8ToUTF16("field-id-attribute-2"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-2"); + field.id_attribute = u"field-id-attribute-2"; + field.name_attribute = u"field-name-attribute-2"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-description"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-description"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); // Add field 2. - field.id_attribute = UTF8ToUTF16("field-id-attribute-3"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-3"); + field.id_attribute = u"field-id-attribute-3"; + field.name_attribute = u"field-name-attribute-3"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-description"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-description"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); // Setup the form structures to query. @@ -1890,45 +1890,45 @@ TEST_P(AutofillQueryTest, RichMetadata_Disabled) { FormData form; form.url = GURL("https://origin.com"); form.action = GURL("https://origin.com/submit-me"); - form.id_attribute = UTF8ToUTF16("form-id-attribute"); - form.name_attribute = UTF8ToUTF16("form-name-attribute"); + form.id_attribute = u"form-id-attribute"; + form.name_attribute = u"form-name-attribute"; form.name = form.name_attribute; // Add field 0. FormFieldData field; - field.id_attribute = UTF8ToUTF16("field-id-attribute-1"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-1"); + field.id_attribute = u"field-id-attribute-1"; + field.name_attribute = u"field-name-attribute-1"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-description"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-description"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); // Add field 1. - field.id_attribute = UTF8ToUTF16("field-id-attribute-2"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-2"); + field.id_attribute = u"field-id-attribute-2"; + field.name_attribute = u"field-name-attribute-2"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-description"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-description"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); // Add field 2. - field.id_attribute = UTF8ToUTF16("field-id-attribute-3"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-3"); + field.id_attribute = u"field-id-attribute-3"; + field.name_attribute = u"field-name-attribute-3"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-description"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-description"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); // Setup the form structures to query. @@ -1981,42 +1981,42 @@ TEST_P(AutofillUploadTest, RichMetadata) { form.url = GURL("https://origin.com"); form.full_url = GURL("https://origin.com?foo=bar#foo"); form.action = GURL("https://origin.com/submit-me"); - form.id_attribute = UTF8ToUTF16("form-id_attribute"); - form.name_attribute = UTF8ToUTF16("form-id_attribute"); + form.id_attribute = u"form-id_attribute"; + form.name_attribute = u"form-id_attribute"; form.name = form.name_attribute; FormFieldData field; - field.id_attribute = UTF8ToUTF16("field-id-attribute-1"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-1"); + field.id_attribute = u"field-id-attribute-1"; + field.name_attribute = u"field-name-attribute-1"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-descriptionm"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-descriptionm"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); - field.id_attribute = UTF8ToUTF16("field-id-attribute-2"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-2"); + field.id_attribute = u"field-id-attribute-2"; + field.name_attribute = u"field-name-attribute-2"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-descriptionm"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-descriptionm"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); - field.id_attribute = UTF8ToUTF16("field-id-attribute-3"); - field.name_attribute = UTF8ToUTF16("field-name-attribute-3"); + field.id_attribute = u"field-id-attribute-3"; + field.name_attribute = u"field-name-attribute-3"; field.name = field.name_attribute; - field.label = UTF8ToUTF16("field-label"); - field.aria_label = UTF8ToUTF16("field-aria-label"); - field.aria_description = UTF8ToUTF16("field-aria-descriptionm"); + field.label = u"field-label"; + field.aria_label = u"field-aria-label"; + field.aria_description = u"field-aria-descriptionm"; field.form_control_type = "text"; - field.css_classes = UTF8ToUTF16("field-css-classes"); - field.placeholder = UTF8ToUTF16("field-placeholder"); + field.css_classes = u"field-css-classes"; + field.placeholder = u"field-placeholder"; form.fields.push_back(field); AutofillDownloadManager download_manager(driver_.get(), this); @@ -2087,18 +2087,18 @@ TEST_P(AutofillUploadTest, Throttling) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name:"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name:"; + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Email:"); - field.name = UTF8ToUTF16("email"); + field.label = u"Email:"; + field.name = u"email"; field.form_control_type = "text"; form.fields.push_back(field); @@ -2144,20 +2144,20 @@ TEST_P(AutofillUploadTest, ThrottlingDisabled) { FormData small_form; FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); small_form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name:"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name:"; + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); small_form.fields.push_back(field); - field.label = UTF8ToUTF16("Email:"); - field.name = UTF8ToUTF16("email"); + field.label = u"Email:"; + field.name = u"email"; field.form_control_type = "text"; form.fields.push_back(field); @@ -2228,18 +2228,18 @@ TEST_P(AutofillUploadTest, PeriodicReset) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name:"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name:"; + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Email:"); - field.name = UTF8ToUTF16("email"); + field.label = u"Email:"; + field.name = u"email"; field.form_control_type = "text"; form.fields.push_back(field); @@ -2286,18 +2286,18 @@ TEST_P(AutofillUploadTest, ResetOnClearUploadHisotry) { FormData form; FormFieldData field; - field.label = UTF8ToUTF16("First Name:"); - field.name = UTF8ToUTF16("firstname"); + field.label = u"First Name:"; + field.name = u"firstname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Last Name:"); - field.name = UTF8ToUTF16("lastname"); + field.label = u"Last Name:"; + field.name = u"lastname"; field.form_control_type = "text"; form.fields.push_back(field); - field.label = UTF8ToUTF16("Email:"); - field.name = UTF8ToUTF16("email"); + field.label = u"Email:"; + field.name = u"email"; field.form_control_type = "text"; form.fields.push_back(field); diff --git a/components/autofill/core/browser/autofill_profile_validation_util_unittest.cc b/components/autofill/core/browser/autofill_profile_validation_util_unittest.cc index 1d834c2620c404..7efcd45d3d539f 100644 --- a/components/autofill/core/browser/autofill_profile_validation_util_unittest.cc +++ b/components/autofill/core/browser/autofill_profile_validation_util_unittest.cc @@ -136,7 +136,7 @@ TEST_F(AutofillProfileValidationUtilTest, // This is a profile with no country code, therefore it cannot be validated // according to contryinfo.txt. AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(ADDRESS_HOME_COUNTRY, base::UTF8ToUTF16("")); + profile.SetRawInfo(ADDRESS_HOME_COUNTRY, u""); ValidateAddressTest(&profile); EXPECT_EQ(AutofillDataModel::EMPTY, profile.GetValidityState(ADDRESS_HOME_COUNTRY, @@ -209,7 +209,7 @@ TEST_F(AutofillProfileValidationUtilTest, ValidateAddress_AdminAreaNotExists) { TEST_F(AutofillProfileValidationUtilTest, ValidateAddress_EmptyAdminArea) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("")); + profile.SetRawInfo(ADDRESS_HOME_STATE, u""); ValidateAddressTest(&profile); EXPECT_EQ(AutofillDataModel::VALID, @@ -402,7 +402,7 @@ TEST_F(AutofillProfileValidationUtilTest, ValidateAddress_InvalidZip) { TEST_F(AutofillProfileValidationUtilTest, ValidateAddress_EmptyZip) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("")); + profile.SetRawInfo(ADDRESS_HOME_ZIP, u""); ValidateAddressTest(&profile); EXPECT_EQ(AutofillDataModel::VALID, @@ -427,7 +427,7 @@ TEST_F(AutofillProfileValidationUtilTest, ValidateAddress_EmptyCity) { // field, the field is required. Therefore, a profile without a city field // would be an invalid profile. AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("")); + profile.SetRawInfo(ADDRESS_HOME_CITY, u""); ValidateAddressTest(&profile); EXPECT_EQ(AutofillDataModel::VALID, @@ -449,10 +449,10 @@ TEST_F(AutofillProfileValidationUtilTest, ValidateAddress_EmptyCity) { TEST_F(AutofillProfileValidationUtilTest, ValidateFullProfile_EmptyFields) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(ADDRESS_HOME_COUNTRY, base::UTF8ToUTF16("")); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("")); - profile.SetRawInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("")); - profile.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("")); + profile.SetRawInfo(ADDRESS_HOME_COUNTRY, u""); + profile.SetRawInfo(ADDRESS_HOME_STATE, u""); + profile.SetRawInfo(ADDRESS_HOME_CITY, u""); + profile.SetRawInfo(ADDRESS_HOME_ZIP, u""); ValidateAddressTest(&profile); EXPECT_EQ(AutofillDataModel::EMPTY, @@ -590,7 +590,7 @@ TEST_F(AutofillProfileValidationUtilTest, // China has a dependent locality field (aka district), but it's not required. AutofillProfile profile(autofill::test::GetFullValidProfileForChina()); - profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, base::UTF8ToUTF16("")); + profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, u""); ValidateAddressTest(&profile); EXPECT_EQ(AutofillDataModel::VALID, @@ -616,7 +616,7 @@ TEST_F(AutofillProfileValidationUtilTest, // but we should still validate it. AutofillProfile profile(autofill::test::GetFullValidProfileForChina()); - profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, base::UTF8ToUTF16("赫")); + profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, u"赫"); ValidateAddressTest(&profile); EXPECT_EQ(AutofillDataModel::VALID, @@ -644,8 +644,7 @@ TEST_F(AutofillProfileValidationUtilTest, // the district should be considered as INVALID. AutofillProfile profile(autofill::test::GetFullValidProfileForChina()); - profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, - base::UTF8ToUTF16("蒙城县")); + profile.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, u"蒙城县"); ValidateAddressTest(&profile); EXPECT_EQ(AutofillDataModel::VALID, @@ -894,7 +893,7 @@ TEST_F(AutofillProfileValidationUtilTest, ValidateProfile_FullValidProfileWithInvalidZip) { // This is a full valid profile: AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("ABC 123")); + profile.SetRawInfo(ADDRESS_HOME_ZIP, u"ABC 123"); ValidateProfileTest(&profile); EXPECT_EQ(AutofillDataModel::VALID, profile.GetValidityState(ADDRESS_HOME_COUNTRY, @@ -1066,7 +1065,7 @@ TEST_F(AutofillProfileValidationUtilTest, // District: "赫章县", City: "毕节地区", Province: "海南省", // Postal Code: "200120", Country Code: "CN", AutofillProfile profile(autofill::test::GetFullValidProfileForChina()); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("海南省")); + profile.SetRawInfo(ADDRESS_HOME_STATE, u"海南省"); ValidateProfileTest(&profile); @@ -1107,7 +1106,7 @@ TEST_F(AutofillProfileValidationUtilTest, // District: "赫章县", City: "毕节地区", Province: "", // Postal Code: "200120", Country Code: "CN", AutofillProfile profile(autofill::test::GetFullValidProfileForChina()); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("")); + profile.SetRawInfo(ADDRESS_HOME_STATE, u""); ValidateProfileTest(&profile); diff --git a/components/autofill/core/browser/autofill_profile_validator_unittest.cc b/components/autofill/core/browser/autofill_profile_validator_unittest.cc index 73d97ce9d4954b..455fa0302d477f 100644 --- a/components/autofill/core/browser/autofill_profile_validator_unittest.cc +++ b/components/autofill/core/browser/autofill_profile_validator_unittest.cc @@ -221,8 +221,7 @@ TEST_F(AutofillProfileValidatorTest, ValidateAddress_EmptyCountryCode) { // Validate a profile with an invalid phone. TEST_F(AutofillProfileValidatorTest, StartProfileValidation_InvalidPhone) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("Invalid Phone")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"Invalid Phone"); // Set up the test expectations. expected_validity_ = { @@ -241,7 +240,7 @@ TEST_F(AutofillProfileValidatorTest, StartProfileValidation_InvalidPhone) { // Validate a profile with a valid phone, valid email and invalid address. TEST_F(AutofillProfileValidatorTest, StartProfileValidation_InvalidAddress) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("Invalid State")); + profile.SetRawInfo(ADDRESS_HOME_STATE, u"Invalid State"); // Set up the test expectations. expected_validity_ = { @@ -262,7 +261,7 @@ TEST_F(AutofillProfileValidatorTest, StartProfileValidation_EmptyPhone_InvalidAddress) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, std::u16string()); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("Invalid State")); + profile.SetRawInfo(ADDRESS_HOME_STATE, u"Invalid State"); // Set up the test expectations. expected_validity_ = { @@ -283,7 +282,7 @@ TEST_F(AutofillProfileValidatorTest, StartProfileValidation_InvalidEmail_InvalidAddress) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); profile.SetRawInfo(EMAIL_ADDRESS, base::ASCIIToUTF16("Invalid Email")); - profile.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("Invalid Zip")); + profile.SetRawInfo(ADDRESS_HOME_ZIP, u"Invalid Zip"); // Set up the test expectations. expected_validity_ = { @@ -304,7 +303,7 @@ TEST_F(AutofillProfileValidatorTest, StartProfileValidation_EmptyEmail_InvalidZip) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); profile.SetRawInfo(EMAIL_ADDRESS, std::u16string()); - profile.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("Invalid Zip")); + profile.SetRawInfo(ADDRESS_HOME_ZIP, u"Invalid Zip"); // Set up the test expectations. expected_validity_ = { @@ -324,7 +323,7 @@ TEST_F(AutofillProfileValidatorTest, TEST_F(AutofillProfileValidatorTest, StartProfileValidation_InvalidEmail_EmptyZip) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); - profile.SetRawInfo(EMAIL_ADDRESS, base::UTF8ToUTF16("Invalid Email")); + profile.SetRawInfo(EMAIL_ADDRESS, u"Invalid Email"); profile.SetRawInfo(ADDRESS_HOME_ZIP, std::u16string()); // Set up the test expectations. @@ -346,8 +345,7 @@ TEST_F(AutofillProfileValidatorTest, StartProfileValidation_InvalidEmail_InvalidPhone) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); profile.SetRawInfo(EMAIL_ADDRESS, base::ASCIIToUTF16("Invalid Email")); - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("Invalid Phone")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"Invalid Phone"); // Set up the test expectations. expected_validity_ = { @@ -387,9 +385,8 @@ TEST_F(AutofillProfileValidatorTest, StartProfileValidation_InvalidEmail_InvalidPhone_InvalidAddress) { AutofillProfile profile(autofill::test::GetFullValidProfileForCanada()); profile.SetRawInfo(EMAIL_ADDRESS, base::ASCIIToUTF16("Invalid Email.")); - profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("Invalid Phone")); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("Invalid State")); + profile.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u"Invalid Phone"); + profile.SetRawInfo(ADDRESS_HOME_STATE, u"Invalid State"); // Set up the test expectations. expected_validity_ = { diff --git a/components/autofill/core/browser/data_model/address_unittest.cc b/components/autofill/core/browser/data_model/address_unittest.cc index 5f7527d5db513d..23703c84649157 100644 --- a/components/autofill/core/browser/data_model/address_unittest.cc +++ b/components/autofill/core/browser/data_model/address_unittest.cc @@ -678,8 +678,8 @@ TEST_P(AddressTest, TestMergeStructuredAddresses) { EXPECT_TRUE(address1.IsStructuredAddressMergeable(address2)); // The two zip codes have a is-substring relation and are mergeable. - address1.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("12345")); - address2.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("1234")); + address1.SetRawInfo(ADDRESS_HOME_ZIP, u"12345"); + address2.SetRawInfo(ADDRESS_HOME_ZIP, u"1234"); EXPECT_TRUE(address2.IsStructuredAddressMergeable(address1)); EXPECT_TRUE(address1.IsStructuredAddressMergeable(address2)); @@ -687,18 +687,18 @@ TEST_P(AddressTest, TestMergeStructuredAddresses) { // recently used. address1.MergeStructuredAddress(address2, /*newer_use_more_recently_used=*/false); - EXPECT_EQ(address1.GetRawInfo(ADDRESS_HOME_ZIP), base::UTF8ToUTF16("12345")); + EXPECT_EQ(address1.GetRawInfo(ADDRESS_HOME_ZIP), u"12345"); // Once it is more recently used, the value from address2 should be copied // into address1. address1.MergeStructuredAddress(address2, /*newer_use_more_recently_used=*/true); - EXPECT_EQ(address1.GetRawInfo(ADDRESS_HOME_ZIP), base::UTF8ToUTF16("1234")); + EXPECT_EQ(address1.GetRawInfo(ADDRESS_HOME_ZIP), u"1234"); // With a second incompatible ZIP code the addresses are not mergeable // anymore. Address address3; - address3.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("67890")); + address3.SetRawInfo(ADDRESS_HOME_ZIP, u"67890"); EXPECT_FALSE(address1.IsStructuredAddressMergeable(address3)); } @@ -710,13 +710,12 @@ TEST_P(AddressTest, TestGettingTheStructuredAddress) { // Create the address and set a test value. Address address1; - address1.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("12345")); + address1.SetRawInfo(ADDRESS_HOME_ZIP, u"12345"); // Get the structured address and verify that it has the same test value set. structured_address::Address structured_address = address1.GetStructuredAddress(); - EXPECT_EQ(structured_address.GetValueForType(ADDRESS_HOME_ZIP), - base::UTF8ToUTF16("12345")); + EXPECT_EQ(structured_address.GetValueForType(ADDRESS_HOME_ZIP), u"12345"); } // For structured address, test that the structured information is wiped diff --git a/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc b/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc index 43861f554caab4..db92fc924a14d1 100644 --- a/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc +++ b/components/autofill/core/browser/data_model/autofill_profile_comparator_unittest.cc @@ -384,18 +384,18 @@ class AutofillProfileComparatorTest } // namespace TEST_P(AutofillProfileComparatorTest, UniqueTokens) { - std::u16string kInput = UTF8ToUTF16("a b a a b"); - std::vector tokens = {UTF8ToUTF16("a"), UTF8ToUTF16("b")}; + std::u16string kInput = u"a b a a b"; + std::vector tokens = {u"a", u"b"}; EXPECT_EQ(std::set(tokens.begin(), tokens.end()), comparator_.UniqueTokens(kInput)); } TEST_P(AutofillProfileComparatorTest, CompareTokens) { - std::u16string kEmptyStr = UTF8ToUTF16(""); - std::u16string kHello = UTF8ToUTF16("hello"); - std::u16string kHelloThere = UTF8ToUTF16("hello there"); - std::u16string kHelloThereAlice = UTF8ToUTF16("hello there alice"); - std::u16string kHelloThereBob = UTF8ToUTF16("hello there bob"); + std::u16string kEmptyStr = u""; + std::u16string kHello = u"hello"; + std::u16string kHelloThere = u"hello there"; + std::u16string kHelloThereAlice = u"hello there alice"; + std::u16string kHelloThereBob = u"hello there bob"; EXPECT_EQ(AutofillProfileComparator::SAME_TOKENS, comparator_.CompareTokens(kHelloThereBob, kHelloThereBob)); @@ -423,169 +423,135 @@ TEST_P(AutofillProfileComparatorTest, Compare) { AutofillProfileComparator::DISCARD_WHITESPACE)); // Checks that leading punctuation and white space are ignored. - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("., -()."), UTF8ToUTF16(""), - AutofillProfileComparator::RETAIN_WHITESPACE)); - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("., -()."), UTF8ToUTF16(""), - AutofillProfileComparator::DISCARD_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"., -().", u"", AutofillProfileComparator::RETAIN_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"., -().", u"", AutofillProfileComparator::DISCARD_WHITESPACE)); // Checks that trailing punctuation and white space are ignored. - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("a ., "), UTF8ToUTF16("a"), - AutofillProfileComparator::RETAIN_WHITESPACE)); - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("a ., "), UTF8ToUTF16("a"), - AutofillProfileComparator::DISCARD_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"a ., ", u"a", AutofillProfileComparator::RETAIN_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"a ., ", u"a", AutofillProfileComparator::DISCARD_WHITESPACE)); // Checks that embedded punctuation and white space is collapsed to a single // white space with RETAIN_WHITESPACE and is ignored with DISCARD_WHITESPACE. - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("a() - a"), UTF8ToUTF16("a a"), - AutofillProfileComparator::RETAIN_WHITESPACE)); - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("a() - a"), UTF8ToUTF16("aa"), - AutofillProfileComparator::DISCARD_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"a() - a", u"a a", AutofillProfileComparator::RETAIN_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"a() - a", u"aa", AutofillProfileComparator::DISCARD_WHITESPACE)); // Checks that characters such as 'œ' respect the status quo established by // NormalizeForComparison. - EXPECT_FALSE(comparator_.Compare(UTF8ToUTF16("œil"), UTF8ToUTF16("oeil"))); + EXPECT_FALSE(comparator_.Compare(u"œil", u"oeil")); // Checks that a substring of the string is not considered equal. - EXPECT_FALSE(comparator_.Compare(UTF8ToUTF16("A"), UTF8ToUTF16("Anna"))); + EXPECT_FALSE(comparator_.Compare(u"A", u"Anna")); - EXPECT_FALSE(comparator_.Compare(UTF8ToUTF16("Anna"), UTF8ToUTF16("A"))); + EXPECT_FALSE(comparator_.Compare(u"Anna", u"A")); // Checks that Compare behaves like NormalizeForComparison. Also, checks that // diacritics are removed. + EXPECT_TRUE(comparator_.Compare( + u"Timothé", u"timothe", AutofillProfileComparator::RETAIN_WHITESPACE)); EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("Timothé"), UTF8ToUTF16("timothe"), - AutofillProfileComparator::RETAIN_WHITESPACE)); - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16(" sven-åke "), UTF8ToUTF16("sven ake"), - AutofillProfileComparator::RETAIN_WHITESPACE)); - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("Ç 㸐"), UTF8ToUTF16("c 㸐"), + comparator_.Compare(u" sven-åke ", u"sven ake", AutofillProfileComparator::RETAIN_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"Ç 㸐", u"c 㸐", AutofillProfileComparator::RETAIN_WHITESPACE)); EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("902103214"), UTF8ToUTF16("90210-3214"), + comparator_.Compare(u"902103214", u"90210-3214", AutofillProfileComparator::DISCARD_WHITESPACE)); - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("Timothé-Noël Étienne Périer"), - UTF8ToUTF16("timothe noel etienne perier"), - AutofillProfileComparator::RETAIN_WHITESPACE)); - EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("1600 Amphitheatre, Pkwy."), - UTF8ToUTF16("1600 amphitheatre pkwy"), - AutofillProfileComparator::RETAIN_WHITESPACE)); EXPECT_TRUE(comparator_.Compare( - u"Mid\x2013Island\x2003 Plaza", UTF8ToUTF16("mid island plaza"), + u"Timothé-Noël Étienne Périer", u"timothe noel etienne perier", + AutofillProfileComparator::RETAIN_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"1600 Amphitheatre, Pkwy.", u"1600 amphitheatre pkwy", AutofillProfileComparator::RETAIN_WHITESPACE)); EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("1600 amphitheatre pkwy \n App. 2"), - UTF8ToUTF16("1600 amphitheatre pkwy app 2"), + comparator_.Compare(u"Mid\x2013Island\x2003 Plaza", u"mid island plaza", AutofillProfileComparator::RETAIN_WHITESPACE)); EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("まéÖä정"), UTF8ToUTF16("まeoa정"), + comparator_.Compare(UTF8ToUTF16("1600 amphitheatre pkwy \n App. 2"), + u"1600 amphitheatre pkwy app 2", AutofillProfileComparator::RETAIN_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"まéÖä정", u"まeoa정", AutofillProfileComparator::RETAIN_WHITESPACE)); + EXPECT_TRUE(comparator_.Compare( + u"유재석", u"유 재석", AutofillProfileComparator::DISCARD_WHITESPACE)); EXPECT_TRUE( - comparator_.Compare(UTF8ToUTF16("유재석"), UTF8ToUTF16("유 재석"), + comparator_.Compare(u"ビルゲイツ", u"ヒル・ケイツ", AutofillProfileComparator::DISCARD_WHITESPACE)); - EXPECT_TRUE(comparator_.Compare( - UTF8ToUTF16("ビルゲイツ"), UTF8ToUTF16("ヒル・ケイツ"), - AutofillProfileComparator::DISCARD_WHITESPACE)); } TEST_P(AutofillProfileComparatorTest, NormalizeForComparison) { - EXPECT_EQ(UTF8ToUTF16("timothe"), - comparator_.NormalizeForComparison(UTF8ToUTF16("Timothé"))); - EXPECT_EQ(UTF8ToUTF16("sven ake"), - comparator_.NormalizeForComparison(UTF8ToUTF16(" sven-åke "))); - EXPECT_EQ(UTF8ToUTF16("c 㸐"), - comparator_.NormalizeForComparison(UTF8ToUTF16("Ç 㸐"))); - EXPECT_EQ(UTF8ToUTF16("902103214"), + EXPECT_EQ(u"timothe", comparator_.NormalizeForComparison(u"Timothé")); + EXPECT_EQ(u"sven ake", comparator_.NormalizeForComparison(u" sven-åke ")); + EXPECT_EQ(u"c 㸐", comparator_.NormalizeForComparison(u"Ç 㸐")); + EXPECT_EQ(u"902103214", comparator_.NormalizeForComparison( - base::UTF8ToUTF16("90210-3214"), - AutofillProfileComparator::DISCARD_WHITESPACE)); - EXPECT_EQ(UTF8ToUTF16("timothe noel etienne perier"), - comparator_.NormalizeForComparison( - UTF8ToUTF16("Timothé-Noël Étienne Périer"))); + u"90210-3214", AutofillProfileComparator::DISCARD_WHITESPACE)); + EXPECT_EQ(u"timothe noel etienne perier", + comparator_.NormalizeForComparison(u"Timothé-Noël Étienne Périer")); // NOP. EXPECT_EQ(std::u16string(), comparator_.NormalizeForComparison(std::u16string())); // Simple punctuation removed. - EXPECT_EQ(UTF8ToUTF16("1600 amphitheatre pkwy"), - comparator_.NormalizeForComparison( - UTF8ToUTF16("1600 Amphitheatre, Pkwy."))); + EXPECT_EQ(u"1600 amphitheatre pkwy", + comparator_.NormalizeForComparison(u"1600 Amphitheatre, Pkwy.")); // Unicode punctuation (hyphen and space), multiple spaces collapsed. - EXPECT_EQ(UTF8ToUTF16("mid island plaza"), + EXPECT_EQ(u"mid island plaza", comparator_.NormalizeForComparison(u"Mid\x2013Island\x2003 Plaza")); // Newline character removed. - EXPECT_EQ(UTF8ToUTF16("1600 amphitheatre pkwy app 2"), + EXPECT_EQ(u"1600 amphitheatre pkwy app 2", comparator_.NormalizeForComparison( UTF8ToUTF16("1600 amphitheatre pkwy \n App. 2"))); // Diacritics removed. - EXPECT_EQ(UTF8ToUTF16("まeoa정"), - comparator_.NormalizeForComparison(UTF8ToUTF16("まéÖä정"))); + EXPECT_EQ(u"まeoa정", comparator_.NormalizeForComparison(u"まéÖä정")); // Spaces removed. - EXPECT_EQ(UTF8ToUTF16("유재석"), + EXPECT_EQ(u"유재석", comparator_.NormalizeForComparison( - UTF8ToUTF16("유 재석"), - AutofillProfileComparator::DISCARD_WHITESPACE)); + u"유 재석", AutofillProfileComparator::DISCARD_WHITESPACE)); // Punctuation removed, Japanese kana normalized. - EXPECT_EQ(UTF8ToUTF16("ヒルケイツ"), - comparator_.NormalizeForComparison( - UTF8ToUTF16("ビル・ゲイツ"), - AutofillProfileComparator::DISCARD_WHITESPACE)); + EXPECT_EQ(u"ヒルケイツ", comparator_.NormalizeForComparison( + u"ビル・ゲイツ", + AutofillProfileComparator::DISCARD_WHITESPACE)); } TEST_P(AutofillProfileComparatorTest, GetNamePartVariants) { std::set expected_variants = { - UTF8ToUTF16("timothe noel"), - UTF8ToUTF16("timothe n"), - UTF8ToUTF16("timothe"), - UTF8ToUTF16("t noel"), - UTF8ToUTF16("t n"), - UTF8ToUTF16("t"), - UTF8ToUTF16("noel"), - UTF8ToUTF16("n"), - UTF8ToUTF16(""), - UTF8ToUTF16("tn"), + u"timothe noel", u"timothe n", u"timothe", u"t noel", u"t n", u"t", + u"noel", u"n", u"", u"tn", }; EXPECT_EQ(expected_variants, - comparator_.GetNamePartVariants(UTF8ToUTF16("timothe noel"))); + comparator_.GetNamePartVariants(u"timothe noel")); } TEST_P(AutofillProfileComparatorTest, IsNameVariantOf) { - const std::u16string kNormalizedFullName = - UTF8ToUTF16("timothe noel etienne perier"); + const std::u16string kNormalizedFullName = u"timothe noel etienne perier"; EXPECT_TRUE( comparator_.IsNameVariantOf(kNormalizedFullName, kNormalizedFullName)); - EXPECT_TRUE(comparator_.IsNameVariantOf( - kNormalizedFullName, UTF8ToUTF16("t noel etienne perier"))); - EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, - UTF8ToUTF16("timothe perier"))); - EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, - UTF8ToUTF16("t perier"))); - EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, - UTF8ToUTF16("noel perier"))); EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, - UTF8ToUTF16("t n etienne perier"))); - EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, - UTF8ToUTF16("tn perier"))); - EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, - UTF8ToUTF16("te perier"))); + u"t noel etienne perier")); + EXPECT_TRUE( + comparator_.IsNameVariantOf(kNormalizedFullName, u"timothe perier")); + EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, u"t perier")); + EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, u"noel perier")); + EXPECT_TRUE( + comparator_.IsNameVariantOf(kNormalizedFullName, u"t n etienne perier")); + EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, u"tn perier")); + EXPECT_TRUE(comparator_.IsNameVariantOf(kNormalizedFullName, u"te perier")); - EXPECT_FALSE(comparator_.IsNameVariantOf(kNormalizedFullName, - UTF8ToUTF16("etienne noel perier"))); + EXPECT_FALSE( + comparator_.IsNameVariantOf(kNormalizedFullName, u"etienne noel perier")); } TEST_P(AutofillProfileComparatorTest, HaveMergeableNames) { @@ -728,8 +694,8 @@ TEST_P(AutofillProfileComparatorTest, HaveMergeableAddresses) { AutofillProfile empty = CreateProfileWithAddress("", "", "", "", "", ""); AutofillProfile p1 = CreateProfileWithAddress( "1 Some Street", "Unit 3", "Carver", "CA - California", "90210", "US"); - p1.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, UTF8ToUTF16("Some String")); - p1.SetRawInfo(ADDRESS_HOME_SORTING_CODE, UTF8ToUTF16("64205 Biarritz CEDEX")); + p1.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, u"Some String"); + p1.SetRawInfo(ADDRESS_HOME_SORTING_CODE, u"64205 Biarritz CEDEX"); AutofillProfile p2 = CreateProfileWithAddress( "Unit 3", "1 Some Street", "Suburb", "california", "90 210-3214", ""); @@ -825,25 +791,25 @@ TEST_P(AutofillProfileComparatorTest, MergeStructuredNames_WithPermutation) { // The first name has an observed structure. NameInfo name1; name1.SetRawInfoWithVerificationStatus( - NAME_FIRST, UTF8ToUTF16("Thomas"), + NAME_FIRST, u"Thomas", autofill::structured_address::VerificationStatus::kObserved); name1.SetRawInfoWithVerificationStatus( - NAME_MIDDLE, UTF8ToUTF16("A."), + NAME_MIDDLE, u"A.", autofill::structured_address::VerificationStatus::kObserved); name1.SetRawInfoWithVerificationStatus( - NAME_LAST, UTF8ToUTF16("Anderson"), + NAME_LAST, u"Anderson", autofill::structured_address::VerificationStatus::kObserved); AutofillProfile profile1 = CreateProfileWithName(name1); profile1.FinalizeAfterImport(); - EXPECT_EQ(profile1.GetRawInfo(NAME_FULL), UTF8ToUTF16("Thomas A. Anderson")); + EXPECT_EQ(profile1.GetRawInfo(NAME_FULL), u"Thomas A. Anderson"); EXPECT_EQ(profile1.GetVerificationStatus(NAME_FULL), autofill::structured_address::VerificationStatus::kFormatted); // The second name has an observed full name that uses a custom formatting. NameInfo name2; name2.SetRawInfoWithVerificationStatus( - NAME_FULL, UTF8ToUTF16("Anderson, Thomas A."), + NAME_FULL, u"Anderson, Thomas A.", autofill::structured_address::VerificationStatus::kObserved); AutofillProfile profile2 = CreateProfileWithName(name2); profile2.FinalizeAfterImport(); @@ -853,57 +819,56 @@ TEST_P(AutofillProfileComparatorTest, MergeStructuredNames_WithPermutation) { // The merged name should maintain the structure but use the observation of // the custom-formatted full name. - EXPECT_EQ(merged_name.GetRawInfo(NAME_FULL), - UTF8ToUTF16("Anderson, Thomas A.")); + EXPECT_EQ(merged_name.GetRawInfo(NAME_FULL), u"Anderson, Thomas A."); EXPECT_EQ(merged_name.GetVerificationStatus(NAME_FULL), autofill::structured_address::VerificationStatus::kObserved); - EXPECT_EQ(merged_name.GetRawInfo(NAME_FIRST), UTF8ToUTF16("Thomas")); + EXPECT_EQ(merged_name.GetRawInfo(NAME_FIRST), u"Thomas"); EXPECT_EQ(merged_name.GetVerificationStatus(NAME_FIRST), autofill::structured_address::VerificationStatus::kObserved); - EXPECT_EQ(merged_name.GetRawInfo(NAME_MIDDLE), UTF8ToUTF16("A.")); + EXPECT_EQ(merged_name.GetRawInfo(NAME_MIDDLE), u"A."); EXPECT_EQ(merged_name.GetVerificationStatus(NAME_MIDDLE), autofill::structured_address::VerificationStatus::kObserved); - EXPECT_EQ(merged_name.GetRawInfo(NAME_LAST), UTF8ToUTF16("Anderson")); + EXPECT_EQ(merged_name.GetRawInfo(NAME_LAST), u"Anderson"); EXPECT_EQ(merged_name.GetVerificationStatus(NAME_LAST), autofill::structured_address::VerificationStatus::kObserved); } TEST_P(AutofillProfileComparatorTest, MergeNames) { NameInfo name1; - name1.SetRawInfo(NAME_FULL, UTF8ToUTF16("John Quincy Public")); - name1.SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); - name1.SetRawInfo(NAME_MIDDLE, UTF8ToUTF16("Quincy")); - name1.SetRawInfo(NAME_LAST, UTF8ToUTF16("Public")); + name1.SetRawInfo(NAME_FULL, u"John Quincy Public"); + name1.SetRawInfo(NAME_FIRST, u"John"); + name1.SetRawInfo(NAME_MIDDLE, u"Quincy"); + name1.SetRawInfo(NAME_LAST, u"Public"); name1.FinalizeAfterImport(); NameInfo name2; - name2.SetRawInfo(NAME_FULL, UTF8ToUTF16("John Q. Public")); - name2.SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); - name2.SetRawInfo(NAME_MIDDLE, UTF8ToUTF16("Q.")); - name2.SetRawInfo(NAME_LAST, UTF8ToUTF16("Public")); + name2.SetRawInfo(NAME_FULL, u"John Q. Public"); + name2.SetRawInfo(NAME_FIRST, u"John"); + name2.SetRawInfo(NAME_MIDDLE, u"Q."); + name2.SetRawInfo(NAME_LAST, u"Public"); name2.FinalizeAfterImport(); NameInfo name3; - name3.SetRawInfo(NAME_FULL, UTF8ToUTF16("J Public")); - name3.SetRawInfo(NAME_FIRST, UTF8ToUTF16("J")); - name3.SetRawInfo(NAME_MIDDLE, UTF8ToUTF16("")); - name3.SetRawInfo(NAME_LAST, UTF8ToUTF16("Public")); + name3.SetRawInfo(NAME_FULL, u"J Public"); + name3.SetRawInfo(NAME_FIRST, u"J"); + name3.SetRawInfo(NAME_MIDDLE, u""); + name3.SetRawInfo(NAME_LAST, u"Public"); name3.FinalizeAfterImport(); NameInfo name4; - name4.SetRawInfo(NAME_FULL, UTF8ToUTF16("John Quincy Public")); + name4.SetRawInfo(NAME_FULL, u"John Quincy Public"); name4.FinalizeAfterImport(); NameInfo name5; - name5.SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); - name5.SetRawInfo(NAME_LAST, UTF8ToUTF16("Public")); + name5.SetRawInfo(NAME_FIRST, u"John"); + name5.SetRawInfo(NAME_LAST, u"Public"); name5.FinalizeAfterImport(); NameInfo synthesized; - synthesized.SetRawInfo(NAME_FULL, UTF8ToUTF16("John Public")); - synthesized.SetRawInfo(NAME_FIRST, UTF8ToUTF16("John")); - synthesized.SetRawInfo(NAME_MIDDLE, UTF8ToUTF16("")); - synthesized.SetRawInfo(NAME_LAST, UTF8ToUTF16("Public")); + synthesized.SetRawInfo(NAME_FULL, u"John Public"); + synthesized.SetRawInfo(NAME_FIRST, u"John"); + synthesized.SetRawInfo(NAME_MIDDLE, u""); + synthesized.SetRawInfo(NAME_LAST, u"Public"); synthesized.FinalizeAfterImport(); AutofillProfile p1 = CreateProfileWithName(name1); @@ -1164,7 +1129,7 @@ TEST_P(AutofillProfileComparatorTest, MergePhoneNumbers_NA) { } TEST_P(AutofillProfileComparatorTest, MergePhoneNumbers_Intl) { - const std::u16string kGermany = UTF8ToUTF16("DE"); + const std::u16string kGermany = u"DE"; const AutofillType kCountry(ADDRESS_HOME_COUNTRY); static const char kPhoneA[] = "+49492180185611"; @@ -1213,17 +1178,16 @@ TEST_P(AutofillProfileComparatorTest, MergeAddresses) { "1 Some Street #3", "", "Carver City", "ca", "90210-1234", "us"); Address expected; - expected.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("1 Some Street")); - expected.SetRawInfo(ADDRESS_HOME_LINE2, UTF8ToUTF16("Unit 3")); - expected.SetRawInfo(ADDRESS_HOME_CITY, UTF8ToUTF16("Carver City")); - expected.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16("ca")); - expected.SetRawInfo(ADDRESS_HOME_ZIP, UTF8ToUTF16("90210-1234")); - expected.SetRawInfo(ADDRESS_HOME_COUNTRY, UTF8ToUTF16("US")); + expected.SetRawInfo(ADDRESS_HOME_LINE1, u"1 Some Street"); + expected.SetRawInfo(ADDRESS_HOME_LINE2, u"Unit 3"); + expected.SetRawInfo(ADDRESS_HOME_CITY, u"Carver City"); + expected.SetRawInfo(ADDRESS_HOME_STATE, u"ca"); + expected.SetRawInfo(ADDRESS_HOME_ZIP, u"90210-1234"); + expected.SetRawInfo(ADDRESS_HOME_COUNTRY, u"US"); if (autofill::structured_address::StructuredAddressesEnabled()) { - expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, UTF8ToUTF16("1")); - expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - UTF8ToUTF16("Some Street")); + expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"1"); + expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"Some Street"); } MergeAddressesAndExpect(p1, p2, expected, @@ -1234,51 +1198,41 @@ TEST_P(AutofillProfileComparatorTest, MergeAddressesMostUniqueTokens) { AutofillProfile p1 = CreateProfileWithAddress( "1 Some Street", "Unit 3", "Carver", "CA - California", "90210", "US"); - p1.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("Some Street")); - p1.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("")); - p1.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, base::UTF8ToUTF16("")); - p1.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, base::UTF8ToUTF16("")); - p1.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, base::UTF8ToUTF16("Unit 3")); + p1.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"Some Street"); + p1.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, u""); + p1.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u""); + p1.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u""); + p1.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Unit 3"); AutofillProfile p2 = CreateProfileWithAddress( "1 Some Other Street", "Unit 3", "Carver City", "ca", "90210-1234", "us"); p2.set_use_date(p1.use_date() + base::TimeDelta::FromMinutes(1)); - p2.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("Some Other Street")); + p2.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"Some Other Street"); p2.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("DependentStreetName2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, - base::UTF8ToUTF16("HouseNumber2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, - base::UTF8ToUTF16("PremiseName2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, - base::UTF8ToUTF16("Subpremise2")); + u"DependentStreetName2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"HouseNumber2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u"PremiseName2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Subpremise2"); Address expected; - expected.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("1 Some Other Street")); - expected.SetRawInfo(ADDRESS_HOME_LINE2, UTF8ToUTF16("Unit 3")); - expected.SetRawInfo(ADDRESS_HOME_CITY, UTF8ToUTF16("Carver City")); - expected.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16("ca")); - expected.SetRawInfo(ADDRESS_HOME_ZIP, UTF8ToUTF16("90210-1234")); - expected.SetRawInfo(ADDRESS_HOME_COUNTRY, UTF8ToUTF16("US")); + expected.SetRawInfo(ADDRESS_HOME_LINE1, u"1 Some Other Street"); + expected.SetRawInfo(ADDRESS_HOME_LINE2, u"Unit 3"); + expected.SetRawInfo(ADDRESS_HOME_CITY, u"Carver City"); + expected.SetRawInfo(ADDRESS_HOME_STATE, u"ca"); + expected.SetRawInfo(ADDRESS_HOME_ZIP, u"90210-1234"); + expected.SetRawInfo(ADDRESS_HOME_COUNTRY, u"US"); // If address enhancement votes are enabled, it is expecfted that the // substructure from p2 since it is a superset of p1. // Otherwise the fields are expected to be empty after the merge process. if (AddressEnhancementVotes()) { - expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("StreetName2")); + expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"StreetName2"); expected.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("DependentStreetName2")); - expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, - base::UTF8ToUTF16("HouseNumber2")); - expected.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, - base::UTF8ToUTF16("PremiseName2")); - expected.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, - base::UTF8ToUTF16("Subpremise2")); + u"DependentStreetName2"); + expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"HouseNumber2"); + expected.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u"PremiseName2"); + expected.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Subpremise2"); } MergeAddressesAndExpect(p1, p2, expected); MergeAddressesAndExpect(p2, p1, expected); @@ -1288,53 +1242,41 @@ TEST_P(AutofillProfileComparatorTest, MergeAddressesWithStructure) { AutofillProfile p1 = CreateProfileWithAddress( "6543 CH BACON", "APP 3", "MONTRÉAL", "QUÉBEC", "HHH999", "ca"); - p1.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("StreetName")); + p1.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"StreetName"); p1.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("DependentStreetName")); - p1.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, - base::UTF8ToUTF16("HouseNumber")); - p1.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, - base::UTF8ToUTF16("PremiseName")); - p1.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, - base::UTF8ToUTF16("Subpremise")); + u"DependentStreetName"); + p1.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"HouseNumber"); + p1.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u"PremiseName"); + p1.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Subpremise"); AutofillProfile p2 = CreateProfileWithAddress( "6543, Bacon Rd", "", "Montreal", "QC", "hhh 999", "CA"); p2.set_use_date(p1.use_date() + base::TimeDelta::FromMinutes(1)); - p2.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("StreetName2")); + p2.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"StreetName2"); p2.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("DependentStreetName2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, - base::UTF8ToUTF16("HouseNumber2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, - base::UTF8ToUTF16("PremiseName2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, - base::UTF8ToUTF16("Subpremise2")); + u"DependentStreetName2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"HouseNumber2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u"PremiseName2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Subpremise2"); Address expected; - expected.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("6543 CH BACON")); - expected.SetRawInfo(ADDRESS_HOME_LINE2, UTF8ToUTF16("APP 3")); - expected.SetRawInfo(ADDRESS_HOME_CITY, UTF8ToUTF16("Montreal")); - expected.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16("QC")); - expected.SetRawInfo(ADDRESS_HOME_ZIP, UTF8ToUTF16("hhh 999")); - expected.SetRawInfo(ADDRESS_HOME_COUNTRY, UTF8ToUTF16("CA")); + expected.SetRawInfo(ADDRESS_HOME_LINE1, u"6543 CH BACON"); + expected.SetRawInfo(ADDRESS_HOME_LINE2, u"APP 3"); + expected.SetRawInfo(ADDRESS_HOME_CITY, u"Montreal"); + expected.SetRawInfo(ADDRESS_HOME_STATE, u"QC"); + expected.SetRawInfo(ADDRESS_HOME_ZIP, u"hhh 999"); + expected.SetRawInfo(ADDRESS_HOME_COUNTRY, u"CA"); // If address enhancement votes are enabled, it is expecfted that the // substructure from p1 is used since it is most recent. // Otherwise the fields are expected to be empty after the merge process. if (AddressEnhancementVotes()) { - expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("StreetName")); + expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"StreetName"); expected.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("DependentStreetName")); - expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, - base::UTF8ToUTF16("HouseNumber")); - expected.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, - base::UTF8ToUTF16("PremiseName")); - expected.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, - base::UTF8ToUTF16("Subpremise")); + u"DependentStreetName"); + expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"HouseNumber"); + expected.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u"PremiseName"); + expected.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Subpremise"); } MergeAddressesAndExpect(p1, p2, expected); @@ -1345,53 +1287,41 @@ TEST_P(AutofillProfileComparatorTest, MergeAddressesWithRewrite) { AutofillProfile p1 = CreateProfileWithAddress( "6543 CH BACON", "APP 3", "MONTRÉAL", "QUÉBEC", "HHH999", "ca"); - p1.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("StreetName")); + p1.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"StreetName"); p1.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("DependentStreetName")); - p1.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, - base::UTF8ToUTF16("HouseNumber")); - p1.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, - base::UTF8ToUTF16("PremiseName")); - p1.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, - base::UTF8ToUTF16("Subpremise")); + u"DependentStreetName"); + p1.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"HouseNumber"); + p1.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u"PremiseName"); + p1.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Subpremise"); AutofillProfile p2 = CreateProfileWithAddress( "6543, Bacon Rd", "", "Montreal", "QC", "hhh 999", "CA"); - p2.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("StreetName2")); + p2.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"StreetName2"); p2.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("DependentStreetName2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, - base::UTF8ToUTF16("HouseNumber2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, - base::UTF8ToUTF16("PremiseName2")); - p2.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, - base::UTF8ToUTF16("Subpremise2")); + u"DependentStreetName2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"HouseNumber2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u"PremiseName2"); + p2.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Subpremise2"); p2.set_use_date(p1.use_date() + base::TimeDelta::FromMinutes(1)); Address expected; - expected.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("6543 CH BACON")); - expected.SetRawInfo(ADDRESS_HOME_LINE2, UTF8ToUTF16("APP 3")); - expected.SetRawInfo(ADDRESS_HOME_CITY, UTF8ToUTF16("Montreal")); - expected.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16("QC")); - expected.SetRawInfo(ADDRESS_HOME_ZIP, UTF8ToUTF16("hhh 999")); - expected.SetRawInfo(ADDRESS_HOME_COUNTRY, UTF8ToUTF16("CA")); + expected.SetRawInfo(ADDRESS_HOME_LINE1, u"6543 CH BACON"); + expected.SetRawInfo(ADDRESS_HOME_LINE2, u"APP 3"); + expected.SetRawInfo(ADDRESS_HOME_CITY, u"Montreal"); + expected.SetRawInfo(ADDRESS_HOME_STATE, u"QC"); + expected.SetRawInfo(ADDRESS_HOME_ZIP, u"hhh 999"); + expected.SetRawInfo(ADDRESS_HOME_COUNTRY, u"CA"); // If address enhancement votes are enabled, it is expecfted that the // substructure from p1 is used since it has more tokens. if (AddressEnhancementVotes()) { - expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, - base::UTF8ToUTF16("StreetName")); + expected.SetRawInfo(autofill::ADDRESS_HOME_STREET_NAME, u"StreetName"); expected.SetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_STREET_NAME, - base::UTF8ToUTF16("DependentStreetName")); - expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, - base::UTF8ToUTF16("HouseNumber")); - expected.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, - base::UTF8ToUTF16("PremiseName")); - expected.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, - base::UTF8ToUTF16("Subpremise")); + u"DependentStreetName"); + expected.SetRawInfo(autofill::ADDRESS_HOME_HOUSE_NUMBER, u"HouseNumber"); + expected.SetRawInfo(autofill::ADDRESS_HOME_PREMISE_NAME, u"PremiseName"); + expected.SetRawInfo(autofill::ADDRESS_HOME_SUBPREMISE, u"Subpremise"); } MergeAddressesAndExpect(p1, p2, expected); @@ -1402,26 +1332,24 @@ TEST_P(AutofillProfileComparatorTest, MergeAddressesDependendLocalityAndSortingCode) { AutofillProfile p1 = CreateProfileWithAddress( "6543 CH BACON", "APP 3", "MONTRÉAL", "QUÉBEC", "HHH999", "ca"); - p1.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, UTF8ToUTF16("Some String")); - p1.SetRawInfo(ADDRESS_HOME_SORTING_CODE, UTF8ToUTF16("64205 Biarritz CEDEX")); + p1.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, u"Some String"); + p1.SetRawInfo(ADDRESS_HOME_SORTING_CODE, u"64205 Biarritz CEDEX"); AutofillProfile p2 = CreateProfileWithAddress( "6543, Bacon Rd", "", "Montreal", "QC", "hhh 999", "CA"); - p2.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, - UTF8ToUTF16("Some Other String")); - p2.SetRawInfo(ADDRESS_HOME_SORTING_CODE, UTF8ToUTF16("64205 Biarritz")); + p2.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, u"Some Other String"); + p2.SetRawInfo(ADDRESS_HOME_SORTING_CODE, u"64205 Biarritz"); p2.set_use_date(p1.use_date() + base::TimeDelta::FromMinutes(1)); Address expected; - expected.SetRawInfo(ADDRESS_HOME_LINE1, UTF8ToUTF16("6543 CH BACON")); - expected.SetRawInfo(ADDRESS_HOME_LINE2, UTF8ToUTF16("APP 3")); - expected.SetRawInfo(ADDRESS_HOME_CITY, UTF8ToUTF16("Montreal")); - expected.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16("QC")); - expected.SetRawInfo(ADDRESS_HOME_ZIP, UTF8ToUTF16("hhh 999")); - expected.SetRawInfo(ADDRESS_HOME_COUNTRY, UTF8ToUTF16("CA")); - expected.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, - UTF8ToUTF16("Some Other String")); + expected.SetRawInfo(ADDRESS_HOME_LINE1, u"6543 CH BACON"); + expected.SetRawInfo(ADDRESS_HOME_LINE2, u"APP 3"); + expected.SetRawInfo(ADDRESS_HOME_CITY, u"Montreal"); + expected.SetRawInfo(ADDRESS_HOME_STATE, u"QC"); + expected.SetRawInfo(ADDRESS_HOME_ZIP, u"hhh 999"); + expected.SetRawInfo(ADDRESS_HOME_COUNTRY, u"CA"); + expected.SetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, u"Some Other String"); expected.SetRawInfo(ADDRESS_HOME_SORTING_CODE, - UTF8ToUTF16("64205 Biarritz")); // Preferred by use date. + u"64205 Biarritz"); // Preferred by use date. MergeAddressesAndExpect(p1, p2, expected); MergeAddressesAndExpect(p2, p1, expected); @@ -1479,8 +1407,8 @@ TEST_P(AutofillProfileComparatorTest, MergeProfilesBasedOnState) { CreateProfileWithAddress("", "", "", "Bayern - BY - Bavaria", "", "DE"); Address expected; - expected.SetRawInfo(ADDRESS_HOME_COUNTRY, UTF8ToUTF16("DE")); - expected.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16("Bayern")); + expected.SetRawInfo(ADDRESS_HOME_COUNTRY, u"DE"); + expected.SetRawInfo(ADDRESS_HOME_STATE, u"Bayern"); MergeAddressesAndExpect(empty, p1, expected); MergeAddressesAndExpect(p1, empty, expected); MergeAddressesAndExpect(p1, p2, expected); @@ -1490,8 +1418,8 @@ TEST_P(AutofillProfileComparatorTest, MergeProfilesBasedOnState) { CreateProfileWithAddress("", "", "", "Pradesh", "", "IN"); AutofillProfile p4 = CreateProfileWithAddress("", "", "", "Uttar Pradesh", "", "IN"); - expected.SetRawInfo(ADDRESS_HOME_COUNTRY, UTF8ToUTF16("IN")); - expected.SetRawInfo(ADDRESS_HOME_STATE, UTF8ToUTF16("Uttar Pradesh")); + expected.SetRawInfo(ADDRESS_HOME_COUNTRY, u"IN"); + expected.SetRawInfo(ADDRESS_HOME_STATE, u"Uttar Pradesh"); MergeAddressesAndExpect(p3, p4, expected); MergeAddressesAndExpect(p4, p3, expected); } diff --git a/components/autofill/core/browser/data_model/autofill_profile_unittest.cc b/components/autofill/core/browser/data_model/autofill_profile_unittest.cc index a1e2214850d6d1..b002c696f35e8b 100644 --- a/components/autofill/core/browser/data_model/autofill_profile_unittest.cc +++ b/components/autofill/core/browser/data_model/autofill_profile_unittest.cc @@ -372,8 +372,8 @@ TEST_P(AutofillProfileTest, CreateInferredLabelsI18n_KR) { "Gangnam Finance Center", "152 Teheran-ro", "Gangnam-Gu", "Seoul", "135-984", "KR", "+82-2-531-9000"); profiles.back()->set_language_code("ko_Latn"); - profiles.back()->SetInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, - UTF8ToUTF16("Yeoksam-Dong"), "en-US"); + profiles.back()->SetInfo(ADDRESS_HOME_DEPENDENT_LOCALITY, u"Yeoksam-Dong", + "en-US"); static const char* kExpectedLabels[] = { "", "Park Jae-sang", @@ -1527,28 +1527,25 @@ TEST_P(AutofillProfileTest, AutofillProfile b = a; a.FinalizeAfterImport(); - b.SetRawInfoWithVerificationStatus(NAME_FIRST, UTF8ToUTF16("Märion"), - kObserved); - b.SetRawInfoWithVerificationStatus(NAME_MIDDLE, UTF8ToUTF16("Mitchéll"), - kObserved); - b.SetRawInfoWithVerificationStatus(NAME_LAST, UTF8ToUTF16("Morrison"), - kObserved); - b.SetRawInfoWithVerificationStatus(NAME_FULL, UTF8ToUTF16(""), kObserved); + b.SetRawInfoWithVerificationStatus(NAME_FIRST, u"Märion", kObserved); + b.SetRawInfoWithVerificationStatus(NAME_MIDDLE, u"Mitchéll", kObserved); + b.SetRawInfoWithVerificationStatus(NAME_LAST, u"Morrison", kObserved); + b.SetRawInfoWithVerificationStatus(NAME_FULL, u"", kObserved); b.FinalizeAfterImport(); EXPECT_TRUE(a.SaveAdditionalInfo(b, "en-US")); // The first, middle and last names should have their first letter in // uppercase and have acquired diacritics. - EXPECT_EQ(UTF8ToUTF16("Märion"), a.GetRawInfo(NAME_FIRST)); - EXPECT_EQ(UTF8ToUTF16("Mitchéll"), a.GetRawInfo(NAME_MIDDLE)); - EXPECT_EQ(UTF8ToUTF16("Morrison"), a.GetRawInfo(NAME_LAST)); + EXPECT_EQ(u"Märion", a.GetRawInfo(NAME_FIRST)); + EXPECT_EQ(u"Mitchéll", a.GetRawInfo(NAME_MIDDLE)); + EXPECT_EQ(u"Morrison", a.GetRawInfo(NAME_LAST)); if (!StructuredNames()) { - EXPECT_EQ(UTF8ToUTF16("Märion Mitchéll Morrison"), a.GetRawInfo(NAME_FULL)); + EXPECT_EQ(u"Märion Mitchéll Morrison", a.GetRawInfo(NAME_FULL)); } else { // In the new merging logic the observed lower-case value should remain // because the upper-case-diacritic version is only formatted. - EXPECT_EQ(UTF8ToUTF16("marion mitchell morrison"), a.GetRawInfo(NAME_FULL)); + EXPECT_EQ(u"marion mitchell morrison", a.GetRawInfo(NAME_FULL)); } } diff --git a/components/autofill/core/browser/data_model/autofill_structured_address_component.cc b/components/autofill/core/browser/data_model/autofill_structured_address_component.cc index 0f3fbd5475415f..6b163244cca1c3 100644 --- a/components/autofill/core/browser/data_model/autofill_structured_address_component.cc +++ b/components/autofill/core/browser/data_model/autofill_structured_address_component.cc @@ -504,9 +504,8 @@ void AddressComponent::ParseValueAndAssignSubcomponentsByFallbackMethod() { return; // Split the string by spaces. - std::vector space_separated_tokens = - base::SplitString(GetValue(), base::UTF8ToUTF16(" "), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector space_separated_tokens = base::SplitString( + GetValue(), u" ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); auto token_iterator = space_separated_tokens.begin(); auto subcomponent_types = GetSubcomponentTypes(); diff --git a/components/autofill/core/browser/data_model/autofill_structured_address_component_unittest.cc b/components/autofill/core/browser/data_model/autofill_structured_address_component_unittest.cc index 3b7f257b3a3b34..ecc68bc71dbb90 100644 --- a/components/autofill/core/browser/data_model/autofill_structured_address_component_unittest.cc +++ b/components/autofill/core/browser/data_model/autofill_structured_address_component_unittest.cc @@ -354,19 +354,18 @@ TEST(AutofillStructuredAddressAddressComponent, TestGetSupportedFieldType) { TEST(AutofillStructuredAddressAddressComponent, TestSetFieldTypeValue) { TestCompoundNameAddressComponent compound_name; EXPECT_TRUE(compound_name.SetValueForTypeIfPossible( - NAME_MIDDLE_INITIAL, UTF8ToUTF16("M"), VerificationStatus::kObserved)); + NAME_MIDDLE_INITIAL, u"M", VerificationStatus::kObserved)); - EXPECT_EQ(compound_name.GetValueForType(NAME_MIDDLE), UTF8ToUTF16("M")); + EXPECT_EQ(compound_name.GetValueForType(NAME_MIDDLE), u"M"); } // Tests retrieving an additional field type. TEST(AutofillStructuredAddressAddressComponent, TestGetFieldTypeValue) { TestCompoundNameAddressComponent compound_name; EXPECT_TRUE(compound_name.SetValueForTypeIfPossible( - NAME_MIDDLE, UTF8ToUTF16("Middle"), VerificationStatus::kObserved)); + NAME_MIDDLE, u"Middle", VerificationStatus::kObserved)); - EXPECT_EQ(compound_name.GetValueForType(NAME_MIDDLE_INITIAL), - UTF8ToUTF16("M")); + EXPECT_EQ(compound_name.GetValueForType(NAME_MIDDLE_INITIAL), u"M"); EXPECT_EQ(compound_name.GetVerificationStatusForType(NAME_MIDDLE_INITIAL), VerificationStatus::kObserved); } @@ -402,15 +401,14 @@ TEST(AutofillStructuredAddressAddressComponent, TestComparison_Atom) { AddressComponent left(NAME_FIRST, nullptr, MergeMode::kReplaceEmpty); AddressComponent right(NAME_FIRST, nullptr, MergeMode::kReplaceEmpty); - left.SetValue(UTF8ToUTF16("some value"), VerificationStatus::kParsed); - right.SetValue(UTF8ToUTF16("some other value"), - VerificationStatus::kFormatted); + left.SetValue(u"some value", VerificationStatus::kParsed); + right.SetValue(u"some other value", VerificationStatus::kFormatted); EXPECT_NE(left.GetValue(), right.GetValue()); EXPECT_NE(left.GetVerificationStatus(), right.GetVerificationStatus()); EXPECT_FALSE(left.SameAs(right)); - right.SetValue(UTF8ToUTF16("some value"), VerificationStatus::kParsed); + right.SetValue(u"some value", VerificationStatus::kParsed); EXPECT_TRUE(left.SameAs(right)); } @@ -440,13 +438,13 @@ TEST(AutofillStructuredAddressAddressComponent, TestComparison_Compound) { TestCompoundNameAddressComponent right; // Set left to a value and verify its state. - left.SetValueForTypeIfPossible(NAME_FULL, UTF8ToUTF16("First Middle Last"), + left.SetValueForTypeIfPossible(NAME_FULL, u"First Middle Last", VerificationStatus::kObserved); EXPECT_TRUE(left.CompleteFullTree()); - EXPECT_EQ(left.GetValueForType(NAME_FULL), UTF8ToUTF16("First Middle Last")); - EXPECT_EQ(left.GetValueForType(NAME_FIRST), UTF8ToUTF16("First")); - EXPECT_EQ(left.GetValueForType(NAME_MIDDLE), UTF8ToUTF16("Middle")); - EXPECT_EQ(left.GetValueForType(NAME_LAST), UTF8ToUTF16("Last")); + EXPECT_EQ(left.GetValueForType(NAME_FULL), u"First Middle Last"); + EXPECT_EQ(left.GetValueForType(NAME_FIRST), u"First"); + EXPECT_EQ(left.GetValueForType(NAME_MIDDLE), u"Middle"); + EXPECT_EQ(left.GetValueForType(NAME_LAST), u"Last"); EXPECT_EQ(left.GetVerificationStatusForType(NAME_FULL), VerificationStatus::kObserved); EXPECT_EQ(left.GetVerificationStatusForType(NAME_FIRST), @@ -457,13 +455,13 @@ TEST(AutofillStructuredAddressAddressComponent, TestComparison_Compound) { VerificationStatus::kParsed); // Set right to another value and verify its state. - right.SetValueForTypeIfPossible(NAME_FULL, UTF8ToUTF16("The Dark Knight"), + right.SetValueForTypeIfPossible(NAME_FULL, u"The Dark Knight", VerificationStatus::kUserVerified); EXPECT_TRUE(right.CompleteFullTree()); - EXPECT_EQ(right.GetValueForType(NAME_FULL), UTF8ToUTF16("The Dark Knight")); - EXPECT_EQ(right.GetValueForType(NAME_FIRST), UTF8ToUTF16("The")); - EXPECT_EQ(right.GetValueForType(NAME_MIDDLE), UTF8ToUTF16("Dark")); - EXPECT_EQ(right.GetValueForType(NAME_LAST), UTF8ToUTF16("Knight")); + EXPECT_EQ(right.GetValueForType(NAME_FULL), u"The Dark Knight"); + EXPECT_EQ(right.GetValueForType(NAME_FIRST), u"The"); + EXPECT_EQ(right.GetValueForType(NAME_MIDDLE), u"Dark"); + EXPECT_EQ(right.GetValueForType(NAME_LAST), u"Knight"); EXPECT_EQ(right.GetVerificationStatusForType(NAME_FULL), VerificationStatus::kUserVerified); EXPECT_EQ(right.GetVerificationStatusForType(NAME_FIRST), @@ -477,15 +475,14 @@ TEST(AutofillStructuredAddressAddressComponent, TestComparison_Compound) { // Set left to the same values as right and verify that it is now equal. TestCompoundNameAddressComponent same_right; - same_right.SetValueForTypeIfPossible(NAME_FULL, - UTF8ToUTF16("The Dark Knight"), + same_right.SetValueForTypeIfPossible(NAME_FULL, u"The Dark Knight", VerificationStatus::kUserVerified); EXPECT_TRUE(same_right.CompleteFullTree()); EXPECT_TRUE(right.SameAs(same_right)); // Change one subcomponent and verify that it is not equal anymore. - same_right.SetValueForTypeIfPossible(NAME_LAST, UTF8ToUTF16("Joker"), + same_right.SetValueForTypeIfPossible(NAME_LAST, u"Joker", VerificationStatus::kParsed); EXPECT_FALSE(right.SameAs(same_right)); } @@ -495,13 +492,11 @@ TEST(AutofillStructuredAddressAddressComponent, TestAssignmentOperator_Atom) { AddressComponent left(NAME_FIRST, nullptr, MergeMode::kReplaceEmpty); AddressComponent right(NAME_FIRST, nullptr, MergeMode::kReplaceEmpty); - left.SetValue(UTF8ToUTF16("some value"), VerificationStatus::kParsed); - right.SetValue(UTF8ToUTF16("some other value"), - VerificationStatus::kFormatted); + left.SetValue(u"some value", VerificationStatus::kParsed); + right.SetValue(u"some other value", VerificationStatus::kFormatted); EXPECT_FALSE(left.SameAs(right)); - left.SetValue(UTF8ToUTF16("some other value"), - VerificationStatus::kFormatted); + left.SetValue(u"some other value", VerificationStatus::kFormatted); EXPECT_TRUE(left.SameAs(right)); } @@ -511,11 +506,11 @@ TEST(AutofillStructuredAddressAddressComponent, TestCompoundNameAddressComponent left; TestCompoundNameAddressComponent right; - left.SetValueForTypeIfPossible(NAME_FULL, UTF8ToUTF16("First Middle Last"), + left.SetValueForTypeIfPossible(NAME_FULL, u"First Middle Last", VerificationStatus::kObserved); left.RecursivelyCompleteTree(); - right.SetValueForTypeIfPossible(NAME_FULL, UTF8ToUTF16("The Dark Knight"), + right.SetValueForTypeIfPossible(NAME_FULL, u"The Dark Knight", VerificationStatus::kParsed); right.RecursivelyCompleteTree(); @@ -535,11 +530,11 @@ TEST(AutofillStructuredAddressAddressComponent, TestCompoundNameAddressComponent left; TestCompoundNameAddressComponent right; - left.SetValueForTypeIfPossible(NAME_FULL, UTF8ToUTF16("First Middle Last"), + left.SetValueForTypeIfPossible(NAME_FULL, u"First Middle Last", VerificationStatus::kObserved); left.RecursivelyCompleteTree(); - right.SetValueForTypeIfPossible(NAME_FULL, UTF8ToUTF16("The Dark Knight"), + right.SetValueForTypeIfPossible(NAME_FULL, u"The Dark Knight", VerificationStatus::kParsed); right.RecursivelyCompleteTree(); @@ -553,11 +548,11 @@ TEST(AutofillStructuredAddressAddressComponent, TEST(AutofillStructuredAddressAddressComponent, SelfAssignment) { TestCompoundNameAddressComponent left; - left.SetValueForTypeIfPossible(NAME_FULL, UTF8ToUTF16("First Middle Last"), + left.SetValueForTypeIfPossible(NAME_FULL, u"First Middle Last", VerificationStatus::kObserved); left.CopyFrom(*(&left)); - EXPECT_EQ(left.GetValueForType(NAME_FULL), UTF8ToUTF16("First Middle Last")); + EXPECT_EQ(left.GetValueForType(NAME_FULL), u"First Middle Last"); } // Tests that the correct storage types are returned. @@ -666,7 +661,7 @@ TEST(AutofillStructuredAddressAddressComponent, GetSubcomponentTypes) { TEST(AutofillStructuredAddressAddressComponent, GetBestFormatString_ForAtom) { TestAtomicFirstNameAddressComponent first_name_component; EXPECT_EQ(first_name_component.GetBestFormatStringForTesting(), - UTF8ToUTF16("${NAME_FIRST}")); + u"${NAME_FIRST}"); } // Tests getting the best format string using the fallback mechanism. @@ -889,12 +884,11 @@ TEST(AutofillStructuredAddressAddressComponent, TEST(AutofillStructuredAddressAddressComponent, TestParseValueAndAssignSubcomponentsByFallbackMethod_Atom) { TestAtomicFirstNameAddressComponent atomic_component; - atomic_component.SetValue(UTF8ToUTF16("Dangerzone"), - VerificationStatus::kObserved); + atomic_component.SetValue(u"Dangerzone", VerificationStatus::kObserved); atomic_component.ParseValueAndAssignSubcomponents(); // The parsing should not crash the browser and keep the initial value intact. - EXPECT_EQ(UTF8ToUTF16("Dangerzone"), atomic_component.GetValue()); + EXPECT_EQ(u"Dangerzone", atomic_component.GetValue()); } // Tests the fallback method to parse a value into its components if there are @@ -1121,8 +1115,7 @@ TEST(AutofillStructuredAddressAddressComponent, // Change the value of FULL_NAME and invalidate all child and ancestor nodes. compound_component.SetValueForTypeIfPossible( - NAME_FULL, UTF8ToUTF16("Oh' Brian"), VerificationStatus::kObserved, true, - true); + NAME_FULL, u"Oh' Brian", VerificationStatus::kObserved, true, true); EXPECT_EQ(compound_component.GetValueForType(CREDIT_CARD_NAME_FULL), std::u16string()); EXPECT_EQ(compound_component.GetValueForType(NAME_FIRST), std::u16string()); @@ -1190,8 +1183,7 @@ TEST(AutofillStructuredAddressAddressComponent, // Set a value somewhere in the tree, complete and verify that another node is // assigned. compound_component.SetValueForTypeIfPossible( - NAME_FULL, UTF8ToUTF16("Winston Brian Smith"), - VerificationStatus::kObserved); + NAME_FULL, u"Winston Brian Smith", VerificationStatus::kObserved); EXPECT_EQ(VerificationStatus::kObserved, compound_component.GetVerificationStatusForType(NAME_FULL)); compound_component.CompleteFullTree(); @@ -1247,10 +1239,10 @@ TEST(AutofillStructuredAddressAddressComponent, TEST(AutofillStructuredAddressAddressComponent, MergeAtomicComponentsSimilarValueThatContainsSameNormalizedValue) { TestAtomicFirstNameAddressComponent one; - one.SetValue(UTF8ToUTF16("müller"), VerificationStatus::kFormatted); + one.SetValue(u"müller", VerificationStatus::kFormatted); TestAtomicFirstNameAddressComponent two; - two.SetValue(UTF8ToUTF16("Muller"), VerificationStatus::kUserVerified); + two.SetValue(u"Muller", VerificationStatus::kUserVerified); // Should be mergeable because the values are the same after normalization. EXPECT_TRUE(one.MergeWithComponent(two)); diff --git a/components/autofill/core/browser/data_model/autofill_structured_address_name_unittest.cc b/components/autofill/core/browser/data_model/autofill_structured_address_name_unittest.cc index 2d2119fa7b2f77..2ffcc5647f6ce4 100644 --- a/components/autofill/core/browser/data_model/autofill_structured_address_name_unittest.cc +++ b/components/autofill/core/browser/data_model/autofill_structured_address_name_unittest.cc @@ -383,12 +383,9 @@ TEST(AutofillStructuredName, TestSettingMiddleNameInitial) { std::u16string()); EXPECT_TRUE(full_name_with_prefix.SetValueForTypeIfPossible( - NAME_MIDDLE_INITIAL, base::UTF8ToUTF16("M"), - VerificationStatus::kObserved)); - EXPECT_EQ(full_name_with_prefix.GetValueForType(NAME_MIDDLE_INITIAL), - base::UTF8ToUTF16("M")); - EXPECT_EQ(full_name_with_prefix.GetValueForType(NAME_MIDDLE), - base::UTF8ToUTF16("M")); + NAME_MIDDLE_INITIAL, u"M", VerificationStatus::kObserved)); + EXPECT_EQ(full_name_with_prefix.GetValueForType(NAME_MIDDLE_INITIAL), u"M"); + EXPECT_EQ(full_name_with_prefix.GetValueForType(NAME_MIDDLE), u"M"); } TEST(AutofillStructuredName, MergePermutatedNames) { diff --git a/components/autofill/core/browser/data_model/autofill_structured_address_utils.cc b/components/autofill/core/browser/data_model/autofill_structured_address_utils.cc index 221b13e51a22c9..a6f674bb95c6f1 100644 --- a/components/autofill/core/browser/data_model/autofill_structured_address_utils.cc +++ b/components/autofill/core/browser/data_model/autofill_structured_address_utils.cc @@ -424,7 +424,7 @@ std::vector TokenizeValue(const std::u16string value) { if (HasCjkNameCharacteristics(base::UTF16ToUTF8(value))) { tokens.reserve(value.size()); for (size_t i = 0; i < value.size(); i++) { - std::u16string cjk_separators = base::UTF8ToUTF16("・·  "); + std::u16string cjk_separators = u"・·  "; if (cjk_separators.find(value.substr(i, 1)) == std::u16string::npos) { tokens.emplace_back(AddressToken{.value = value.substr(i, 1), .normalized_value = value.substr(i, 1), diff --git a/components/autofill/core/browser/data_model/autofill_structured_address_utils_unittest.cc b/components/autofill/core/browser/data_model/autofill_structured_address_utils_unittest.cc index 01fd13bc3ad9b4..e186cb8c99f471 100644 --- a/components/autofill/core/browser/data_model/autofill_structured_address_utils_unittest.cc +++ b/components/autofill/core/browser/data_model/autofill_structured_address_utils_unittest.cc @@ -238,27 +238,20 @@ TEST(AutofillStructuredAddressUtils, TokenizeValue) { expected_tokens); std::vector expected_cjk_tokens = { - {base::UTF8ToUTF16("영"), base::UTF8ToUTF16("영"), 1}, - {base::UTF8ToUTF16("이"), base::UTF8ToUTF16("이"), 0}, - {base::UTF8ToUTF16("호"), base::UTF8ToUTF16("호"), 2}}; + {u"영", u"영", 1}, {u"이", u"이", 0}, {u"호", u"호", 2}}; - EXPECT_EQ(TokenizeValue(base::UTF8ToUTF16("이영 호")), expected_cjk_tokens); - EXPECT_EQ(TokenizeValue(base::UTF8ToUTF16("이・영호")), expected_cjk_tokens); - EXPECT_EQ(TokenizeValue(base::UTF8ToUTF16("이영 호")), expected_cjk_tokens); + EXPECT_EQ(TokenizeValue(u"이영 호"), expected_cjk_tokens); + EXPECT_EQ(TokenizeValue(u"이・영호"), expected_cjk_tokens); + EXPECT_EQ(TokenizeValue(u"이영 호"), expected_cjk_tokens); } TEST(AutofillStructuredAddressUtils, NormalizeValue) { - EXPECT_EQ(NormalizeValue(base::UTF8ToUTF16(" MÜLLeR Örber")), - base::UTF8ToUTF16("muller orber")); + EXPECT_EQ(NormalizeValue(u" MÜLLeR Örber"), u"muller orber"); } TEST(AutofillStructuredAddressUtils, TestGetRewriter) { - EXPECT_EQ(RewriterCache::Rewrite(base::UTF8ToUTF16("us"), - base::UTF8ToUTF16("unit #3")), - base::UTF8ToUTF16("unit 3")); - EXPECT_EQ(RewriterCache::Rewrite(base::UTF8ToUTF16("us"), - base::UTF8ToUTF16("california")), - base::UTF8ToUTF16("ca")); + EXPECT_EQ(RewriterCache::Rewrite(u"us", u"unit #3"), u"unit 3"); + EXPECT_EQ(RewriterCache::Rewrite(u"us", u"california"), u"ca"); } } // namespace structured_address diff --git a/components/autofill/core/browser/data_model/borrowed_transliterator_unittest.cc b/components/autofill/core/browser/data_model/borrowed_transliterator_unittest.cc index f972854a3c6b77..e49dbf1f2ba28b 100644 --- a/components/autofill/core/browser/data_model/borrowed_transliterator_unittest.cc +++ b/components/autofill/core/browser/data_model/borrowed_transliterator_unittest.cc @@ -14,7 +14,7 @@ namespace autofill { TEST(BorrowedTransliterator, RemoveDiacriticsAndConvertToLowerCase) { EXPECT_EQ(RemoveDiacriticsAndConvertToLowerCase( - base::UTF8ToUTF16("āēaa11.īūčģķļņšžKāäǟḑēīļņōȯȱõȭŗšțūž")), + u"āēaa11.īūčģķļņšžKāäǟḑēīļņōȯȱõȭŗšțūž"), base::ASCIIToUTF16("aeaa11.iucgklnszkaaadeilnooooorstuz")); } diff --git a/components/autofill/core/browser/data_model/contact_info_unittest.cc b/components/autofill/core/browser/data_model/contact_info_unittest.cc index b8c2f2272e7d1f..e3310317c21668 100644 --- a/components/autofill/core/browser/data_model/contact_info_unittest.cc +++ b/components/autofill/core/browser/data_model/contact_info_unittest.cc @@ -391,14 +391,14 @@ TEST(CompanyTest, CompanyNameSocialTitleCopy) { CompanyInfo company_year(&profile); CompanyInfo company_social_title(&profile); - company_google.SetRawInfo(COMPANY_NAME, UTF8ToUTF16("Google")); - company_year.SetRawInfo(COMPANY_NAME, UTF8ToUTF16("1987")); - company_social_title.SetRawInfo(COMPANY_NAME, UTF8ToUTF16("Dr")); + company_google.SetRawInfo(COMPANY_NAME, u"Google"); + company_year.SetRawInfo(COMPANY_NAME, u"1987"); + company_social_title.SetRawInfo(COMPANY_NAME, u"Dr"); company_google = company_year; - EXPECT_EQ(UTF8ToUTF16(""), company_google.GetRawInfo(COMPANY_NAME)); + EXPECT_EQ(u"", company_google.GetRawInfo(COMPANY_NAME)); company_google = company_social_title; - EXPECT_EQ(UTF8ToUTF16(""), company_google.GetRawInfo(COMPANY_NAME)); + EXPECT_EQ(u"", company_google.GetRawInfo(COMPANY_NAME)); } TEST(CompanyTest, CompanyNameYearIsEqual) { @@ -408,8 +408,8 @@ TEST(CompanyTest, CompanyNameYearIsEqual) { CompanyInfo company_year(&profile); CompanyInfo company_social_title(&profile); - company_year.SetRawInfo(COMPANY_NAME, UTF8ToUTF16("1987")); - company_social_title.SetRawInfo(COMPANY_NAME, UTF8ToUTF16("Dr")); + company_year.SetRawInfo(COMPANY_NAME, u"1987"); + company_social_title.SetRawInfo(COMPANY_NAME, u"Dr"); EXPECT_EQ(company_year, company_social_title); } diff --git a/components/autofill/core/browser/data_model/credit_card.cc b/components/autofill/core/browser/data_model/credit_card.cc index 788c3f020ef347..421666d2739c70 100644 --- a/components/autofill/core/browser/data_model/credit_card.cc +++ b/components/autofill/core/browser/data_model/credit_card.cc @@ -499,7 +499,7 @@ void CreditCard::GetMatchingTypes(const std::u16string& text, void CreditCard::SetInfoForMonthInputType(const std::u16string& value) { // Check if |text| is "yyyy-mm" format first, and check normal month format. - if (!MatchesPattern(value, base::UTF8ToUTF16("^[0-9]{4}-[0-9]{1,2}$"))) + if (!MatchesPattern(value, u"^[0-9]{4}-[0-9]{1,2}$")) return; std::vector year_month = base::SplitStringPiece( @@ -752,7 +752,7 @@ void CreditCard::SetExpirationDateFromString(const std::u16string& text) { // Check that |text| fits the supported patterns: mmyy, mmyyyy, m-yy, // mm-yy, m-yyyy and mm-yyyy. Note that myy and myyyy matched by this pattern // but are not supported (ambiguous). Separators: -, / and |. - if (!MatchesPattern(text, base::UTF8ToUTF16("^[0-9]{1,2}[-/|]?[0-9]{2,4}$"))) + if (!MatchesPattern(text, u"^[0-9]{1,2}[-/|]?[0-9]{2,4}$")) return; std::u16string month; @@ -1064,8 +1064,7 @@ std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) { void CreditCard::SetNameOnCardFromSeparateParts() { DCHECK(name_on_card_.empty() && !temp_card_first_name_.empty() && !temp_card_last_name_.empty()); - name_on_card_ = - temp_card_first_name_ + base::UTF8ToUTF16(" ") + temp_card_last_name_; + name_on_card_ = temp_card_first_name_ + u" " + temp_card_last_name_; } const char kAmericanExpressCard[] = "americanExpressCC"; diff --git a/components/autofill/core/browser/data_model/credit_card_unittest.cc b/components/autofill/core/browser/data_model/credit_card_unittest.cc index eca5cd494ac888..1b0f6b2f63749a 100644 --- a/components/autofill/core/browser/data_model/credit_card_unittest.cc +++ b/components/autofill/core/browser/data_model/credit_card_unittest.cc @@ -1267,8 +1267,7 @@ TEST(CreditCardTest, SetExpirationMonth) { EXPECT_EQ(ASCIIToUTF16("04"), card.GetRawInfo(CREDIT_CARD_EXP_MONTH)); EXPECT_EQ(4, card.expiration_month()); - card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), UTF8ToUTF16("FÉVRIER"), - "fr-FR"); + card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), u"FÉVRIER", "fr-FR"); EXPECT_EQ(ASCIIToUTF16("02"), card.GetRawInfo(CREDIT_CARD_EXP_MONTH)); EXPECT_EQ(2, card.expiration_month()); } diff --git a/components/autofill/core/browser/data_model/test_data_creator.cc b/components/autofill/core/browser/data_model/test_data_creator.cc index edb610199dcd25..aae60b06afd7a4 100644 --- a/components/autofill/core/browser/data_model/test_data_creator.cc +++ b/components/autofill/core/browser/data_model/test_data_creator.cc @@ -81,23 +81,16 @@ AutofillProfile TestDataCreator::CreateBasicTestAddress() { const base::Time use_date = AutofillClock::Now() - base::TimeDelta::FromDays(20); AutofillProfile profile; - profile.SetInfo(NAME_FULL, base::UTF8ToUTF16("John McTester"), app_locale_); - profile.SetInfo(COMPANY_NAME, base::UTF8ToUTF16("Test Inc."), app_locale_); - profile.SetInfo(EMAIL_ADDRESS, - base::UTF8ToUTF16("jmctester@fake.chromium.org"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_LINE1, base::UTF8ToUTF16("123 Invented Street"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_LINE2, base::UTF8ToUTF16("Suite A"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("Mountain View"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("California"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("94043"), app_locale_); - profile.SetInfo(ADDRESS_HOME_COUNTRY, base::UTF8ToUTF16("US"), app_locale_); - profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, base::UTF8ToUTF16("844-555-0173"), - app_locale_); + profile.SetInfo(NAME_FULL, u"John McTester", app_locale_); + profile.SetInfo(COMPANY_NAME, u"Test Inc.", app_locale_); + profile.SetInfo(EMAIL_ADDRESS, u"jmctester@fake.chromium.org", app_locale_); + profile.SetInfo(ADDRESS_HOME_LINE1, u"123 Invented Street", app_locale_); + profile.SetInfo(ADDRESS_HOME_LINE2, u"Suite A", app_locale_); + profile.SetInfo(ADDRESS_HOME_CITY, u"Mountain View", app_locale_); + profile.SetInfo(ADDRESS_HOME_STATE, u"California", app_locale_); + profile.SetInfo(ADDRESS_HOME_ZIP, u"94043", app_locale_); + profile.SetInfo(ADDRESS_HOME_COUNTRY, u"US", app_locale_); + profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, u"844-555-0173", app_locale_); profile.set_use_date(use_date); return profile; } @@ -106,24 +99,21 @@ AutofillProfile TestDataCreator::CreateDisusedTestAddress() { const base::Time use_date = AutofillClock::Now() - base::TimeDelta::FromDays(185); AutofillProfile profile; - profile.SetInfo(NAME_FULL, base::UTF8ToUTF16("Polly Disused"), app_locale_); + profile.SetInfo(NAME_FULL, u"Polly Disused", app_locale_); profile.SetInfo(COMPANY_NAME, base::UTF8ToUTF16(base::StringPrintf( "%" PRIu64 " Inc.", use_date.ToDeltaSinceWindowsEpoch().InMicroseconds())), app_locale_); - profile.SetInfo(EMAIL_ADDRESS, - base::UTF8ToUTF16("polly.disused@fake.chromium.org"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_LINE1, base::UTF8ToUTF16("456 Disused Lane"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_LINE2, base::UTF8ToUTF16("Apt. B"), app_locale_); - profile.SetInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("Austin"), app_locale_); - profile.SetInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("Texas"), app_locale_); - profile.SetInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("73301"), app_locale_); - profile.SetInfo(ADDRESS_HOME_COUNTRY, base::UTF8ToUTF16("US"), app_locale_); - profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, base::UTF8ToUTF16("844-555-0174"), + profile.SetInfo(EMAIL_ADDRESS, u"polly.disused@fake.chromium.org", app_locale_); + profile.SetInfo(ADDRESS_HOME_LINE1, u"456 Disused Lane", app_locale_); + profile.SetInfo(ADDRESS_HOME_LINE2, u"Apt. B", app_locale_); + profile.SetInfo(ADDRESS_HOME_CITY, u"Austin", app_locale_); + profile.SetInfo(ADDRESS_HOME_STATE, u"Texas", app_locale_); + profile.SetInfo(ADDRESS_HOME_ZIP, u"73301", app_locale_); + profile.SetInfo(ADDRESS_HOME_COUNTRY, u"US", app_locale_); + profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, u"844-555-0174", app_locale_); profile.set_use_date(use_date); return profile; } @@ -132,24 +122,21 @@ AutofillProfile TestDataCreator::CreateDisusedDeletableTestAddress() { const base::Time use_date = AutofillClock::Now() - base::TimeDelta::FromDays(400); AutofillProfile profile; - profile.SetInfo(NAME_FULL, base::UTF8ToUTF16("Polly Deletable"), app_locale_); + profile.SetInfo(NAME_FULL, u"Polly Deletable", app_locale_); profile.SetInfo(COMPANY_NAME, base::UTF8ToUTF16(base::StringPrintf( "%" PRIu64 " Inc.", use_date.ToDeltaSinceWindowsEpoch().InMicroseconds())), app_locale_); - profile.SetInfo(EMAIL_ADDRESS, - base::UTF8ToUTF16("polly.deletable@fake.chromium.org"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_LINE1, base::UTF8ToUTF16("459 Deletable Lane"), - app_locale_); - profile.SetInfo(ADDRESS_HOME_LINE2, base::UTF8ToUTF16("Apt. B"), app_locale_); - profile.SetInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("Austin"), app_locale_); - profile.SetInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("Texas"), app_locale_); - profile.SetInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("73301"), app_locale_); - profile.SetInfo(ADDRESS_HOME_COUNTRY, base::UTF8ToUTF16("US"), app_locale_); - profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, base::UTF8ToUTF16("844-555-0274"), + profile.SetInfo(EMAIL_ADDRESS, u"polly.deletable@fake.chromium.org", app_locale_); + profile.SetInfo(ADDRESS_HOME_LINE1, u"459 Deletable Lane", app_locale_); + profile.SetInfo(ADDRESS_HOME_LINE2, u"Apt. B", app_locale_); + profile.SetInfo(ADDRESS_HOME_CITY, u"Austin", app_locale_); + profile.SetInfo(ADDRESS_HOME_STATE, u"Texas", app_locale_); + profile.SetInfo(ADDRESS_HOME_ZIP, u"73301", app_locale_); + profile.SetInfo(ADDRESS_HOME_COUNTRY, u"US", app_locale_); + profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, u"844-555-0274", app_locale_); profile.set_use_date(use_date); return profile; } @@ -162,10 +149,8 @@ CreditCard TestDataCreator::CreateBasicTestCreditCard() { (now + base::TimeDelta::FromDays(500)).LocalExplode(&expiry_date); CreditCard credit_card; - credit_card.SetInfo(CREDIT_CARD_NAME_FULL, - base::UTF8ToUTF16("Alice Testerson"), app_locale_); - credit_card.SetInfo(CREDIT_CARD_NUMBER, base::UTF8ToUTF16("4545454545454545"), - app_locale_); + credit_card.SetInfo(CREDIT_CARD_NAME_FULL, u"Alice Testerson", app_locale_); + credit_card.SetInfo(CREDIT_CARD_NUMBER, u"4545454545454545", app_locale_); credit_card.SetExpirationMonth(expiry_date.month); credit_card.SetExpirationYear(expiry_date.year); credit_card.set_use_date(use_date); @@ -179,10 +164,8 @@ CreditCard TestDataCreator::CreateDisusedTestCreditCard() { (now - base::TimeDelta::FromDays(200)).LocalExplode(&expiry_date); CreditCard credit_card; - credit_card.SetInfo(CREDIT_CARD_NAME_FULL, base::UTF8ToUTF16("Bob Disused"), - app_locale_); - credit_card.SetInfo(CREDIT_CARD_NUMBER, base::UTF8ToUTF16("4111111111111111"), - app_locale_); + credit_card.SetInfo(CREDIT_CARD_NAME_FULL, u"Bob Disused", app_locale_); + credit_card.SetInfo(CREDIT_CARD_NUMBER, u"4111111111111111", app_locale_); credit_card.SetExpirationMonth(expiry_date.month); credit_card.SetExpirationYear(expiry_date.year); credit_card.set_use_date(use_date); @@ -197,10 +180,8 @@ CreditCard TestDataCreator::CreateDisusedDeletableTestCreditCard() { .LocalExplode(&expiry_date); CreditCard credit_card; - credit_card.SetInfo(CREDIT_CARD_NAME_FULL, - base::UTF8ToUTF16("Charlie Deletable"), app_locale_); - credit_card.SetInfo(CREDIT_CARD_NUMBER, base::UTF8ToUTF16("378282246310005"), - app_locale_); + credit_card.SetInfo(CREDIT_CARD_NAME_FULL, u"Charlie Deletable", app_locale_); + credit_card.SetInfo(CREDIT_CARD_NUMBER, u"378282246310005", app_locale_); credit_card.SetExpirationMonth(expiry_date.month); credit_card.SetExpirationYear(expiry_date.year); credit_card.set_use_date(use_date); diff --git a/components/autofill/core/browser/field_filler_unittest.cc b/components/autofill/core/browser/field_filler_unittest.cc index fcb31015a05e0e..f7ae35539be7b7 100644 --- a/components/autofill/core/browser/field_filler_unittest.cc +++ b/components/autofill/core/browser/field_filler_unittest.cc @@ -977,10 +977,10 @@ TEST_F(AutofillFieldFillerTest, FillSelectWithCountries) { field.set_heuristic_type(ADDRESS_HOME_COUNTRY); AutofillProfile address = test::GetFullProfile(); - address.SetRawInfo(ADDRESS_HOME_COUNTRY, UTF8ToUTF16("CA")); + address.SetRawInfo(ADDRESS_HOME_COUNTRY, u"CA"); FieldFiller filler(/*app_locale=*/"en-US", /*address_normalizer=*/nullptr); filler.FillFormField(field, &address, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16("Canada"), field.value); + EXPECT_EQ(u"Canada", field.value); } struct FillWithExpirationMonthTestCase { @@ -1166,10 +1166,10 @@ TEST_F(AutofillFieldFillerTest, card.SetExpirationMonth(8); FieldFiller filler(/*app_locale=*/"fr-FR", /*address_normalizer=*/nullptr); filler.FillFormField(field, &card, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16("08 - AOÛT"), field.value); + EXPECT_EQ(u"08 - AOÛT", field.value); card.SetExpirationMonth(12); filler.FillFormField(field, &card, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16("12 - DECEMBRE"), field.value); + EXPECT_EQ(u"12 - DECEMBRE", field.value); } TEST_F(AutofillFieldFillerTest, FillSelectControlWithMonthName_French) { @@ -1183,15 +1183,15 @@ TEST_F(AutofillFieldFillerTest, FillSelectControlWithMonthName_French) { card.SetExpirationMonth(2); FieldFiller filler(/*app_locale=*/"fr-FR", /*address_normalizer=*/nullptr); filler.FillFormField(field, &card, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16("FÉVR."), field.value); + EXPECT_EQ(u"FÉVR.", field.value); card.SetExpirationMonth(1); filler.FillFormField(field, &card, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16("JANV"), field.value); + EXPECT_EQ(u"JANV", field.value); card.SetExpirationMonth(12); filler.FillFormField(field, &card, &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16("décembre"), field.value); + EXPECT_EQ(u"décembre", field.value); } TEST_F(AutofillFieldFillerTest, @@ -1306,7 +1306,7 @@ TEST_F(AutofillFieldFillerTest, FillStreetAddressTextField) { "Apt. 42"); address()->SetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), value, "en-US"); filler.FillFormField(field, address(), &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16("123 Fake St., Apt. 42"), field.value); + EXPECT_EQ(u"123 Fake St., Apt. 42", field.value); std::u16string ja_value = UTF8ToUTF16( "桜丘町26-1\n" @@ -1315,7 +1315,7 @@ TEST_F(AutofillFieldFillerTest, FillStreetAddressTextField) { "ja-JP"); address()->set_language_code("ja-JP"); filler.FillFormField(field, address(), &field, /*cvc=*/std::u16string()); - EXPECT_EQ(UTF8ToUTF16("桜丘町26-1セルリアンタワー6階"), field.value); + EXPECT_EQ(u"桜丘町26-1セルリアンタワー6階", field.value); } TEST_F(AutofillFieldFillerTest, FillCreditCardNumberWithoutSplits) { @@ -1434,13 +1434,13 @@ TEST_F(AutofillFieldFillerTest, FindShortestSubstringMatchInSelect) { EXPECT_EQ(1, ret); // Case 3: Proper substring - ret = FieldFiller::FindShortestSubstringMatchInSelect(UTF8ToUTF16("États"), - false, &field); + ret = + FieldFiller::FindShortestSubstringMatchInSelect(u"États", false, &field); EXPECT_EQ(0, ret); // Case 4: Accent-insensitive - ret = FieldFiller::FindShortestSubstringMatchInSelect( - UTF8ToUTF16("Etats-Unis"), false, &field); + ret = FieldFiller::FindShortestSubstringMatchInSelect(u"Etats-Unis", false, + &field); EXPECT_EQ(0, ret); // Case 5: Whitespace-insensitive diff --git a/components/autofill/core/browser/geo/alternative_state_name_map_updater_unittest.cc b/components/autofill/core/browser/geo/alternative_state_name_map_updater_unittest.cc index 10cf4232e4d341..189ff2c7d7fbd2 100644 --- a/components/autofill/core/browser/geo/alternative_state_name_map_updater_unittest.cc +++ b/components/autofill/core/browser/geo/alternative_state_name_map_updater_unittest.cc @@ -99,7 +99,7 @@ TEST_F(AlternativeStateNameMapUpdaterTest, EntryAddedToStateMap) { AlternativeStateNameMap::StateName(ASCIIToUTF16("Bayern")), AlternativeStateNameMap::StateName(ASCIIToUTF16("B.Y")), AlternativeStateNameMap::StateName(ASCIIToUTF16("Bav-aria")), - AlternativeStateNameMap::StateName(UTF8ToUTF16("amapá")), + AlternativeStateNameMap::StateName(u"amapá"), AlternativeStateNameMap::StateName(ASCIIToUTF16("Broen")), AlternativeStateNameMap::StateName(ASCIIToUTF16("Bavaria is in Germany")), AlternativeStateNameMap::StateName(ASCIIToUTF16("BA is in Germany"))}; @@ -190,7 +190,7 @@ TEST_F(AlternativeStateNameMapUpdaterTest, TestLoadStatesDataUTF8) { base::Optional entry1 = AlternativeStateNameMap::GetInstance()->GetEntry( AlternativeStateNameMap::CountryCode("ES"), - AlternativeStateNameMap::StateName(UTF8ToUTF16("Paraná"))); + AlternativeStateNameMap::StateName(u"Paraná")); EXPECT_NE(entry1, base::nullopt); EXPECT_EQ(entry1->canonical_name(), "Paraná"); EXPECT_THAT(entry1->abbreviations(), @@ -201,7 +201,7 @@ TEST_F(AlternativeStateNameMapUpdaterTest, TestLoadStatesDataUTF8) { base::Optional entry2 = AlternativeStateNameMap::GetInstance()->GetEntry( AlternativeStateNameMap::CountryCode("ES"), - AlternativeStateNameMap::StateName(UTF8ToUTF16("Parana"))); + AlternativeStateNameMap::StateName(u"Parana")); EXPECT_NE(entry2, base::nullopt); EXPECT_EQ(entry2->canonical_name(), "Paraná"); EXPECT_THAT(entry2->abbreviations(), @@ -242,7 +242,7 @@ TEST_F(AlternativeStateNameMapUpdaterTest, base::Optional entry1 = AlternativeStateNameMap::GetInstance()->GetEntry( AlternativeStateNameMap::CountryCode("ES"), - AlternativeStateNameMap::StateName(UTF8ToUTF16("Paraná"))); + AlternativeStateNameMap::StateName(u"Paraná")); EXPECT_NE(entry1, base::nullopt); EXPECT_EQ(entry1->canonical_name(), "Paraná"); EXPECT_THAT(entry1->abbreviations(), @@ -253,7 +253,7 @@ TEST_F(AlternativeStateNameMapUpdaterTest, base::Optional entry2 = AlternativeStateNameMap::GetInstance()->GetEntry( AlternativeStateNameMap::CountryCode("DE"), - AlternativeStateNameMap::StateName(UTF8ToUTF16("Bavaria"))); + AlternativeStateNameMap::StateName(u"Bavaria")); EXPECT_NE(entry2, base::nullopt); EXPECT_EQ(entry2->canonical_name(), "Bavaria"); EXPECT_THAT(entry2->abbreviations(), diff --git a/components/autofill/core/browser/geo/phone_number_i18n_unittest.cc b/components/autofill/core/browser/geo/phone_number_i18n_unittest.cc index a754895436b349..55355946cd8a72 100644 --- a/components/autofill/core/browser/geo/phone_number_i18n_unittest.cc +++ b/components/autofill/core/browser/geo/phone_number_i18n_unittest.cc @@ -42,10 +42,10 @@ TEST(PhoneNumberI18NTest, NormalizePhoneNumber) { std::u16string phone3(UTF8ToUTF16("16503334\xef\xbc\x92\x35\xd9\xa5")); EXPECT_EQ(NormalizePhoneNumber(phone3, "US"), ASCIIToUTF16("16503334255")); - std::u16string phone4(UTF8ToUTF16("+1(650)2346789")); + std::u16string phone4(u"+1(650)2346789"); EXPECT_EQ(NormalizePhoneNumber(phone4, "US"), ASCIIToUTF16("16502346789")); - std::u16string phone5(UTF8ToUTF16("6502346789")); + std::u16string phone5(u"6502346789"); EXPECT_EQ(NormalizePhoneNumber(phone5, "US"), ASCIIToUTF16("6502346789")); } diff --git a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc index f3d2d79f215f45..57c84e78c77657 100644 --- a/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc +++ b/components/autofill/core/browser/payments/credit_card_access_manager_unittest.cc @@ -1128,7 +1128,7 @@ TEST_F(CreditCardAccessManagerTest, FetchExpiredServerCardInvokesCvcPrompt) { // card. CreateServerCard(kTestGUID, kTestNumber); CreditCard* card = credit_card_access_manager_->GetCreditCard(kTestGUID); - card->SetExpirationYearFromString(base::UTF8ToUTF16("2010")); + card->SetExpirationYearFromString(u"2010"); GetFIDOAuthenticator()->SetUserVerifiable(true); SetUserOptedIn(true); payments_client_->AddFidoEligibleCard(card->server_id(), kCredentialId, diff --git a/components/autofill/core/browser/payments/payments_client_unittest.cc b/components/autofill/core/browser/payments/payments_client_unittest.cc index 6136f8cef267ec..67d39ccac9c96c 100644 --- a/components/autofill/core/browser/payments/payments_client_unittest.cc +++ b/components/autofill/core/browser/payments/payments_client_unittest.cc @@ -268,8 +268,8 @@ class PaymentsClientTest : public testing::Test { card1.SetNickname(base::ASCIIToUTF16("grocery")); CreditCard card2 = test::GetCreditCard2(); if (!has_cardholder_name) { - card1.SetRawInfo(CREDIT_CARD_NAME_FULL, base::UTF8ToUTF16("")); - card2.SetRawInfo(CREDIT_CARD_NAME_FULL, base::UTF8ToUTF16("")); + card1.SetRawInfo(CREDIT_CARD_NAME_FULL, u""); + card2.SetRawInfo(CREDIT_CARD_NAME_FULL, u""); } migratable_credit_cards_.push_back(MigratableCreditCard(card1)); migratable_credit_cards_.push_back(MigratableCreditCard(card2)); diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index 3c26632043c55e..fd78a3bf86bc01 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc @@ -2999,10 +2999,10 @@ TEST_F(PersonalDataManagerTest, GetProfileSuggestions_MobileShowAll) { {base::ASCIIToUTF16("Hoa"), base::ASCIIToUTF16("(978) 674-4120")})), testing::Field(&Suggestion::icon, "")), - AllOf(testing::Field(&Suggestion::label, - ConstructMobileLabelLine( - {base::UTF8ToUTF16("María"), - base::ASCIIToUTF16("(617) 268-6862")})), + AllOf(testing::Field( + &Suggestion::label, + ConstructMobileLabelLine( + {u"María", base::ASCIIToUTF16("(617) 268-6862")})), testing::Field(&Suggestion::icon, "")))); // Tests a form with name, address, phone number, and email address fields. @@ -3019,12 +3019,12 @@ TEST_F(PersonalDataManagerTest, GetProfileSuggestions_MobileShowAll) { base::ASCIIToUTF16("401 Merrimack St"), base::ASCIIToUTF16("(978) 674-4120")})), testing::Field(&Suggestion::icon, "")), - AllOf(testing::Field(&Suggestion::label, - ConstructMobileLabelLine( - {base::UTF8ToUTF16("María"), - base::ASCIIToUTF16("11 Elkins St"), - base::ASCIIToUTF16("(617) 268-6862")})), - testing::Field(&Suggestion::icon, "")))); + AllOf( + testing::Field(&Suggestion::label, + ConstructMobileLabelLine( + {u"María", base::ASCIIToUTF16("11 Elkins St"), + base::ASCIIToUTF16("(617) 268-6862")})), + testing::Field(&Suggestion::icon, "")))); } #endif // if defined(OS_ANDROID) || defined(OS_IOS) @@ -3654,7 +3654,7 @@ TEST_F(PersonalDataManagerTest, test::kEmptyOrigin); test::SetCreditCardInfo(&credit_card, "John Dillinger", "", "01", "2999", "1"); - credit_card.SetNickname(base::UTF8ToUTF16("nickname")); + credit_card.SetNickname(u"nickname"); personal_data_->AddCreditCard(credit_card); // Make sure everything is set up correctly. @@ -3668,7 +3668,7 @@ TEST_F(PersonalDataManagerTest, /*field_contents=*/std::u16string(), /*include_server_cards=*/true); ASSERT_EQ(1U, suggestions.size()); - EXPECT_EQ(base::UTF8ToUTF16("nickname"), suggestions[0].label); + EXPECT_EQ(u"nickname", suggestions[0].label); } // Tests the suggestions of duplicate local and server credit cards. @@ -4945,22 +4945,20 @@ TEST_F(PersonalDataManagerTest, ApplyDedupingRoutine_MergedProfileValues) { EXPECT_EQ(profile3.guid(), profiles[0]->guid()); // The address syntax that results from the merge should be the one from the // imported profile (highest frecency). - EXPECT_EQ(base::UTF8ToUTF16("742. Evergreen Terrace"), + EXPECT_EQ(u"742. Evergreen Terrace", profiles[0]->GetRawInfo(ADDRESS_HOME_LINE1)); // The middle name should be full, even if the profile with the higher // frecency only had an initial (no loss of information). - EXPECT_EQ(base::UTF8ToUTF16("Jay"), profiles[0]->GetRawInfo(NAME_MIDDLE)); + EXPECT_EQ(u"Jay", profiles[0]->GetRawInfo(NAME_MIDDLE)); // The specified phone number from profile1 should be kept (no loss of // information). - EXPECT_EQ(base::UTF8ToUTF16("12345678910"), - profiles[0]->GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); + EXPECT_EQ(u"12345678910", profiles[0]->GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); // The specified company name from profile2 should be kept (no loss of // information). - EXPECT_EQ(base::UTF8ToUTF16("Fox"), profiles[0]->GetRawInfo(COMPANY_NAME)); + EXPECT_EQ(u"Fox", profiles[0]->GetRawInfo(COMPANY_NAME)); // The specified country from the imported profile shoudl be kept (no loss of // information). - EXPECT_EQ(base::UTF8ToUTF16("US"), - profiles[0]->GetRawInfo(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(u"US", profiles[0]->GetRawInfo(ADDRESS_HOME_COUNTRY)); // The use count that results from the merge should be the max of all the // profiles use counts. EXPECT_EQ(10U, profiles[0]->use_count()); @@ -5033,7 +5031,7 @@ TEST_F(PersonalDataManagerTest, ApplyDedupingRoutine_VerifiedProfileFirst) { // still evolved with future observations. In this case, the "." was added // from a later observation. profile1.SetRawInfoWithVerificationStatus( - ADDRESS_HOME_STREET_NAME, base::UTF8ToUTF16("Evergreen Terrace"), + ADDRESS_HOME_STREET_NAME, u"Evergreen Terrace", structured_address::VerificationStatus::kParsed); // // Only the verified |profile1| with its original data should have been kept. @@ -5165,7 +5163,7 @@ TEST_F(PersonalDataManagerTest, ApplyDedupingRoutine_MultipleVerifiedProfiles) { // still evolved with future observations. In this case, the "." was removed // from a later observation. profile2.SetRawInfoWithVerificationStatus( - ADDRESS_HOME_STREET_NAME, base::UTF8ToUTF16("Evergreen Terrace"), + ADDRESS_HOME_STREET_NAME, u"Evergreen Terrace", structured_address::VerificationStatus::kParsed); // |profile1| should have been discarded because the saved profile with the @@ -5306,18 +5304,16 @@ TEST_F(PersonalDataManagerTest, ApplyDedupingRoutine_MultipleDedupes) { // |Homer3|'s data: // The address should be saved with the syntax of |Homer1| since it has the // highest frecency score. - EXPECT_EQ(base::UTF8ToUTF16("742. Evergreen Terrace"), + EXPECT_EQ(u"742. Evergreen Terrace", profiles[0]->GetRawInfo(ADDRESS_HOME_LINE1)); // The middle name should be the full version found in |Homer2|, - EXPECT_EQ(base::UTF8ToUTF16("Jay"), profiles[0]->GetRawInfo(NAME_MIDDLE)); + EXPECT_EQ(u"Jay", profiles[0]->GetRawInfo(NAME_MIDDLE)); // The phone number from |Homer2| should be kept (no loss of information). - EXPECT_EQ(base::UTF8ToUTF16("12345678910"), - profiles[0]->GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); + EXPECT_EQ(u"12345678910", profiles[0]->GetRawInfo(PHONE_HOME_WHOLE_NUMBER)); // The company name from |Homer3| should be kept (no loss of information). - EXPECT_EQ(base::UTF8ToUTF16("Fox"), profiles[0]->GetRawInfo(COMPANY_NAME)); + EXPECT_EQ(u"Fox", profiles[0]->GetRawInfo(COMPANY_NAME)); // The country from |Homer1| profile should be kept (no loss of information). - EXPECT_EQ(base::UTF8ToUTF16("US"), - profiles[0]->GetRawInfo(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(u"US", profiles[0]->GetRawInfo(ADDRESS_HOME_COUNTRY)); // The use count that results from the merge should be the max of Homer 1, 2 // and 3's respective use counts. EXPECT_EQ(10U, profiles[0]->use_count()); @@ -5486,12 +5482,9 @@ TEST_F(PersonalDataManagerTest, EXPECT_EQ(3U, personal_data_->GetProfiles().size()); EXPECT_EQ(2U, personal_data_->GetCreditCards().size()); - EXPECT_EQ(base::UTF8ToUTF16("Keep"), - personal_data_->GetProfiles()[0]->GetRawInfo(NAME_LAST)); - EXPECT_EQ(base::UTF8ToUTF16("Keep"), - personal_data_->GetProfiles()[1]->GetRawInfo(NAME_LAST)); - EXPECT_EQ(base::UTF8ToUTF16("Keep"), - personal_data_->GetProfiles()[2]->GetRawInfo(NAME_LAST)); + EXPECT_EQ(u"Keep", personal_data_->GetProfiles()[0]->GetRawInfo(NAME_LAST)); + EXPECT_EQ(u"Keep", personal_data_->GetProfiles()[1]->GetRawInfo(NAME_LAST)); + EXPECT_EQ(u"Keep", personal_data_->GetProfiles()[2]->GetRawInfo(NAME_LAST)); } // Tests that DeleteDisusedCreditCards deletes desired credit cards only. @@ -5576,9 +5569,7 @@ TEST_F(PersonalDataManagerTest, EXPECT_EQ(5U, personal_data_->GetCreditCards().size()); std::unordered_set expectedToRemain = { - base::UTF8ToUTF16("Alice"), base::UTF8ToUTF16("Bob"), - base::UTF8ToUTF16("Clyde"), base::UTF8ToUTF16("Emma"), - base::UTF8ToUTF16("Frank")}; + u"Alice", u"Bob", u"Clyde", u"Emma", u"Frank"}; for (auto* card : personal_data_->GetCreditCards()) { EXPECT_NE(expectedToRemain.end(), expectedToRemain.find(card->GetRawInfo(CREDIT_CARD_NAME_FULL))); @@ -5617,8 +5608,7 @@ TEST_F(PersonalDataManagerTest, DeleteLocalCreditCards) { EXPECT_EQ(1U, personal_data_->GetCreditCards().size()); - std::unordered_set expectedToRemain = { - base::UTF8ToUTF16("Clyde")}; + std::unordered_set expectedToRemain = {u"Clyde"}; for (auto* card : personal_data_->GetCreditCards()) { EXPECT_NE(expectedToRemain.end(), expectedToRemain.find(card->GetRawInfo(CREDIT_CARD_NAME_FULL))); @@ -5711,7 +5701,7 @@ TEST_F(PersonalDataManagerTest, // Make sure that the two profiles have not merged. ASSERT_EQ(2U, profiles.size()); - EXPECT_EQ(base::UTF8ToUTF16("John"), profiles[0]->GetRawInfo(NAME_FIRST)); + EXPECT_EQ(u"John", profiles[0]->GetRawInfo(NAME_FIRST)); EXPECT_EQ(local_profile, *profiles[1]); // Make sure that the billing address id of the two cards now point to the @@ -5809,11 +5799,9 @@ TEST_F(PersonalDataManagerTest, ASSERT_EQ(1U, profiles.size()); // Check that the values were merged. - EXPECT_EQ(base::UTF8ToUTF16("john@doe.com"), - profiles[0]->GetRawInfo(EMAIL_ADDRESS)); - EXPECT_EQ(base::UTF8ToUTF16("Fox"), profiles[0]->GetRawInfo(COMPANY_NAME)); - EXPECT_EQ(base::UTF8ToUTF16("32801"), - profiles[0]->GetRawInfo(ADDRESS_HOME_ZIP)); + EXPECT_EQ(u"john@doe.com", profiles[0]->GetRawInfo(EMAIL_ADDRESS)); + EXPECT_EQ(u"Fox", profiles[0]->GetRawInfo(COMPANY_NAME)); + EXPECT_EQ(u"32801", profiles[0]->GetRawInfo(ADDRESS_HOME_ZIP)); // Make sure that the billing address id of the two cards now point to the // converted profile. @@ -5969,13 +5957,12 @@ TEST_F( // Make sure that the two Wallet addresses merged together and were added as // a new local profile. ASSERT_EQ(2U, profiles.size()); - EXPECT_EQ(base::UTF8ToUTF16("John"), profiles[0]->GetRawInfo(NAME_FIRST)); + EXPECT_EQ(u"John", profiles[0]->GetRawInfo(NAME_FIRST)); EXPECT_EQ(local_profile, *profiles[1]); // Check that the values were merged. - EXPECT_EQ(base::UTF8ToUTF16("Fox"), profiles[0]->GetRawInfo(COMPANY_NAME)); - EXPECT_EQ(base::UTF8ToUTF16("32801"), - profiles[0]->GetRawInfo(ADDRESS_HOME_ZIP)); + EXPECT_EQ(u"Fox", profiles[0]->GetRawInfo(COMPANY_NAME)); + EXPECT_EQ(u"32801", profiles[0]->GetRawInfo(ADDRESS_HOME_ZIP)); // Make sure that the billing address id of the two cards now point to the // converted profile. @@ -6540,7 +6527,7 @@ TEST_F(PersonalDataManagerTest, CreateDataForTest) { auto it = std::find_if( addresses.begin(), addresses.end(), [this](const AutofillProfile* p) { return p->GetInfo(NAME_FULL, this->personal_data_->app_locale()) == - base::UTF8ToUTF16("John McTester"); + u"John McTester"; }); ASSERT_TRUE(it != addresses.end()); EXPECT_GT((*it)->use_date(), disused_threshold); @@ -6551,7 +6538,7 @@ TEST_F(PersonalDataManagerTest, CreateDataForTest) { auto it = std::find_if( addresses.begin(), addresses.end(), [this](const AutofillProfile* p) { return p->GetInfo(NAME_FULL, this->personal_data_->app_locale()) == - base::UTF8ToUTF16("Polly Disused"); + u"Polly Disused"; }); ASSERT_TRUE(it != addresses.end()); EXPECT_LT((*it)->use_date(), disused_threshold); @@ -6562,7 +6549,7 @@ TEST_F(PersonalDataManagerTest, CreateDataForTest) { auto it = std::find_if( addresses.begin(), addresses.end(), [this](const AutofillProfile* p) { return p->GetInfo(NAME_FULL, this->personal_data_->app_locale()) == - base::UTF8ToUTF16("Polly Deletable"); + u"Polly Deletable"; }); ASSERT_TRUE(it != addresses.end()); EXPECT_LT((*it)->use_date(), deletion_threshold); @@ -6575,7 +6562,7 @@ TEST_F(PersonalDataManagerTest, CreateDataForTest) { credit_cards.begin(), credit_cards.end(), [this](const CreditCard* cc) { return cc->GetInfo(CREDIT_CARD_NAME_FULL, this->personal_data_->app_locale()) == - base::UTF8ToUTF16("Alice Testerson"); + u"Alice Testerson"; }); ASSERT_TRUE(it != credit_cards.end()); EXPECT_GT((*it)->use_date(), disused_threshold); @@ -6587,7 +6574,7 @@ TEST_F(PersonalDataManagerTest, CreateDataForTest) { credit_cards.begin(), credit_cards.end(), [this](const CreditCard* cc) { return cc->GetInfo(CREDIT_CARD_NAME_FULL, this->personal_data_->app_locale()) == - base::UTF8ToUTF16("Bob Disused"); + u"Bob Disused"; }); ASSERT_TRUE(it != credit_cards.end()); EXPECT_LT((*it)->use_date(), disused_threshold); @@ -6599,7 +6586,7 @@ TEST_F(PersonalDataManagerTest, CreateDataForTest) { credit_cards.begin(), credit_cards.end(), [this](const CreditCard* cc) { return cc->GetInfo(CREDIT_CARD_NAME_FULL, this->personal_data_->app_locale()) == - base::UTF8ToUTF16("Charlie Deletable"); + u"Charlie Deletable"; }); ASSERT_TRUE(it != credit_cards.end()); EXPECT_LT((*it)->use_date(), deletion_threshold); @@ -7180,11 +7167,11 @@ TEST_F(PersonalDataManagerMockTest, UpdateClientValidityStates_UpdatedFlag) { ASSERT_TRUE(profiles[0]->is_client_validity_states_updated()); ASSERT_TRUE(profiles[1]->is_client_validity_states_updated()); - profiles[1]->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, base::UTF8ToUTF16("")); + profiles[1]->SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u""); ASSERT_TRUE(profiles[0]->is_client_validity_states_updated()); ASSERT_FALSE(profiles[1]->is_client_validity_states_updated()); - profiles[0]->SetRawInfo(NAME_FULL, base::UTF8ToUTF16("Goli Boli")); + profiles[0]->SetRawInfo(NAME_FULL, u"Goli Boli"); ASSERT_TRUE(profiles[0]->is_client_validity_states_updated()); } @@ -7199,7 +7186,7 @@ TEST_F(PersonalDataManagerMockTest, AutofillProfile profile2(test::GetFullValidProfileForCanada()); profile2.set_guid("00000000-0000-0000-0000-000000002019"); - profile2.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, base::UTF8ToUTF16("")); + profile2.SetRawInfo(PHONE_HOME_WHOLE_NUMBER, u""); profile2.FinalizeAfterImport(); AddProfileToPersonalDataManager(profile2); @@ -7230,7 +7217,7 @@ TEST_F(PersonalDataManagerMockTest, TEST_F(PersonalDataManagerMockTest, UpdateClientValidityStates_AlreadyUpdated) { // Create two profiles and add them to personal_data_. AutofillProfile profile1(test::GetFullValidProfileForCanada()); - profile1.SetRawInfo(EMAIL_ADDRESS, base::UTF8ToUTF16("invalid email!")); + profile1.SetRawInfo(EMAIL_ADDRESS, u"invalid email!"); AddProfileToPersonalDataManager(profile1); auto profiles = personal_data_->GetProfiles(); @@ -7241,7 +7228,7 @@ TEST_F(PersonalDataManagerMockTest, UpdateClientValidityStates_AlreadyUpdated) { profiles[0]->GetValidityState(EMAIL_ADDRESS, AutofillProfile::CLIENT)); // Change the email, the validity update would turn false. - profiles[0]->SetRawInfo(EMAIL_ADDRESS, base::UTF8ToUTF16("alice@gmail.com")); + profiles[0]->SetRawInfo(EMAIL_ADDRESS, u"alice@gmail.com"); EXPECT_FALSE(profiles[0]->is_client_validity_states_updated()); // Pretend that the validity states are updated. profiles[0]->set_is_client_validity_states_updated(true); @@ -7273,13 +7260,13 @@ TEST_F(PersonalDataManagerMockTest, UpdateClientValidityStates_Version) { // Create two profiles and add them to personal_data_. Set the guids // explicitly to preserve the order. AutofillProfile profile2(test::GetFullValidProfileForChina()); - profile2.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("invalid state!")); + profile2.SetRawInfo(ADDRESS_HOME_STATE, u"invalid state!"); profile2.set_guid("00000000-0000-0000-0000-000000000002"); profile2.set_use_date(AutofillClock::Now() - base::TimeDelta::FromDays(200)); AddProfileToPersonalDataManager(profile2); AutofillProfile profile1(test::GetFullValidProfileForCanada()); - profile1.SetRawInfo(EMAIL_ADDRESS, base::UTF8ToUTF16("invalid email!")); + profile1.SetRawInfo(EMAIL_ADDRESS, u"invalid email!"); profile1.set_use_date(AutofillClock::Now()); profile1.set_guid("00000000-0000-0000-0000-000000000001"); AddProfileToPersonalDataManager(profile1); @@ -7969,8 +7956,7 @@ TEST_P(PersonalDataManagerTestForSharingNickname, EXPECT_EQ(suggestions[0].value, (expected_nickname_.empty() ? base::ASCIIToUTF16("Amex") : expected_nickname_) + - base::UTF8ToUTF16(" ") + - local_card.ObfuscatedLastFourDigits()); + u" " + local_card.ObfuscatedLastFourDigits()); } TEST_P(PersonalDataManagerTestForSharingNickname, @@ -8002,10 +7988,10 @@ TEST_P(PersonalDataManagerTestForSharingNickname, testing::UnorderedElementsAre( (server_nickname_.empty() ? base::ASCIIToUTF16("Amex") : server_nickname_) + - base::UTF8ToUTF16(" ") + server_card.ObfuscatedLastFourDigits(), + u" " + server_card.ObfuscatedLastFourDigits(), (local_nickname_.empty() ? base::ASCIIToUTF16("Amex") : local_nickname_) + - base::UTF8ToUTF16(" ") + local_card.ObfuscatedLastFourDigits())); + u" " + local_card.ObfuscatedLastFourDigits())); } } // namespace autofill diff --git a/components/autofill/core/browser/ui/address_contact_form_label_formatter_unittest.cc b/components/autofill/core/browser/ui/address_contact_form_label_formatter_unittest.cc index 759da41462b2df..bfd9240f4da004 100644 --- a/components/autofill/core/browser/ui/address_contact_form_label_formatter_unittest.cc +++ b/components/autofill/core/browser/ui/address_contact_form_label_formatter_unittest.cc @@ -347,11 +347,10 @@ TEST(AddressContactFormLabelFormatterTest, EXPECT_THAT( formatter->GetLabels(), ElementsAre( - ConstructLabelLine( - {base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301"), - base::ASCIIToUTF16("(11) 2648-0254"), - base::ASCIIToUTF16("tarsila@aol.com")}), - ConstructLabelLine({base::UTF8ToUTF16("Estr. Dona Castorina, 110"), + ConstructLabelLine({u"Av. Pedro Álvares Cabral, 1301", + base::ASCIIToUTF16("(11) 2648-0254"), + base::ASCIIToUTF16("tarsila@aol.com")}), + ConstructLabelLine({u"Estr. Dona Castorina, 110", base::ASCIIToUTF16("(21) 98765-0000"), base::ASCIIToUTF16("aavila@uol.com.br")}))); } @@ -410,10 +409,9 @@ TEST(AddressContactFormLabelFormatterTest, EXPECT_THAT( formatter->GetLabels(), ElementsAre( - ConstructLabelLine( - {base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301"), - base::ASCIIToUTF16("(11) 2648-0254"), - base::ASCIIToUTF16("tarsila@aol.com")}), + ConstructLabelLine({u"Av. Pedro Álvares Cabral, 1301", + base::ASCIIToUTF16("(11) 2648-0254"), + base::ASCIIToUTF16("tarsila@aol.com")}), ConstructLabelLine({base::ASCIIToUTF16("Estr. Dona Castorina, 110"), base::ASCIIToUTF16("(21) 98765-0000"), base::ASCIIToUTF16("aavila@uol.com.br")}))); @@ -441,14 +439,12 @@ TEST(AddressContactFormLabelFormatterTest, EXPECT_THAT( formatter->GetLabels(), - ElementsAre( - ConstructLabelLine( - {base::ASCIIToUTF16("Tarsila do Amaral"), - base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301"), - base::ASCIIToUTF16("(11) 2648-0254")}), - ConstructLabelLine({base::ASCIIToUTF16("Artur Avila"), - base::UTF8ToUTF16("Estr. Dona Castorina, 110"), - base::ASCIIToUTF16("(21) 98765-0000")}))); + ElementsAre(ConstructLabelLine({base::ASCIIToUTF16("Tarsila do Amaral"), + u"Av. Pedro Álvares Cabral, 1301", + base::ASCIIToUTF16("(11) 2648-0254")}), + ConstructLabelLine({base::ASCIIToUTF16("Artur Avila"), + u"Estr. Dona Castorina, 110", + base::ASCIIToUTF16("(21) 98765-0000")}))); } TEST(AddressContactFormLabelFormatterTest, @@ -474,12 +470,11 @@ TEST(AddressContactFormLabelFormatterTest, EXPECT_THAT( formatter->GetLabels(), ElementsAre( - ConstructLabelLine( - {base::ASCIIToUTF16("Tarsila do Amaral"), - base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301"), - base::ASCIIToUTF16("tarsila@aol.com")}), + ConstructLabelLine({base::ASCIIToUTF16("Tarsila do Amaral"), + u"Av. Pedro Álvares Cabral, 1301", + base::ASCIIToUTF16("tarsila@aol.com")}), ConstructLabelLine({base::ASCIIToUTF16("Artur Avila"), - base::UTF8ToUTF16("Estr. Dona Castorina, 110"), + u"Estr. Dona Castorina, 110", base::ASCIIToUTF16("aavila@uol.com.br")}))); } diff --git a/components/autofill/core/browser/ui/address_email_form_label_formatter_unittest.cc b/components/autofill/core/browser/ui/address_email_form_label_formatter_unittest.cc index c0176571d17556..bab9ead2729d42 100644 --- a/components/autofill/core/browser/ui/address_email_form_label_formatter_unittest.cc +++ b/components/autofill/core/browser/ui/address_email_form_label_formatter_unittest.cc @@ -209,9 +209,8 @@ TEST(AddressEmailFormLabelFormatterTest, GetLabelsForBRProfilesAndFocusedName) { EXPECT_THAT( formatter->GetLabels(), ElementsAre( - ConstructLabelLine( - {base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301"), - base::ASCIIToUTF16("tarsila@aol.com")}), + ConstructLabelLine({u"Av. Pedro Álvares Cabral, 1301", + base::ASCIIToUTF16("tarsila@aol.com")}), ConstructLabelLine({base::ASCIIToUTF16("Estr. Dona Castorina, 110"), base::ASCIIToUTF16("aavila@uol.com.br")}))); } @@ -268,9 +267,8 @@ TEST(AddressEmailFormLabelFormatterTest, EXPECT_THAT( formatter->GetLabels(), ElementsAre( - ConstructLabelLine( - {base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301"), - base::ASCIIToUTF16("tarsila@aol.com")}), + ConstructLabelLine({u"Av. Pedro Álvares Cabral, 1301", + base::ASCIIToUTF16("tarsila@aol.com")}), ConstructLabelLine({base::ASCIIToUTF16("Estr. Dona Castorina, 110"), base::ASCIIToUTF16("aavila@uol.com.br")}))); } @@ -297,9 +295,8 @@ TEST(AddressEmailFormLabelFormatterTest, EXPECT_THAT( formatter->GetLabels(), - ElementsAre(ConstructLabelLine( - {base::ASCIIToUTF16("Tarsila do Amaral"), - base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301")}), + ElementsAre(ConstructLabelLine({base::ASCIIToUTF16("Tarsila do Amaral"), + u"Av. Pedro Álvares Cabral, 1301"}), ConstructLabelLine( {base::ASCIIToUTF16("Artur Avila"), base::ASCIIToUTF16("Estr. Dona Castorina, 110")}))); diff --git a/components/autofill/core/browser/ui/address_form_label_formatter_unittest.cc b/components/autofill/core/browser/ui/address_form_label_formatter_unittest.cc index 7fd510dc8aeaaa..4070c9a10b9b77 100644 --- a/components/autofill/core/browser/ui/address_form_label_formatter_unittest.cc +++ b/components/autofill/core/browser/ui/address_form_label_formatter_unittest.cc @@ -145,11 +145,10 @@ TEST(AddressFormLabelFormatterTest, const std::unique_ptr formatter = LabelFormatter::Create( profiles, "pt-BR", ADDRESS_HOME_LINE1, GetFieldTypes()); - EXPECT_THAT( - formatter->GetLabels(), - ElementsAre(ConstructLabelLine( - {base::ASCIIToUTF16("Tarsila Amaral"), - base::UTF8ToUTF16("Vila Mariana, São Paulo-SP, 04094-050")}))); + EXPECT_THAT(formatter->GetLabels(), + ElementsAre(ConstructLabelLine( + {base::ASCIIToUTF16("Tarsila Amaral"), + u"Vila Mariana, São Paulo-SP, 04094-050"}))); } TEST(AddressFormLabelFormatterTest, @@ -164,10 +163,10 @@ TEST(AddressFormLabelFormatterTest, const std::unique_ptr formatter = LabelFormatter::Create( profiles, "pt-BR", ADDRESS_HOME_ZIP, GetFieldTypes()); - EXPECT_THAT(formatter->GetLabels(), - ElementsAre(ConstructLabelLine( - {base::ASCIIToUTF16("Tarsila Amaral"), - base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301")}))); + EXPECT_THAT( + formatter->GetLabels(), + ElementsAre(ConstructLabelLine({base::ASCIIToUTF16("Tarsila Amaral"), + u"Av. Pedro Álvares Cabral, 1301"}))); } TEST(AddressFormLabelFormatterTest, GetLabelsForBRProfilesAndFocusedName) { diff --git a/components/autofill/core/browser/ui/address_phone_form_label_formatter_unittest.cc b/components/autofill/core/browser/ui/address_phone_form_label_formatter_unittest.cc index 28a9a9f2b5fe21..76fcd0a96c2f4e 100644 --- a/components/autofill/core/browser/ui/address_phone_form_label_formatter_unittest.cc +++ b/components/autofill/core/browser/ui/address_phone_form_label_formatter_unittest.cc @@ -204,9 +204,8 @@ TEST(AddressPhoneFormLabelFormatterTest, GetLabelsForBRProfilesAndFocusedName) { EXPECT_THAT( formatter->GetLabels(), - ElementsAre(ConstructLabelLine( - {base::ASCIIToUTF16("(11) 2648-0254"), - base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301")}), + ElementsAre(ConstructLabelLine({base::ASCIIToUTF16("(11) 2648-0254"), + u"Av. Pedro Álvares Cabral, 1301"}), ConstructLabelLine( {base::ASCIIToUTF16("(21) 98765-0000"), base::ASCIIToUTF16("Estr. Dona Castorina, 110")}))); @@ -263,9 +262,8 @@ TEST(AddressPhoneFormLabelFormatterTest, EXPECT_THAT( formatter->GetLabels(), ElementsAre( - ConstructLabelLine( - {base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301"), - base::ASCIIToUTF16("(11) 2648-0254")}), + ConstructLabelLine({u"Av. Pedro Álvares Cabral, 1301", + base::ASCIIToUTF16("(11) 2648-0254")}), ConstructLabelLine({base::ASCIIToUTF16("Estr. Dona Castorina, 110"), base::ASCIIToUTF16("(21) 98765-0000")}))); } @@ -292,9 +290,8 @@ TEST(AddressPhoneFormLabelFormatterTest, EXPECT_THAT( formatter->GetLabels(), - ElementsAre(ConstructLabelLine( - {base::ASCIIToUTF16("Tarsila do Amaral"), - base::UTF8ToUTF16("Av. Pedro Álvares Cabral, 1301")}), + ElementsAre(ConstructLabelLine({base::ASCIIToUTF16("Tarsila do Amaral"), + u"Av. Pedro Álvares Cabral, 1301"}), ConstructLabelLine( {base::ASCIIToUTF16("Artur Avila"), base::ASCIIToUTF16("Estr. Dona Castorina, 110")}))); diff --git a/components/autofill/core/browser/ui/suggestion_selection_unittest.cc b/components/autofill/core/browser/ui/suggestion_selection_unittest.cc index 2b516e24da6c88..673de879ed6a92 100644 --- a/components/autofill/core/browser/ui/suggestion_selection_unittest.cc +++ b/components/autofill/core/browser/ui/suggestion_selection_unittest.cc @@ -573,16 +573,14 @@ TEST_F(SuggestionSelectionTest, } TEST_F(SuggestionSelectionTest, PrepareSuggestions_SameStringInValueAndLabel) { - std::vector suggestions{ - Suggestion(base::UTF8ToUTF16("4 Mañana Road"))}; + std::vector suggestions{Suggestion(u"4 Mañana Road")}; const std::vector labels{ASCIIToUTF16("4 manana road")}; PrepareSuggestions(labels, &suggestions, comparator_); EXPECT_THAT(suggestions, - ElementsAre(AllOf( - Field(&Suggestion::value, base::UTF8ToUTF16("4 Mañana Road")), - Field(&Suggestion::label, std::u16string())))); + ElementsAre(AllOf(Field(&Suggestion::value, u"4 Mañana Road"), + Field(&Suggestion::label, std::u16string())))); } } // namespace suggestion_selection diff --git a/components/autofill/core/browser/validation.cc b/components/autofill/core/browser/validation.cc index 0aa667aaacb813..d673d5ceb43cda 100644 --- a/components/autofill/core/browser/validation.cc +++ b/components/autofill/core/browser/validation.cc @@ -290,10 +290,9 @@ bool IsValidForType(const std::u16string& value, case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR: case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR: { - const std::u16string pattern = - type == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR - ? base::UTF8ToUTF16("^[0-9]{1,2}[-/|]?[0-9]{2}$") - : base::UTF8ToUTF16("^[0-9]{1,2}[-/|]?[0-9]{4}$"); + const std::u16string pattern = type == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR + ? u"^[0-9]{1,2}[-/|]?[0-9]{2}$" + : u"^[0-9]{1,2}[-/|]?[0-9]{4}$"; CreditCard temp; temp.SetExpirationDateFromString(value); diff --git a/components/autofill/core/common/autofill_util.cc b/components/autofill/core/common/autofill_util.cc index 9d669d2ff745e2..1b7ee66b4522a5 100644 --- a/components/autofill/core/common/autofill_util.cc +++ b/components/autofill/core/common/autofill_util.cc @@ -89,7 +89,7 @@ bool FieldIsSuggestionSubstringStartingOnTokenBoundary( bool IsPrefixOfEmailEndingWithAtSign(const std::u16string& full_string, const std::u16string& prefix) { - return base::StartsWith(full_string, prefix + base::UTF8ToUTF16("@"), + return base::StartsWith(full_string, prefix + u"@", base::CompareCase::SENSITIVE); } diff --git a/components/autofill/core/common/field_data_manager_unittest.cc b/components/autofill/core/common/field_data_manager_unittest.cc index aafb6d5752e560..c885c676cbe6d3 100644 --- a/components/autofill/core/common/field_data_manager_unittest.cc +++ b/components/autofill/core/common/field_data_manager_unittest.cc @@ -44,14 +44,14 @@ TEST_F(FieldDataManagerTest, UpdateFieldDataMap) { FieldPropertiesFlags::kUserTyped); const FieldRendererId id(control_elements_[0].unique_renderer_id); EXPECT_TRUE(field_data_manager->HasFieldData(id)); - EXPECT_EQ(UTF8ToUTF16("first"), field_data_manager->GetUserInput(id)); + EXPECT_EQ(u"first", field_data_manager->GetUserInput(id)); EXPECT_EQ(FieldPropertiesFlags::kUserTyped, field_data_manager->GetFieldPropertiesMask(id)); field_data_manager->UpdateFieldDataMap( - control_elements_[0].unique_renderer_id, UTF8ToUTF16("newvalue"), + control_elements_[0].unique_renderer_id, u"newvalue", FieldPropertiesFlags::kAutofilled); - EXPECT_EQ(UTF8ToUTF16("newvalue"), field_data_manager->GetUserInput(id)); + EXPECT_EQ(u"newvalue", field_data_manager->GetUserInput(id)); FieldPropertiesMask mask = FieldPropertiesFlags::kUserTyped | FieldPropertiesFlags::kAutofilled; EXPECT_EQ(mask, field_data_manager->GetFieldPropertiesMask(id)); @@ -90,7 +90,7 @@ TEST_F(FieldDataManagerTest, UpdateFieldDataMapWithNullValue) { field_data_manager->UpdateFieldDataMap( control_elements_[0].unique_renderer_id, control_elements_[0].value, FieldPropertiesFlags::kAutofilled); - EXPECT_EQ(UTF8ToUTF16("first"), field_data_manager->GetUserInput(id)); + EXPECT_EQ(u"first", field_data_manager->GetUserInput(id)); } TEST_F(FieldDataManagerTest, FindMachedValue) { @@ -99,10 +99,8 @@ TEST_F(FieldDataManagerTest, FindMachedValue) { field_data_manager->UpdateFieldDataMap( control_elements_[0].unique_renderer_id, control_elements_[0].value, FieldPropertiesFlags::kUserTyped); - EXPECT_TRUE( - field_data_manager->FindMachedValue(UTF8ToUTF16("first_element"))); - EXPECT_FALSE( - field_data_manager->FindMachedValue(UTF8ToUTF16("second_element"))); + EXPECT_TRUE(field_data_manager->FindMachedValue(u"first_element")); + EXPECT_FALSE(field_data_manager->FindMachedValue(u"second_element")); } } // namespace autofill diff --git a/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc b/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc index 02c47b4bce19d1..c801ae1ce86128 100644 --- a/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc +++ b/components/autofill_assistant/browser/actions/collect_user_data_action_unittest.cc @@ -594,17 +594,15 @@ TEST_F(CollectUserDataActionTest, SelectContactDetails) { autofill::AutofillProfile contact_profile; contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, - base::UTF8ToUTF16("Marion Mitchell Morrison")); - contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_FIRST, - base::UTF8ToUTF16("Marion")); + u"Marion Mitchell Morrison"); + contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_FIRST, u"Marion"); contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_MIDDLE, - base::UTF8ToUTF16("Mitchell")); - contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_LAST, - base::UTF8ToUTF16("Morrison")); + u"Mitchell"); + contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_LAST, u"Morrison"); contact_profile.SetRawInfo(autofill::ServerFieldType::EMAIL_ADDRESS, - base::UTF8ToUTF16("marion@me.xyz")); + u"marion@me.xyz"); contact_profile.SetRawInfo(autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("16505678910")); + u"16505678910"); ON_CALL(mock_action_delegate_, CollectUserData(_)) .WillByDefault( @@ -647,11 +645,10 @@ TEST_F(CollectUserDataActionTest, SelectContactDetails) { EXPECT_EQ(user_data_.has_selected_address(kMemoryLocation), true); auto* profile = user_data_.selected_address(kMemoryLocation); EXPECT_EQ(profile->GetRawInfo(autofill::NAME_FULL), - base::UTF8ToUTF16("Marion Mitchell Morrison")); + u"Marion Mitchell Morrison"); EXPECT_EQ(profile->GetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER), - base::UTF8ToUTF16("16505678910")); - EXPECT_EQ(profile->GetRawInfo(autofill::EMAIL_ADDRESS), - base::UTF8ToUTF16("marion@me.xyz")); + u"16505678910"); + EXPECT_EQ(profile->GetRawInfo(autofill::EMAIL_ADDRESS), u"marion@me.xyz"); } TEST_F(CollectUserDataActionTest, @@ -898,8 +895,7 @@ TEST_F(CollectUserDataActionTest, UserDataComplete_Contact) { options)); user_data.selected_addresses_["profile"]->SetRawInfo( - autofill::ServerFieldType::EMAIL_ADDRESS, - base::UTF8ToUTF16("joedoe@example.com")); + autofill::ServerFieldType::EMAIL_ADDRESS, u"joedoe@example.com"); EXPECT_TRUE(CollectUserDataAction::IsUserDataComplete(user_data, user_model_, options)); @@ -908,7 +904,7 @@ TEST_F(CollectUserDataActionTest, UserDataComplete_Contact) { options)); user_data.selected_addresses_["profile"]->SetRawInfo( - autofill::ServerFieldType::NAME_FULL, base::UTF8ToUTF16("Joe Doe")); + autofill::ServerFieldType::NAME_FULL, u"Joe Doe"); EXPECT_TRUE(CollectUserDataAction::IsUserDataComplete(user_data, user_model_, options)); @@ -917,8 +913,7 @@ TEST_F(CollectUserDataActionTest, UserDataComplete_Contact) { options)); user_data.selected_addresses_["profile"]->SetRawInfo( - autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("+1 23 456 789 01")); + autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, u"+1 23 456 789 01"); EXPECT_TRUE(CollectUserDataAction::IsUserDataComplete(user_data, user_model_, options)); } @@ -957,15 +952,15 @@ TEST_F(CollectUserDataActionTest, UserDataComplete_Payment) { options)); user_data.selected_addresses_["billing_address"]->SetRawInfo( - autofill::ADDRESS_HOME_ZIP, base::UTF8ToUTF16("91601")); + autofill::ADDRESS_HOME_ZIP, u"91601"); EXPECT_TRUE(CollectUserDataAction::IsUserDataComplete(user_data, user_model_, options)); // Zip code is optional in Argentinian address. user_data.selected_addresses_["billing_address"]->SetRawInfo( - autofill::ADDRESS_HOME_ZIP, base::UTF8ToUTF16("")); + autofill::ADDRESS_HOME_ZIP, u""); user_data.selected_addresses_["billing_address"]->SetRawInfo( - autofill::ADDRESS_HOME_COUNTRY, base::UTF8ToUTF16("AR")); + autofill::ADDRESS_HOME_COUNTRY, u"AR"); EXPECT_TRUE(CollectUserDataAction::IsUserDataComplete(user_data, user_model_, options)); @@ -974,13 +969,13 @@ TEST_F(CollectUserDataActionTest, UserDataComplete_Payment) { options)); user_data.selected_addresses_["billing_address"]->SetRawInfo( - autofill::ADDRESS_HOME_ZIP, base::UTF8ToUTF16("B1675")); + autofill::ADDRESS_HOME_ZIP, u"B1675"); EXPECT_TRUE(CollectUserDataAction::IsUserDataComplete(user_data, user_model_, options)); // Expired credit card. user_data.selected_card_->SetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR, - base::UTF8ToUTF16("2019")); + u"2019"); EXPECT_FALSE(CollectUserDataAction::IsUserDataComplete(user_data, user_model_, options)); } @@ -1036,7 +1031,7 @@ TEST_F(CollectUserDataActionTest, UserDataComplete_ShippingAddress) { options)); user_data.selected_addresses_["shipping_address"]->SetRawInfo( - autofill::ADDRESS_HOME_ZIP, base::UTF8ToUTF16("91601")); + autofill::ADDRESS_HOME_ZIP, u"91601"); EXPECT_TRUE(CollectUserDataAction::IsUserDataComplete(user_data, user_model_, options)); } diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index a4f038ba27e599..fd21bce30d880f 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc @@ -2022,11 +2022,10 @@ TEST_F(ControllerTest, UserDataFormContactInfo) { autofill::AutofillProfile contact_profile; contact_profile.SetRawInfo(autofill::ServerFieldType::EMAIL_ADDRESS, - base::UTF8ToUTF16("joedoe@example.com")); - contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, - base::UTF8ToUTF16("Joe Doe")); + u"joedoe@example.com"); + contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, u"Joe Doe"); contact_profile.SetRawInfo(autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("+1 23 456 789 01")); + u"+1 23 456 789 01"); controller_->SetContactInfo( std::make_unique(contact_profile)); EXPECT_THAT(controller_->GetUserData() @@ -2115,11 +2114,10 @@ TEST_F(ControllerTest, UserDataChangesByOutOfLoopWrite) { .Times(1); autofill::AutofillProfile contact_profile; contact_profile.SetRawInfo(autofill::ServerFieldType::EMAIL_ADDRESS, - base::UTF8ToUTF16("joedoe@example.com")); - contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, - base::UTF8ToUTF16("Joe Doe")); + u"joedoe@example.com"); + contact_profile.SetRawInfo(autofill::ServerFieldType::NAME_FULL, u"Joe Doe"); contact_profile.SetRawInfo(autofill::ServerFieldType::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("+1 23 456 789 01")); + u"+1 23 456 789 01"); controller_->SetContactInfo( std::make_unique(contact_profile)); EXPECT_THAT(controller_->GetUserData() @@ -2846,9 +2844,9 @@ TEST_F(ControllerTest, RegularScriptShowsDefaultInitialStatusMessage) { SetupActionsForScript("script", actions_response); testing::InSequence seq; - EXPECT_CALL(mock_observer_, OnStatusMessageChanged(l10n_util::GetStringFUTF8( - IDS_AUTOFILL_ASSISTANT_LOADING, - base::UTF8ToUTF16("a.example.com")))) + EXPECT_CALL(mock_observer_, + OnStatusMessageChanged(l10n_util::GetStringFUTF8( + IDS_AUTOFILL_ASSISTANT_LOADING, u"a.example.com"))) .Times(1); EXPECT_CALL(mock_observer_, OnStatusMessageChanged("Hello World")).Times(1); Start("http://a.example.com/path"); @@ -2912,9 +2910,9 @@ TEST_F(ControllerTest, RuntimeManagerDestroyed) { } TEST_F(ControllerTest, OnGetScriptsFailedWillShutdown) { - EXPECT_CALL(mock_observer_, OnStatusMessageChanged(l10n_util::GetStringFUTF8( - IDS_AUTOFILL_ASSISTANT_LOADING, - base::UTF8ToUTF16("initialurl.com")))) + EXPECT_CALL(mock_observer_, + OnStatusMessageChanged(l10n_util::GetStringFUTF8( + IDS_AUTOFILL_ASSISTANT_LOADING, u"initialurl.com"))) .Times(1); EXPECT_CALL(*mock_service_, OnGetScriptsForUrl(_, _, _)) .WillOnce(RunOnceCallback<2>(net::HTTP_NOT_FOUND, "")); diff --git a/components/bookmarks/browser/bookmark_model_unittest.cc b/components/bookmarks/browser/bookmark_model_unittest.cc index 789da0d87ee1b8..a875ab5257229e 100644 --- a/components/bookmarks/browser/bookmark_model_unittest.cc +++ b/components/bookmarks/browser/bookmark_model_unittest.cc @@ -789,7 +789,7 @@ TEST_F(BookmarkModelTest, SetFolderTitle) { const BookmarkNode* node = model_->AddURL(folder, 0, title, url); ClearCounts(); - model_->SetTitle(folder, base::UTF8ToUTF16("golder")); + model_->SetTitle(folder, u"golder"); // Should not change the hierarchy. EXPECT_EQ(root->children().size(), 1u); diff --git a/components/bookmarks/browser/titled_url_index_unittest.cc b/components/bookmarks/browser/titled_url_index_unittest.cc index b098edb7da37a5..91e2d80c151f5e 100644 --- a/components/bookmarks/browser/titled_url_index_unittest.cc +++ b/components/bookmarks/browser/titled_url_index_unittest.cc @@ -579,9 +579,9 @@ TEST_F(TitledUrlIndexTest, RetrieveNodesMatchingAllTerms) { for (const TestData& test_data : data) { SCOPED_TRACE("Query: " + test_data.query); - std::vector terms = base::SplitString( - base::UTF8ToUTF16(test_data.query), base::UTF8ToUTF16(" "), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector terms = + base::SplitString(base::UTF8ToUTF16(test_data.query), u" ", + base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); auto matches = index()->RetrieveNodesMatchingAllTermsForTesting( terms, query_parser::MatchingAlgorithm::DEFAULT); if (test_data.should_be_retrieved) { @@ -614,9 +614,9 @@ TEST_F(TitledUrlIndexTest, RetrieveNodesMatchingAnyTerms) { for (const TestData& test_data : data) { SCOPED_TRACE("Query: " + test_data.query); - std::vector terms = base::SplitString( - base::UTF8ToUTF16(test_data.query), base::UTF8ToUTF16(" "), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); + std::vector terms = + base::SplitString(base::UTF8ToUTF16(test_data.query), u" ", + base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); auto matches = index()->RetrieveNodesMatchingAnyTermsForTesting( terms, query_parser::MatchingAlgorithm::DEFAULT); if (test_data.should_be_retrieved) { diff --git a/components/drive/search_metadata_unittest.cc b/components/drive/search_metadata_unittest.cc index bd4eb4074defbe..9a44bd53683b19 100644 --- a/components/drive/search_metadata_unittest.cc +++ b/components/drive/search_metadata_unittest.cc @@ -124,7 +124,7 @@ TEST(SearchMetadataSimpleTest, MultiTextBySingleQuery) { queries; queries.push_back(std::make_unique< base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents>( - base::UTF8ToUTF16("hello"))); + u"hello")); std::string highlighted_text; EXPECT_TRUE(FindAndHighlight("hello", queries, &highlighted_text)); @@ -160,10 +160,10 @@ TEST(SearchMetadataSimpleTest, FindAndHighlight_MultipleQueries) { queries; queries.push_back(std::make_unique< base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents>( - base::UTF8ToUTF16("hello"))); - queries.push_back(std::make_unique< - base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents>( - base::UTF8ToUTF16("good"))); + u"hello")); + queries.push_back( + std::make_unique< + base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents>(u"good")); std::string highlighted_text; EXPECT_TRUE( @@ -177,10 +177,10 @@ TEST(SearchMetadataSimpleTest, FindAndHighlight_OverlappingHighlights) { queries; queries.push_back(std::make_unique< base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents>( - base::UTF8ToUTF16("morning"))); - queries.push_back(std::make_unique< - base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents>( - base::UTF8ToUTF16("ing,"))); + u"morning")); + queries.push_back( + std::make_unique< + base::i18n::FixedPatternStringSearchIgnoringCaseAndAccents>(u"ing,")); std::string highlighted_text; EXPECT_TRUE( diff --git a/components/exo/data_offer_unittest.cc b/components/exo/data_offer_unittest.cc index a1186920eebc07..5bc67680dcbd01 100644 --- a/components/exo/data_offer_unittest.cc +++ b/components/exo/data_offer_unittest.cc @@ -406,7 +406,7 @@ TEST_F(DataOfferTest, SetClipboardDataPlainText) { TestDataExchangeDelegate data_exchange_delegate; { ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); - writer.WriteText(base::UTF8ToUTF16("Test data")); + writer.WriteText(u"Test data"); } auto* window = CreateTestWindowInShellWithBounds(gfx::Rect()); @@ -450,7 +450,7 @@ TEST_F(DataOfferTest, SetClipboardDataHTML) { TestDataExchangeDelegate data_exchange_delegate; { ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); - writer.WriteHTML(base::UTF8ToUTF16("Test data"), ""); + writer.WriteHTML(u"Test data", ""); } auto* window = CreateTestWindowInShellWithBounds(gfx::Rect()); @@ -607,7 +607,7 @@ TEST_F(DataOfferTest, SetClipboardDataWithTransferPolicy) { ui::ScopedClipboardWriter writer( ui::ClipboardBuffer::kCopyPaste, std::make_unique(ui::EndpointType::kArc)); - writer.WriteText(base::UTF8ToUTF16("Test data")); + writer.WriteText(u"Test data"); } auto* window = CreateTestWindowInShellWithBounds(gfx::Rect()); diff --git a/components/exo/extended_drag_source_unittest.cc b/components/exo/extended_drag_source_unittest.cc index 6030b51186e58a..f40b2ea5516aea 100644 --- a/components/exo/extended_drag_source_unittest.cc +++ b/components/exo/extended_drag_source_unittest.cc @@ -135,7 +135,7 @@ class ExtendedDragSourceTest : public test::ExoTestBase { int operation, ui::mojom::DragEventSource source) { auto data = std::make_unique(); - data->SetString(base::UTF8ToUTF16("I am being dragged")); + data->SetString(u"I am being dragged"); drag_drop_controller_->set_toplevel_window_drag_delegate( extended_drag_source_.get()); drag_drop_controller_->StartDragAndDrop(std::move(data), diff --git a/components/exo/seat_unittest.cc b/components/exo/seat_unittest.cc index 4a3dac7d112bf3..fa80d56ebe85df 100644 --- a/components/exo/seat_unittest.cc +++ b/components/exo/seat_unittest.cc @@ -427,7 +427,7 @@ TEST_F(SeatTest, SetSelection_ClipboardChangedDuringSetSelection) { { ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); - writer.WriteText(base::UTF8ToUTF16("New data")); + writer.WriteText(u"New data"); } RunReadingTask(); @@ -453,7 +453,7 @@ TEST_F(SeatTest, SetSelection_ClipboardChangedAfterSetSelection) { { ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); - writer.WriteText(base::UTF8ToUTF16("New data")); + writer.WriteText(u"New data"); } // The previous source should be cancelled. @@ -472,7 +472,7 @@ TEST_F(SeatTest, SetSelection_SourceDestroyedDuringSetSelection) { { ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); - writer.WriteText(base::UTF8ToUTF16("Original data")); + writer.WriteText(u"Original data"); } { @@ -534,7 +534,7 @@ TEST_F(SeatTest, SetSelection_NullSource) { { ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste); - writer.WriteText(base::UTF8ToUTF16("Golden data")); + writer.WriteText(u"Golden data"); } // Should not affect the current state of the clipboard. diff --git a/components/filename_generation/filename_generation_unittest.cc b/components/filename_generation/filename_generation_unittest.cc index a95bacb06b1b51..02c8596152bbc2 100644 --- a/components/filename_generation/filename_generation_unittest.cc +++ b/components/filename_generation/filename_generation_unittest.cc @@ -151,8 +151,7 @@ static const struct GenerateFilenameTestCase { {"http://foo.com/@.txt", base::ASCIIToUTF16("foo.com/@.txt"), FPL("@.txt"), false}, // A URL with punycode in the host name, when title matches the URL. - {"http://xn--bcher-kva.com", base::UTF8ToUTF16("bücher.com"), - FPL("bücher.com"), false}, + {"http://xn--bcher-kva.com", u"bücher.com", FPL("bücher.com"), false}, // If the title matches the URL, but there is no "filename" component, // use the domain. {"http://foo.com", base::ASCIIToUTF16("foo.com"), FPL("foo.com"), false}, diff --git a/components/history/core/browser/history_backend_unittest.cc b/components/history/core/browser/history_backend_unittest.cc index 857efdc900d76c..80bc5dc2cb2057 100644 --- a/components/history/core/browser/history_backend_unittest.cc +++ b/components/history/core/browser/history_backend_unittest.cc @@ -532,7 +532,7 @@ class InMemoryHistoryBackendTest : public HistoryBackendTestBase { static URLRow CreateTestTypedURL() { URLRow url_row(GURL("https://www.google.com/")); url_row.set_id(10); - url_row.set_title(base::UTF8ToUTF16("Google Search")); + url_row.set_title(u"Google Search"); url_row.set_typed_count(1); url_row.set_visit_count(1); url_row.set_last_visit(base::Time::Now() - base::TimeDelta::FromHours(1)); @@ -542,7 +542,7 @@ class InMemoryHistoryBackendTest : public HistoryBackendTestBase { static URLRow CreateAnotherTestTypedURL() { URLRow url_row(GURL("https://maps.google.com/")); url_row.set_id(20); - url_row.set_title(base::UTF8ToUTF16("Google Maps")); + url_row.set_title(u"Google Maps"); url_row.set_typed_count(2); url_row.set_visit_count(3); url_row.set_last_visit(base::Time::Now() - base::TimeDelta::FromHours(2)); @@ -552,7 +552,7 @@ class InMemoryHistoryBackendTest : public HistoryBackendTestBase { static URLRow CreateTestNonTypedURL() { URLRow url_row(GURL("https://news.google.com/")); url_row.set_id(30); - url_row.set_title(base::UTF8ToUTF16("Google News")); + url_row.set_title(u"Google News"); url_row.set_visit_count(5); url_row.set_last_visit(base::Time::Now() - base::TimeDelta::FromHours(3)); return url_row; @@ -814,7 +814,7 @@ TEST_F(HistoryBackendTest, DeleteAllThenAddData) { ASSERT_EQ(0U, all_visits.size()); // Try and set the title. - backend_->SetPageTitle(url, base::UTF8ToUTF16("Title")); + backend_->SetPageTitle(url, u"Title"); // The row should still be deleted. EXPECT_FALSE(backend_->db_->GetRowForURL(url, &outrow)); @@ -1004,8 +1004,8 @@ TEST_F(HistoryBackendTest, ClientRedirect) { // Do not update original URL on form submission redirect TEST_F(HistoryBackendTest, FormSubmitRedirect) { ASSERT_TRUE(backend_.get()); - const std::u16string page1_title = base::UTF8ToUTF16("Form"); - const std::u16string page2_title = base::UTF8ToUTF16("New Page"); + const std::u16string page1_title = u"Form"; + const std::u16string page2_title = u"New Page"; // User goes to form page. GURL url_a("http://www.google.com/a"); @@ -2377,7 +2377,7 @@ TEST_F(HistoryBackendTest, AddPageNoVisitForBookmark) { ASSERT_TRUE(backend_.get()); GURL url("http://www.google.com"); - std::u16string title(base::UTF8ToUTF16("Bookmark title")); + std::u16string title(u"Bookmark title"); backend_->AddPageNoVisitForBookmark(url, title); URLRow row; @@ -2520,7 +2520,7 @@ TEST_F(HistoryBackendTest, DeleteMatchingUrlsForKeyword) { EXPECT_NE(0, url1_id); KeywordID keyword_id = 1; - std::u16string keyword = base::UTF8ToUTF16("bar"); + std::u16string keyword = u"bar"; ASSERT_TRUE(backend_->db()->SetKeywordSearchTermsForURL( url1_id, keyword_id, keyword)); @@ -2892,7 +2892,7 @@ TEST_F(HistoryBackendTest, FlocAllowedFieldInQueryResult) { EXPECT_EQ(results[2].url(), url1); EXPECT_FALSE(results[2].floc_allowed()); - text_query = base::UTF8ToUTF16("foo"); + text_query = u"foo"; results = backend_->QueryHistory(text_query, options); ASSERT_EQ(results.size(), 3u); EXPECT_EQ(results[0].url(), url1); diff --git a/components/history/core/browser/history_service_unittest.cc b/components/history/core/browser/history_service_unittest.cc index dca1ec2f80f04d..c850c425425d89 100644 --- a/components/history/core/browser/history_service_unittest.cc +++ b/components/history/core/browser/history_service_unittest.cc @@ -467,7 +467,7 @@ TEST_F(HistoryServiceTest, SetTitle) { existing_url, base::Time::Now(), history::SOURCE_BROWSED); // Set some title. - const std::u16string existing_title = base::UTF8ToUTF16("Google"); + const std::u16string existing_title = u"Google"; history_service_->SetPageTitle(existing_url, existing_title); // Make sure the title got set. @@ -476,7 +476,7 @@ TEST_F(HistoryServiceTest, SetTitle) { // set a title on a nonexistent page const GURL nonexistent_url("http://news.google.com/"); - const std::u16string nonexistent_title = base::UTF8ToUTF16("Google News"); + const std::u16string nonexistent_title = u"Google News"; history_service_->SetPageTitle(nonexistent_url, nonexistent_title); // Make sure nothing got written. diff --git a/components/history/core/browser/url_database_unittest.cc b/components/history/core/browser/url_database_unittest.cc index 8381de2cc81ae1..8f0172f4bdd08a 100644 --- a/components/history/core/browser/url_database_unittest.cc +++ b/components/history/core/browser/url_database_unittest.cc @@ -87,7 +87,7 @@ TEST_F(URLDatabaseTest, AddAndUpdateURL) { // First, add two URLs. const GURL url1("http://www.google.com/"); URLRow url_info1(url1); - url_info1.set_title(base::UTF8ToUTF16("Google")); + url_info1.set_title(u"Google"); url_info1.set_visit_count(4); url_info1.set_typed_count(2); url_info1.set_last_visit(Time::Now() - TimeDelta::FromDays(1)); @@ -97,7 +97,7 @@ TEST_F(URLDatabaseTest, AddAndUpdateURL) { const GURL url2("http://mail.google.com/"); URLRow url_info2(url2); - url_info2.set_title(base::UTF8ToUTF16("Google Mail")); + url_info2.set_title(u"Google Mail"); url_info2.set_visit_count(3); url_info2.set_typed_count(0); url_info2.set_last_visit(Time::Now() - TimeDelta::FromDays(2)); @@ -113,7 +113,7 @@ TEST_F(URLDatabaseTest, AddAndUpdateURL) { EXPECT_TRUE(IsURLRowEqual(url_info2, info)); // Update the second. - url_info2.set_title(base::UTF8ToUTF16("Google Mail Too")); + url_info2.set_title(u"Google Mail Too"); url_info2.set_visit_count(4); url_info2.set_typed_count(1); url_info2.set_typed_count(91011); @@ -134,7 +134,7 @@ TEST_F(URLDatabaseTest, AddAndUpdateURL) { // Update an existing URL and insert a new one using the upsert operation. url_info1.set_id(id1_initially); - url_info1.set_title(base::UTF8ToUTF16("Google Again!")); + url_info1.set_title(u"Google Again!"); url_info1.set_visit_count(5); url_info1.set_typed_count(3); url_info1.set_last_visit(Time::Now()); @@ -144,7 +144,7 @@ TEST_F(URLDatabaseTest, AddAndUpdateURL) { const GURL url4("http://maps.google.com/"); URLRow url_info4(url4); url_info4.set_id(43); - url_info4.set_title(base::UTF8ToUTF16("Google Maps")); + url_info4.set_title(u"Google Maps"); url_info4.set_visit_count(7); url_info4.set_typed_count(6); url_info4.set_last_visit(Time::Now() - TimeDelta::FromDays(3)); @@ -175,7 +175,7 @@ TEST_F(URLDatabaseTest, AddAndUpdateURL) { // Tests adding, querying and deleting keyword visits. TEST_F(URLDatabaseTest, KeywordSearchTermVisit) { URLRow url_info1(GURL("http://www.google.com/")); - url_info1.set_title(base::UTF8ToUTF16("Google")); + url_info1.set_title(u"Google"); url_info1.set_visit_count(4); url_info1.set_typed_count(2); url_info1.set_last_visit(Time::Now() - TimeDelta::FromDays(1)); @@ -185,14 +185,13 @@ TEST_F(URLDatabaseTest, KeywordSearchTermVisit) { // Add a keyword visit. KeywordID keyword_id = 100; - std::u16string keyword = base::UTF8ToUTF16(" VISIT "); - std::u16string normalized_keyword = base::UTF8ToUTF16("visit"); + std::u16string keyword = u" VISIT "; + std::u16string normalized_keyword = u"visit"; ASSERT_TRUE(SetKeywordSearchTermsForURL(url_id, keyword_id, keyword)); // Make sure we get it back. std::vector matches; - GetMostRecentKeywordSearchTerms(keyword_id, base::UTF8ToUTF16("vi"), 10, - &matches); + GetMostRecentKeywordSearchTerms(keyword_id, u"vi", 10, &matches); ASSERT_EQ(1U, matches.size()); ASSERT_EQ(keyword, matches[0].term); @@ -226,7 +225,7 @@ TEST_F(URLDatabaseTest, KeywordSearchTermVisit) { // Make sure deleting a URL also deletes a keyword visit. TEST_F(URLDatabaseTest, DeleteURLDeletesKeywordSearchTermVisit) { URLRow url_info1(GURL("http://www.google.com/")); - url_info1.set_title(base::UTF8ToUTF16("Google")); + url_info1.set_title(u"Google"); url_info1.set_visit_count(4); url_info1.set_typed_count(2); url_info1.set_last_visit(Time::Now() - TimeDelta::FromDays(1)); @@ -235,15 +234,14 @@ TEST_F(URLDatabaseTest, DeleteURLDeletesKeywordSearchTermVisit) { ASSERT_NE(0, url_id); // Add a keyword visit. - ASSERT_TRUE( - SetKeywordSearchTermsForURL(url_id, 1, base::UTF8ToUTF16("visit"))); + ASSERT_TRUE(SetKeywordSearchTermsForURL(url_id, 1, u"visit")); // Delete the url. ASSERT_TRUE(DeleteURLRow(url_id)); // Make sure the keyword visit was deleted. std::vector matches; - GetMostRecentKeywordSearchTerms(1, base::UTF8ToUTF16("visit"), 10, &matches); + GetMostRecentKeywordSearchTerms(1, u"visit", 10, &matches); ASSERT_EQ(0U, matches.size()); } @@ -310,7 +308,7 @@ TEST_F(URLDatabaseTest, EnumeratorForSignificant) { // Test GetKeywordSearchTermRows and DeleteSearchTerm TEST_F(URLDatabaseTest, GetAndDeleteKeywordSearchTermByTerm) { URLRow url_info1(GURL("http://www.google.com/")); - url_info1.set_title(base::UTF8ToUTF16("Google")); + url_info1.set_title(u"Google"); url_info1.set_visit_count(4); url_info1.set_typed_count(2); url_info1.set_last_visit(Time::Now() - TimeDelta::FromDays(1)); @@ -320,11 +318,11 @@ TEST_F(URLDatabaseTest, GetAndDeleteKeywordSearchTermByTerm) { // Add a keyword visit. KeywordID keyword_id = 100; - std::u16string keyword = base::UTF8ToUTF16("visit"); + std::u16string keyword = u"visit"; ASSERT_TRUE(SetKeywordSearchTermsForURL(url_id1, keyword_id, keyword)); URLRow url_info2(GURL("https://www.google.com/")); - url_info2.set_title(base::UTF8ToUTF16("Google")); + url_info2.set_title(u"Google"); url_info2.set_visit_count(4); url_info2.set_typed_count(2); url_info2.set_last_visit(Time::Now() - TimeDelta::FromDays(1)); @@ -336,14 +334,14 @@ TEST_F(URLDatabaseTest, GetAndDeleteKeywordSearchTermByTerm) { // Add another URL for different keyword. URLRow url_info3(GURL("https://www.google.com/search")); - url_info3.set_title(base::UTF8ToUTF16("Google")); + url_info3.set_title(u"Google"); url_info3.set_visit_count(4); url_info3.set_typed_count(2); url_info3.set_last_visit(Time::Now() - TimeDelta::FromDays(1)); url_info3.set_hidden(false); URLID url_id3 = AddURL(url_info3); ASSERT_NE(0, url_id3); - std::u16string keyword2 = base::UTF8ToUTF16("Search"); + std::u16string keyword2 = u"Search"; ASSERT_TRUE(SetKeywordSearchTermsForURL(url_id3, keyword_id, keyword2)); @@ -391,7 +389,7 @@ TEST_F(URLDatabaseTest, MigrationURLTableForAddingAUTOINCREMENT) { // First, add two URLs. const GURL url1("http://www.google.com/"); URLRow url_info1(url1); - url_info1.set_title(base::UTF8ToUTF16("Google")); + url_info1.set_title(u"Google"); url_info1.set_visit_count(4); url_info1.set_typed_count(2); url_info1.set_last_visit(Time::Now() - TimeDelta::FromDays(1)); @@ -401,7 +399,7 @@ TEST_F(URLDatabaseTest, MigrationURLTableForAddingAUTOINCREMENT) { const GURL url2("http://mail.google.com/"); URLRow url_info2(url2); - url_info2.set_title(base::UTF8ToUTF16("Google Mail")); + url_info2.set_title(u"Google Mail"); url_info2.set_visit_count(3); url_info2.set_typed_count(0); url_info2.set_last_visit(Time::Now() - TimeDelta::FromDays(2)); @@ -421,7 +419,7 @@ TEST_F(URLDatabaseTest, MigrationURLTableForAddingAUTOINCREMENT) { const GURL url3("http://maps.google.com/"); URLRow url_info3(url3); - url_info3.set_title(base::UTF8ToUTF16("Google Maps")); + url_info3.set_title(u"Google Maps"); url_info3.set_visit_count(7); url_info3.set_typed_count(6); url_info3.set_last_visit(Time::Now() - TimeDelta::FromDays(3)); @@ -447,7 +445,7 @@ TEST_F(URLDatabaseTest, MigrationURLTableForAddingAUTOINCREMENT) { // Add a new URL const GURL url4("http://plus.google.com/"); URLRow url_info4(url4); - url_info4.set_title(base::UTF8ToUTF16("Google Plus")); + url_info4.set_title(u"Google Plus"); url_info4.set_visit_count(4); url_info4.set_typed_count(3); url_info4.set_last_visit(Time::Now() - TimeDelta::FromDays(4)); @@ -464,7 +462,7 @@ TEST_F(URLDatabaseTest, MigrationURLTableForAddingAUTOINCREMENT) { const GURL url5("http://docs.google.com/"); URLRow url_info5(url5); - url_info5.set_title(base::UTF8ToUTF16("Google Docs")); + url_info5.set_title(u"Google Docs"); url_info5.set_visit_count(9); url_info5.set_typed_count(2); url_info5.set_last_visit(Time::Now() - TimeDelta::FromDays(5)); diff --git a/components/ntp_snippets/remote/remote_suggestion_builder.cc b/components/ntp_snippets/remote/remote_suggestion_builder.cc index b9bcf31f9971fc..8db2237e4ccf29 100644 --- a/components/ntp_snippets/remote/remote_suggestion_builder.cc +++ b/components/ntp_snippets/remote/remote_suggestion_builder.cc @@ -218,13 +218,12 @@ FetchedCategory FetchedCategoryBuilder::Build() const { FetchedCategory result = FetchedCategory( category_.value_or(Category::FromRemoteCategory(1)), CategoryInfo( - title_.value_or(base::UTF8ToUTF16("Category title")), + title_.value_or(u"Category title"), card_layout_.value_or(ContentSuggestionsCardLayout::FULL_CARD), additional_action_.value_or( ContentSuggestionsAdditionalAction::FETCH), show_if_empty_.value_or(false), - no_suggestions_message_.value_or( - base::UTF8ToUTF16("No suggestions message")))); + no_suggestions_message_.value_or(u"No suggestions message"))); if (suggestion_builders_) { for (const auto& suggestion_builder : *suggestion_builders_) diff --git a/components/ntp_snippets/remote/remote_suggestion_unittest.cc b/components/ntp_snippets/remote/remote_suggestion_unittest.cc index f771301cc61d60..9656b60fe00526 100644 --- a/components/ntp_snippets/remote/remote_suggestion_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestion_unittest.cc @@ -241,12 +241,11 @@ TEST(RemoteSuggestionTest, ToContentSuggestionWithoutNotificationInfo) { Eq(Category::FromKnownCategory(KnownCategories::ARTICLES))); EXPECT_THAT(sugg.id().id_within_category(), Eq("foo")); EXPECT_THAT(sugg.url(), Eq(GURL("http://cdn.ampproject.org/c/foo/"))); - EXPECT_THAT(sugg.title(), Eq(base::UTF8ToUTF16("a suggestion title"))); + EXPECT_THAT(sugg.title(), Eq(u"a suggestion title")); EXPECT_THAT(sugg.snippet_text(), - Eq(base::UTF8ToUTF16("the snippet describing the suggestion."))); + Eq(u"the snippet describing the suggestion.")); EXPECT_THAT(sugg.publish_date().ToJavaTime(), Eq(1467284497000)); - EXPECT_THAT(sugg.publisher_name(), - Eq(base::UTF8ToUTF16("Great Suggestions Inc."))); + EXPECT_THAT(sugg.publisher_name(), Eq(u"Great Suggestions Inc.")); EXPECT_THAT(sugg.score(), Eq(1.5)); EXPECT_THAT(sugg.salient_image_url(), Eq(GURL("http://google.com/logo/"))); EXPECT_THAT(sugg.notification_extra(), IsNull()); @@ -265,12 +264,11 @@ TEST(RemoteSuggestionTest, ToContentSuggestionWithNotificationInfo) { Eq(Category::FromKnownCategory(KnownCategories::ARTICLES))); EXPECT_THAT(sugg.id().id_within_category(), Eq("foo")); EXPECT_THAT(sugg.url(), Eq(GURL("http://cdn.ampproject.org/c/foo/"))); - EXPECT_THAT(sugg.title(), Eq(base::UTF8ToUTF16("a suggestion title"))); + EXPECT_THAT(sugg.title(), Eq(u"a suggestion title")); EXPECT_THAT(sugg.snippet_text(), - Eq(base::UTF8ToUTF16("the snippet describing the suggestion."))); + Eq(u"the snippet describing the suggestion.")); EXPECT_THAT(sugg.publish_date().ToJavaTime(), Eq(1467284497000)); - EXPECT_THAT(sugg.publisher_name(), - Eq(base::UTF8ToUTF16("Great Suggestions Inc."))); + EXPECT_THAT(sugg.publisher_name(), Eq(u"Great Suggestions Inc.")); EXPECT_THAT(sugg.score(), Eq(1.5)); ASSERT_THAT(sugg.notification_extra(), NotNull()); EXPECT_THAT(sugg.notification_extra()->deadline.ToJavaTime(), diff --git a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc index 887545b23b6bfe..5014f9702f2b60 100644 --- a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc @@ -652,8 +652,7 @@ TEST_F(RemoteSuggestionsFetcherImplTest, ASSERT_THAT(fetched_categories->size(), Eq(1u)); EXPECT_THAT(fetched_categories->front().info.additional_action(), Eq(ContentSuggestionsAdditionalAction::NONE)); - EXPECT_THAT(fetched_categories->front().info.title(), - Eq(base::UTF8ToUTF16("Articles for Me"))); + EXPECT_THAT(fetched_categories->front().info.title(), Eq(u"Articles for Me")); } TEST_F(RemoteSuggestionsFetcherImplTest, ExclusiveCategoryOnly) { diff --git a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc index 08263a1b3bc18c..01b07213fd1a50 100644 --- a/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc +++ b/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc @@ -1291,7 +1291,7 @@ TEST_F(RemoteSuggestionsProviderImplTest, std::vector fetched_categories; fetched_categories.push_back(FetchedCategory( articles_category(), - BuildRemoteCategoryInfo(base::UTF8ToUTF16("title"), + BuildRemoteCategoryInfo(u"title", /*allow_fetching_more_results=*/true))); fetched_categories[0].suggestions.push_back( CreateTestRemoteSuggestion("http://fetched-more.com/")); @@ -1319,7 +1319,7 @@ TEST_F(RemoteSuggestionsProviderImplTest, fetched_categories.clear(); fetched_categories.push_back(FetchedCategory( articles_category(), - BuildRemoteCategoryInfo(base::UTF8ToUTF16("title"), + BuildRemoteCategoryInfo(u"title", /*allow_fetching_more_results=*/true))); fetched_categories[0].suggestions.push_back( CreateTestRemoteSuggestion("http://fetched-more.com/")); @@ -1500,7 +1500,7 @@ TEST_F(RemoteSuggestionsProviderImplTest, std::vector fetched_categories; fetched_categories.push_back(FetchedCategory( articles_category(), - BuildRemoteCategoryInfo(base::UTF8ToUTF16("title"), + BuildRemoteCategoryInfo(u"title", /*allow_fetching_more_results=*/true))); fetched_categories[0].suggestions.push_back( CreateTestRemoteSuggestion(base::StringPrintf("http://abc.com/"))); @@ -2541,7 +2541,7 @@ TEST_F(RemoteSuggestionsProviderImplTest, std::vector fetched_categories; fetched_categories.push_back(FetchedCategory( articles_category(), - BuildRemoteCategoryInfo(base::UTF8ToUTF16("title"), + BuildRemoteCategoryInfo(u"title", /*allow_fetching_more_results=*/true))); for (int i = 0; i < kMaxExcludedDismissedIds; ++i) { @@ -2551,7 +2551,7 @@ TEST_F(RemoteSuggestionsProviderImplTest, // Add other category suggestion. fetched_categories.push_back(FetchedCategory( Category::FromRemoteCategory(kOtherCategoryId), - BuildRemoteCategoryInfo(base::UTF8ToUTF16("title"), + BuildRemoteCategoryInfo(u"title", /*allow_fetching_more_results=*/true))); fetched_categories[1].suggestions.push_back( CreateTestRemoteSuggestion("http://other.com/")); diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc index c4c9b491f3af97..bed76a2488bea7 100644 --- a/components/ntp_tiles/most_visited_sites.cc +++ b/components/ntp_tiles/most_visited_sites.cc @@ -91,9 +91,8 @@ std::u16string GenerateShortTitle(const std::u16string& title) { // Empty title only happened in the unittests. if (title.empty()) return std::u16string(); - std::vector short_title_list = - SplitString(title, base::UTF8ToUTF16("-:|;"), base::TRIM_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); + std::vector short_title_list = SplitString( + title, u"-:|;", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); // Make sure it doesn't crash when the title only contains spaces. if (short_title_list.empty()) return std::u16string(); diff --git a/components/ntp_tiles/most_visited_sites_unittest.cc b/components/ntp_tiles/most_visited_sites_unittest.cc index a13d29ec5b2041..db1aa660af42f2 100644 --- a/components/ntp_tiles/most_visited_sites_unittest.cc +++ b/components/ntp_tiles/most_visited_sites_unittest.cc @@ -1498,8 +1498,7 @@ TEST_P(MostVisitedSitesWithCustomLinksTest, .WillRepeatedly(ReturnRef(expected_links)); EXPECT_CALL(mock_observer_, OnURLsAvailable(_)) .WillOnce(SaveArg<0>(§ions)); - most_visited_sites_->AddCustomLink(GURL("test.com"), - base::UTF8ToUTF16("test")); + most_visited_sites_->AddCustomLink(GURL("test.com"), u"test"); base::RunLoop().RunUntilIdle(); ASSERT_THAT( sections.at(SectionType::PERSONALIZED), @@ -1555,7 +1554,7 @@ TEST_P(MostVisitedSitesWithCustomLinksTest, EXPECT_CALL(mock_observer_, OnURLsAvailable(_)) .WillOnce(SaveArg<0>(§ions)); most_visited_sites_->UpdateCustomLink(GURL("test.com"), GURL("test.com"), - base::UTF8ToUTF16("test")); + u"test"); base::RunLoop().RunUntilIdle(); ASSERT_THAT( sections.at(SectionType::PERSONALIZED), @@ -1611,7 +1610,7 @@ TEST_P(MostVisitedSitesWithCustomLinksTest, .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_custom_links_, Uninitialize()); EXPECT_CALL(mock_observer_, OnURLsAvailable(_)).Times(0); - most_visited_sites_->AddCustomLink(GURL(kTestUrl), base::UTF8ToUTF16("test")); + most_visited_sites_->AddCustomLink(GURL(kTestUrl), u"test"); base::RunLoop().RunUntilIdle(); // Fail to edit a custom link. This should not initialize custom links nor @@ -1623,7 +1622,7 @@ TEST_P(MostVisitedSitesWithCustomLinksTest, EXPECT_CALL(*mock_custom_links_, Uninitialize()); EXPECT_CALL(mock_observer_, OnURLsAvailable(_)).Times(0); most_visited_sites_->UpdateCustomLink(GURL("test.com"), GURL("test2.com"), - base::UTF8ToUTF16("test")); + u"test"); base::RunLoop().RunUntilIdle(); // Fail to reorder a custom link. This should not initialize custom links nor diff --git a/components/offline_pages/core/model/add_page_task_unittest.cc b/components/offline_pages/core/model/add_page_task_unittest.cc index 5bfeca2d3aa9ae..5d23e38352033f 100644 --- a/components/offline_pages/core/model/add_page_task_unittest.cc +++ b/components/offline_pages/core/model/add_page_task_unittest.cc @@ -32,7 +32,7 @@ const ClientId kTestClientId1(kTestNamespace, "1234"); const base::FilePath kTestFilePath(FILE_PATH_LITERAL("/test/path/file")); const int64_t kTestFileSize = 876543LL; const std::string kTestOrigin("abc.xyz"); -const std::u16string kTestTitle = base::UTF8ToUTF16("a title"); +const std::u16string kTestTitle = u"a title"; const int64_t kTestDownloadId = 767574LL; const std::string kTestDigest("TesTIngDigEst=="); const std::string kTestAttribution = "attribution"; diff --git a/components/offline_pages/core/model/offline_page_model_taskified_unittest.cc b/components/offline_pages/core/model/offline_page_model_taskified_unittest.cc index 9d9ab0be43eb8c..3fa93f69b5c8c0 100644 --- a/components/offline_pages/core/model/offline_page_model_taskified_unittest.cc +++ b/components/offline_pages/core/model/offline_page_model_taskified_unittest.cc @@ -61,7 +61,7 @@ const ClientId kTestUserRequestedClientId(kDownloadNamespace, "714"); const ClientId kTestBrowserActionsClientId(kBrowserActionsNamespace, "999"); const ClientId kTestLastNClientId(kLastNNamespace, "8989"); const int64_t kTestFileSize = 876543LL; -const std::u16string kTestTitle = base::UTF8ToUTF16("a title"); +const std::u16string kTestTitle = u"a title"; const char kTestRequestOrigin[] = "abc.xyz"; const char kEmptyRequestOrigin[] = ""; const char kTestDigest[] = "test digest"; diff --git a/components/offline_pages/core/model/offline_page_model_utils_unittest.cc b/components/offline_pages/core/model/offline_page_model_utils_unittest.cc index 2ac5b840603357..8ac5d5a8e95b67 100644 --- a/components/offline_pages/core/model/offline_page_model_utils_unittest.cc +++ b/components/offline_pages/core/model/offline_page_model_utils_unittest.cc @@ -67,7 +67,7 @@ const std::vector& UniqueFilenameCases() { {base::ASCIIToUTF16("wikipedia.org"), GURL("http://www.wikipedia.org/Main_Page"), FILE_PATH_LITERAL("wikipedia.org (1).mhtml")}, - {base::UTF8ToUTF16("bücher.com"), GURL("http://xn--bcher-kva.com"), + {u"bücher.com", GURL("http://xn--bcher-kva.com"), FILE_PATH_LITERAL("bücher.com.mhtml")}, {base::ASCIIToUTF16("http://foo.com/path/title.html"), GURL("http://foo.com"), diff --git a/components/offline_pages/core/offline_page_metadata_store_unittest.cc b/components/offline_pages/core/offline_page_metadata_store_unittest.cc index cbcd0040b60e16..f06a5535981353 100644 --- a/components/offline_pages/core/offline_page_metadata_store_unittest.cc +++ b/components/offline_pages/core/offline_page_metadata_store_unittest.cc @@ -191,7 +191,7 @@ void BuildTestStoreWithSchemaFromM54(const base::FilePath& file) { statement.BindCString(8, kTestURL); statement.BindString(9, base::FilePath(kFilePath).MaybeAsASCII()); statement.BindInt64(10, store_utils::ToDatabaseTime(OfflineTimeNow())); - statement.BindString16(11, base::UTF8ToUTF16("Test title")); + statement.BindString16(11, u"Test title"); ASSERT_TRUE(statement.Run()); ASSERT_TRUE(connection.DoesTableExist(OFFLINE_PAGES_TABLE_V1)); ASSERT_TRUE(connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "version")); @@ -238,7 +238,7 @@ void BuildTestStoreWithSchemaFromM55(const base::FilePath& file) { statement.BindCString(7, kTestURL); statement.BindString(8, base::FilePath(kFilePath).MaybeAsASCII()); statement.BindInt64(9, store_utils::ToDatabaseTime(OfflineTimeNow())); - statement.BindString16(10, base::UTF8ToUTF16("Test title")); + statement.BindString16(10, u"Test title"); ASSERT_TRUE(statement.Run()); ASSERT_TRUE(connection.DoesTableExist(OFFLINE_PAGES_TABLE_V1)); ASSERT_TRUE(connection.DoesColumnExist(OFFLINE_PAGES_TABLE_V1, "title")); @@ -283,7 +283,7 @@ void BuildTestStoreWithSchemaFromM56(const base::FilePath& file) { statement.BindCString(7, kTestURL); statement.BindString(8, base::FilePath(kFilePath).MaybeAsASCII()); statement.BindInt64(9, store_utils::ToDatabaseTime(OfflineTimeNow())); - statement.BindString16(10, base::UTF8ToUTF16("Test title")); + statement.BindString16(10, u"Test title"); statement.BindCString(11, kOriginalTestURL); ASSERT_TRUE(statement.Run()); ASSERT_TRUE(connection.DoesTableExist(OFFLINE_PAGES_TABLE_V1)); @@ -326,7 +326,7 @@ void BuildTestStoreWithSchemaFromM57(const base::FilePath& file) { statement.BindString(6, kTestClientId2.id); statement.BindCString(7, kTestURL); statement.BindString(8, base::FilePath(kFilePath).MaybeAsASCII()); - statement.BindString16(9, base::UTF8ToUTF16("Test title")); + statement.BindString16(9, u"Test title"); statement.BindCString(10, kOriginalTestURL); ASSERT_TRUE(statement.Run()); ASSERT_TRUE(connection.DoesTableExist(OFFLINE_PAGES_TABLE_V1)); @@ -371,7 +371,7 @@ void BuildTestStoreWithSchemaFromM61(const base::FilePath& file) { statement.BindString(6, kTestClientId2.id); statement.BindCString(7, kTestURL); statement.BindString(8, base::FilePath(kFilePath).MaybeAsASCII()); - statement.BindString16(9, base::UTF8ToUTF16("Test title")); + statement.BindString16(9, u"Test title"); statement.BindCString(10, kOriginalTestURL); statement.BindString(11, kTestRequestOrigin); ASSERT_TRUE(statement.Run()); @@ -610,7 +610,7 @@ class OfflinePageMetadataStoreTest : public testing::Test { size_t store_size = GetOfflinePages(store.get()).size(); OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1, base::FilePath(kFilePath), kFileSize); - offline_page.title = base::UTF8ToUTF16("a title"); + offline_page.title = u"a title"; offline_page.original_url_if_different = GURL(kOriginalTestURL); offline_page.system_download_id = kTestSystemDownloadId; offline_page.digest = kTestDigest; @@ -931,7 +931,7 @@ TEST_F(OfflinePageMetadataStoreTest, AddSameOfflinePageTwice) { OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1, base::FilePath(kFilePath), kFileSize); - offline_page.title = base::UTF8ToUTF16("a title"); + offline_page.title = u"a title"; EXPECT_EQ(ItemActionStatus::SUCCESS, AddOfflinePage(store.get(), offline_page)); diff --git a/components/offline_pages/core/prefetch/prefetch_importer_impl_unittest.cc b/components/offline_pages/core/prefetch/prefetch_importer_impl_unittest.cc index a17be779f9ec80..5fee09f38ae7f2 100644 --- a/components/offline_pages/core/prefetch/prefetch_importer_impl_unittest.cc +++ b/components/offline_pages/core/prefetch/prefetch_importer_impl_unittest.cc @@ -22,7 +22,7 @@ const int64_t kTestOfflineID = 111; const int64_t kTestOfflineIDFailedToAdd = 223344; const ClientId kTestClientID("Foo", "C56A4180-65AA-42EC-A945-5FD21DEC0538"); -const std::u16string kTestTitle = base::UTF8ToUTF16("Hello"); +const std::u16string kTestTitle = u"Hello"; const base::FilePath kTestFilePath(FILE_PATH_LITERAL("foo")); const int64_t kTestFileSize = 88888; diff --git a/components/offline_pages/core/prefetch/prefetch_item_unittest.cc b/components/offline_pages/core/prefetch/prefetch_item_unittest.cc index 23c926ec823b48..380f53d448626b 100644 --- a/components/offline_pages/core/prefetch/prefetch_item_unittest.cc +++ b/components/offline_pages/core/prefetch/prefetch_item_unittest.cc @@ -130,7 +130,7 @@ TEST_F(PrefetchItemTest, OperatorEqualsCopyConstructorAndToString) { item1.error_code = PrefetchItemErrorCode::TOO_MANY_NEW_URLS; CheckFieldAndResetItem(item1, "error_code"); - item1.title = base::UTF8ToUTF16("F"); + item1.title = u"F"; CheckFieldAndResetItem(item1, "title"); item1.file_path = base::FilePath(FILE_PATH_LITERAL("G")); diff --git a/components/offline_pages/core/prefetch/tasks/add_unique_urls_task_unittest.cc b/components/offline_pages/core/prefetch/tasks/add_unique_urls_task_unittest.cc index 9286190ce28f60..4b212e187dc5fc 100644 --- a/components/offline_pages/core/prefetch/tasks/add_unique_urls_task_unittest.cc +++ b/components/offline_pages/core/prefetch/tasks/add_unique_urls_task_unittest.cc @@ -33,7 +33,7 @@ const char kTestThumbnailURL[] = "http://thumbnail.com/"; PrefetchURL PrefetchURL1() { return {kClientId1, GURL("https://www.url1.com/"), - base::UTF8ToUTF16("Title 1"), + u"Title 1", GURL("https://www.url1.com/thumbnail.png"), GURL("https://www.url1.com/favicon.png"), "snippet 1", @@ -42,7 +42,7 @@ PrefetchURL PrefetchURL1() { PrefetchURL PrefetchURL2() { return {kClientId2, GURL("https://www.url2.com/"), - base::UTF8ToUTF16("Title 2"), + u"Title 2", GURL("https://www.url2.com/thumbnail.png"), GURL("https://www.url2.com/favicon.png"), "snippet 2", @@ -51,7 +51,7 @@ PrefetchURL PrefetchURL2() { PrefetchURL PrefetchURL3() { return {kClientId3, GURL("https://www.url3.com/"), - base::UTF8ToUTF16("Title 3"), + u"Title 3", GURL("https://www.url3.com/thumbnail.png"), GURL("https://www.url3.com/favicon.png"), "snippet 3", diff --git a/components/offline_pages/core/prefetch/tasks/import_archives_task_unittest.cc b/components/offline_pages/core/prefetch/tasks/import_archives_task_unittest.cc index 9d96b33c989c8c..8257e0459887e8 100644 --- a/components/offline_pages/core/prefetch/tasks/import_archives_task_unittest.cc +++ b/components/offline_pages/core/prefetch/tasks/import_archives_task_unittest.cc @@ -54,10 +54,10 @@ ClientId TestClientID2() { return ClientId("Foo2", TestGUID2()); } std::u16string TestTitle() { - return base::UTF8ToUTF16("Hello"); + return u"Hello"; } std::u16string TestTitle2() { - return base::UTF8ToUTF16("Hello2"); + return u"Hello2"; } base::FilePath TestFilePath() { return base::FilePath(FILE_PATH_LITERAL("foo")); diff --git a/components/omnibox/browser/autocomplete_match_type_unittest.cc b/components/omnibox/browser/autocomplete_match_type_unittest.cc index e0ef0e16cbdee1..cef395a63a6e92 100644 --- a/components/omnibox/browser/autocomplete_match_type_unittest.cc +++ b/components/omnibox/browser/autocomplete_match_type_unittest.cc @@ -12,37 +12,35 @@ #include "testing/gtest/include/gtest/gtest.h" TEST(AutocompleteMatchTypeTest, AccessibilityLabelHistory) { - const std::u16string& kTestUrl = - base::UTF8ToUTF16("https://www.chromium.org"); - const std::u16string& kTestTitle = base::UTF8ToUTF16("The Chromium Projects"); + const std::u16string& kTestUrl = u"https://www.chromium.org"; + const std::u16string& kTestTitle = u"The Chromium Projects"; // Test plain url. AutocompleteMatch match; match.type = AutocompleteMatchType::URL_WHAT_YOU_TYPED; match.description = kTestTitle; - EXPECT_EQ(kTestUrl + base::UTF8ToUTF16(", 2 of 9"), + EXPECT_EQ(kTestUrl + u", 2 of 9", AutocompleteMatchType::ToAccessibilityLabel(match, kTestUrl, 1, 9)); // Decorated with title and match type. match.type = AutocompleteMatchType::HISTORY_URL; - EXPECT_EQ(kTestTitle + base::UTF8ToUTF16(" ") + kTestUrl + - base::UTF8ToUTF16(" location from history, 2 of 3"), + EXPECT_EQ(kTestTitle + u" " + kTestUrl + u" location from history, 2 of 3", AutocompleteMatchType::ToAccessibilityLabel(match, kTestUrl, 1, 3)); } TEST(AutocompleteMatchTypeTest, AccessibilityLabelSearch) { - const std::u16string& kSearch = base::UTF8ToUTF16("gondola"); - const std::u16string& kSearchDesc = base::UTF8ToUTF16("Google Search"); + const std::u16string& kSearch = u"gondola"; + const std::u16string& kSearchDesc = u"Google Search"; AutocompleteMatch match; match.type = AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED; match.description = kSearchDesc; - EXPECT_EQ(kSearch + base::UTF8ToUTF16(" search, 6 of 8"), + EXPECT_EQ(kSearch + u" search, 6 of 8", AutocompleteMatchType::ToAccessibilityLabel(match, kSearch, 5, 8)); // Make sure there's no suffix if |total_matches| is 0, regardless of the // |match_index| value. - EXPECT_EQ(kSearch + base::UTF8ToUTF16(" search"), + EXPECT_EQ(kSearch + u" search", AutocompleteMatchType::ToAccessibilityLabel(match, kSearch, 5, 0)); } @@ -55,14 +53,14 @@ bool ParseAnswer(const std::string& answer_json, SuggestionAnswer* answer) { // ParseAnswer previously did not change the default answer type of -1, so // here we keep the same behavior by explicitly supplying default value. - return SuggestionAnswer::ParseAnswer(*value, base::UTF8ToUTF16("-1"), answer); + return SuggestionAnswer::ParseAnswer(*value, u"-1", answer); } } // namespace TEST(AutocompleteMatchTypeTest, AccessibilityLabelAnswer) { - const std::u16string& kSearch = base::UTF8ToUTF16("weather"); - const std::u16string& kSearchDesc = base::UTF8ToUTF16("Google Search"); + const std::u16string& kSearch = u"weather"; + const std::u16string& kSearchDesc = u"Google Search"; AutocompleteMatch match; match.type = AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED; diff --git a/components/omnibox/browser/autocomplete_match_unittest.cc b/components/omnibox/browser/autocomplete_match_unittest.cc index 719928251e3729..281ac795437fa2 100644 --- a/components/omnibox/browser/autocomplete_match_unittest.cc +++ b/components/omnibox/browser/autocomplete_match_unittest.cc @@ -175,7 +175,7 @@ TEST(AutocompleteMatchTest, InlineTailPrefix) { match.type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL; match.contents = base::UTF8ToUTF16(test_case.before_contents); match.contents_class = test_case.before_contents_class; - match.InlineTailPrefix(base::UTF8ToUTF16("12345678")); + match.InlineTailPrefix(u"12345678"); EXPECT_EQ(match.contents, base::UTF8ToUTF16(test_case.after_contents)); EXPECT_TRUE(EqualClassifications(match.contents_class, test_case.after_contents_class)); diff --git a/components/omnibox/browser/autocomplete_result_unittest.cc b/components/omnibox/browser/autocomplete_result_unittest.cc index 313591225f9355..f6d36df4455268 100644 --- a/components/omnibox/browser/autocomplete_result_unittest.cc +++ b/components/omnibox/browser/autocomplete_result_unittest.cc @@ -1935,7 +1935,7 @@ TEST_F(AutocompleteResultTest, ConvertsOpenTabsCorrectly) { match.destination_url = GURL("http://this-site-matches.com"); result.matches_.push_back(match); match.destination_url = GURL("http://other-site-matches.com"); - match.description = base::UTF8ToUTF16("Some Other Site"); + match.description = u"Some Other Site"; result.matches_.push_back(match); match.destination_url = GURL("http://doesnt-match.com"); match.description = std::u16string(); diff --git a/components/omnibox/browser/document_provider.cc b/components/omnibox/browser/document_provider.cc index 450202dd8a4e00..47d1c00e332457 100644 --- a/components/omnibox/browser/document_provider.cc +++ b/components/omnibox/browser/document_provider.cc @@ -105,10 +105,9 @@ String16Vector SplitByColon(const String16Vector& words) { return std::accumulate( words.begin(), words.end(), String16Vector(), [](String16Vector accumulated, const auto& word) { - const auto split = - base::SplitString(word, base::UTF8ToUTF16(":"), - base::WhitespaceHandling::TRIM_WHITESPACE, - base::SplitResult::SPLIT_WANT_NONEMPTY); + const auto split = base::SplitString( + word, u":", base::WhitespaceHandling::TRIM_WHITESPACE, + base::SplitResult::SPLIT_WANT_NONEMPTY); accumulated.insert(accumulated.end(), split.begin(), split.end()); return accumulated; }); diff --git a/components/omnibox/browser/document_provider_unittest.cc b/components/omnibox/browser/document_provider_unittest.cc index e00e096d8276d5..417ff257c323a7 100644 --- a/components/omnibox/browser/document_provider_unittest.cc +++ b/components/omnibox/browser/document_provider_unittest.cc @@ -347,8 +347,7 @@ TEST_F(DocumentProviderTest, ParseDocumentSearchResults) { // Docs scores are the min of the server and client scores. To avoid client // scores coming into play in this test, set the input to match the title // similarly enough that the client score will surpass the server score. - provider_->input_.UpdateText(base::UTF8ToUTF16("document longer title"), 0, - {}); + provider_->input_.UpdateText(u"document longer title", 0, {}); ACMatches matches = provider_->ParseDocumentSearchResults(*response); EXPECT_EQ(matches.size(), 3u); @@ -418,7 +417,7 @@ TEST_F(DocumentProviderTest, ProductDescriptionStringsAndAccessibleLabels) { ASSERT_TRUE(response); ASSERT_TRUE(response->is_dict()); - provider_->input_.UpdateText(base::UTF8ToUTF16("input"), 0, {}); + provider_->input_.UpdateText(u"input", 0, {}); ACMatches matches = provider_->ParseDocumentSearchResults(*response); EXPECT_EQ(matches.size(), 3u); @@ -513,7 +512,7 @@ TEST_F(DocumentProviderTest, MatchDescriptionString) { base::JSONReader::Read(kGoodJSONResponseWithMimeTypes); ASSERT_TRUE(response); ASSERT_TRUE(response->is_dict()); - provider_->input_.UpdateText(base::UTF8ToUTF16("input"), 0, {}); + provider_->input_.UpdateText(u"input", 0, {}); // Verify correct formatting when the DisplayOwner feature param is false. { @@ -614,7 +613,7 @@ TEST_F(DocumentProviderTest, ParseDocumentSearchResultsBreakTies) { ASSERT_TRUE(response); ASSERT_TRUE(response->is_dict()); - provider_->input_.UpdateText(base::UTF8ToUTF16("input"), 0, {}); + provider_->input_.UpdateText(u"input", 0, {}); ACMatches matches = provider_->ParseDocumentSearchResults(*response); EXPECT_EQ(matches.size(), 3u); @@ -675,7 +674,7 @@ TEST_F(DocumentProviderTest, ParseDocumentSearchResultsBreakTiesCascade) { ASSERT_TRUE(response); ASSERT_TRUE(response->is_dict()); - provider_->input_.UpdateText(base::UTF8ToUTF16("input"), 0, {}); + provider_->input_.UpdateText(u"input", 0, {}); ACMatches matches = provider_->ParseDocumentSearchResults(*response); EXPECT_EQ(matches.size(), 3u); @@ -738,7 +737,7 @@ TEST_F(DocumentProviderTest, ParseDocumentSearchResultsBreakTiesZeroLimit) { ASSERT_TRUE(response); ASSERT_TRUE(response->is_dict()); - provider_->input_.UpdateText(base::UTF8ToUTF16("input"), 0, {}); + provider_->input_.UpdateText(u"input", 0, {}); ACMatches matches = provider_->ParseDocumentSearchResults(*response); EXPECT_EQ(matches.size(), 3u); @@ -1055,41 +1054,41 @@ TEST_F(DocumentProviderTest, CachingForAsyncMatches) { auto matches = GetTestProviderMatches("input", MakeTestResponse({"0", "1", "2"}, 1150)); EXPECT_EQ(matches.size(), size_t(3)); - EXPECT_EQ(matches[0].contents, base::UTF8ToUTF16("Document 0 longer title")); - EXPECT_EQ(matches[1].contents, base::UTF8ToUTF16("Document 1 longer title")); - EXPECT_EQ(matches[2].contents, base::UTF8ToUTF16("Document 2 longer title")); + EXPECT_EQ(matches[0].contents, u"Document 0 longer title"); + EXPECT_EQ(matches[1].contents, u"Document 1 longer title"); + EXPECT_EQ(matches[2].contents, u"Document 2 longer title"); // Cache should remove duplicates. matches = GetTestProviderMatches("input", MakeTestResponse({"1", "2", "3"}, 1150)); EXPECT_EQ(matches.size(), size_t(4)); - EXPECT_EQ(matches[0].contents, base::UTF8ToUTF16("Document 1 longer title")); - EXPECT_EQ(matches[1].contents, base::UTF8ToUTF16("Document 2 longer title")); - EXPECT_EQ(matches[2].contents, base::UTF8ToUTF16("Document 3 longer title")); - EXPECT_EQ(matches[3].contents, base::UTF8ToUTF16("Document 0 longer title")); + EXPECT_EQ(matches[0].contents, u"Document 1 longer title"); + EXPECT_EQ(matches[1].contents, u"Document 2 longer title"); + EXPECT_EQ(matches[2].contents, u"Document 3 longer title"); + EXPECT_EQ(matches[3].contents, u"Document 0 longer title"); // Cache size (4) should not restrict number of matches from the current // response. matches = GetTestProviderMatches("input", MakeTestResponse({"3", "4", "5"}, 1150)); EXPECT_EQ(matches.size(), size_t(6)); - EXPECT_EQ(matches[0].contents, base::UTF8ToUTF16("Document 3 longer title")); - EXPECT_EQ(matches[1].contents, base::UTF8ToUTF16("Document 4 longer title")); - EXPECT_EQ(matches[2].contents, base::UTF8ToUTF16("Document 5 longer title")); - EXPECT_EQ(matches[3].contents, base::UTF8ToUTF16("Document 1 longer title")); - EXPECT_EQ(matches[4].contents, base::UTF8ToUTF16("Document 2 longer title")); - EXPECT_EQ(matches[5].contents, base::UTF8ToUTF16("Document 0 longer title")); + EXPECT_EQ(matches[0].contents, u"Document 3 longer title"); + EXPECT_EQ(matches[1].contents, u"Document 4 longer title"); + EXPECT_EQ(matches[2].contents, u"Document 5 longer title"); + EXPECT_EQ(matches[3].contents, u"Document 1 longer title"); + EXPECT_EQ(matches[4].contents, u"Document 2 longer title"); + EXPECT_EQ(matches[5].contents, u"Document 0 longer title"); // Cache size (4) should restrict number of cached matches appended. matches = GetTestProviderMatches("input", MakeTestResponse({"0", "4", "6"}, 1150)); EXPECT_EQ(matches.size(), size_t(6)); - EXPECT_EQ(matches[0].contents, base::UTF8ToUTF16("Document 0 longer title")); - EXPECT_EQ(matches[1].contents, base::UTF8ToUTF16("Document 4 longer title")); - EXPECT_EQ(matches[2].contents, base::UTF8ToUTF16("Document 6 longer title")); - EXPECT_EQ(matches[3].contents, base::UTF8ToUTF16("Document 3 longer title")); - EXPECT_EQ(matches[4].contents, base::UTF8ToUTF16("Document 5 longer title")); - EXPECT_EQ(matches[5].contents, base::UTF8ToUTF16("Document 1 longer title")); + EXPECT_EQ(matches[0].contents, u"Document 0 longer title"); + EXPECT_EQ(matches[1].contents, u"Document 4 longer title"); + EXPECT_EQ(matches[2].contents, u"Document 6 longer title"); + EXPECT_EQ(matches[3].contents, u"Document 3 longer title"); + EXPECT_EQ(matches[4].contents, u"Document 5 longer title"); + EXPECT_EQ(matches[5].contents, u"Document 1 longer title"); // Cached results should update match |additional_info|, |relevance|, and // |contents_class|. @@ -1099,7 +1098,7 @@ TEST_F(DocumentProviderTest, CachingForAsyncMatches) { matches = GetTestProviderMatches("docum longer title", MakeTestResponse({"5", "4", "7"}, 1140)); EXPECT_EQ(matches.size(), size_t(6)); - EXPECT_EQ(matches[0].contents, base::UTF8ToUTF16("Document 5 longer title")); + EXPECT_EQ(matches[0].contents, u"Document 5 longer title"); EXPECT_EQ(matches[0].GetAdditionalInfo("from cache"), ""); EXPECT_EQ(matches[0].relevance, 1140); EXPECT_THAT(matches[0].contents_class, @@ -1107,7 +1106,7 @@ TEST_F(DocumentProviderTest, CachingForAsyncMatches) { ACMatchClassification{0, 2}, ACMatchClassification{5, 0}, ACMatchClassification{11, 2}, ACMatchClassification{17, 0}, ACMatchClassification{18, 2})); - EXPECT_EQ(matches[1].contents, base::UTF8ToUTF16("Document 4 longer title")); + EXPECT_EQ(matches[1].contents, u"Document 4 longer title"); EXPECT_EQ(matches[1].GetAdditionalInfo("from cache"), ""); EXPECT_EQ(matches[1].relevance, 1140); EXPECT_THAT(matches[1].contents_class, @@ -1115,7 +1114,7 @@ TEST_F(DocumentProviderTest, CachingForAsyncMatches) { ACMatchClassification{0, 2}, ACMatchClassification{5, 0}, ACMatchClassification{11, 2}, ACMatchClassification{17, 0}, ACMatchClassification{18, 2})); - EXPECT_EQ(matches[2].contents, base::UTF8ToUTF16("Document 7 longer title")); + EXPECT_EQ(matches[2].contents, u"Document 7 longer title"); EXPECT_EQ(matches[2].GetAdditionalInfo("from cache"), ""); EXPECT_EQ(matches[2].relevance, 1140); EXPECT_THAT(matches[2].contents_class, @@ -1123,7 +1122,7 @@ TEST_F(DocumentProviderTest, CachingForAsyncMatches) { ACMatchClassification{0, 2}, ACMatchClassification{5, 0}, ACMatchClassification{11, 2}, ACMatchClassification{17, 0}, ACMatchClassification{18, 2})); - EXPECT_EQ(matches[3].contents, base::UTF8ToUTF16("Document 0 longer title")); + EXPECT_EQ(matches[3].contents, u"Document 0 longer title"); EXPECT_EQ(matches[3].GetAdditionalInfo("from cache"), "true"); EXPECT_EQ(matches[3].relevance, 0); EXPECT_THAT(matches[3].contents_class, @@ -1131,7 +1130,7 @@ TEST_F(DocumentProviderTest, CachingForAsyncMatches) { ACMatchClassification{0, 2}, ACMatchClassification{5, 0}, ACMatchClassification{11, 2}, ACMatchClassification{17, 0}, ACMatchClassification{18, 2})); - EXPECT_EQ(matches[4].contents, base::UTF8ToUTF16("Document 6 longer title")); + EXPECT_EQ(matches[4].contents, u"Document 6 longer title"); EXPECT_EQ(matches[4].GetAdditionalInfo("from cache"), "true"); EXPECT_EQ(matches[4].relevance, 0); EXPECT_THAT(matches[4].contents_class, @@ -1139,7 +1138,7 @@ TEST_F(DocumentProviderTest, CachingForAsyncMatches) { ACMatchClassification{0, 2}, ACMatchClassification{5, 0}, ACMatchClassification{11, 2}, ACMatchClassification{17, 0}, ACMatchClassification{18, 2})); - EXPECT_EQ(matches[5].contents, base::UTF8ToUTF16("Document 3 longer title")); + EXPECT_EQ(matches[5].contents, u"Document 3 longer title"); EXPECT_EQ(matches[5].GetAdditionalInfo("from cache"), "true"); EXPECT_EQ(matches[5].relevance, 0); EXPECT_THAT(matches[5].contents_class, @@ -1181,19 +1180,15 @@ TEST_F(DocumentProviderTest, CachingForSyncMatches) { provider_->Start(input, false); EXPECT_EQ(provider_->matches_.size(), size_t(4)); // Sync matches from the latest response should have scores. - EXPECT_EQ(provider_->matches_[0].contents, - base::UTF8ToUTF16("Document 4 longer title")); + EXPECT_EQ(provider_->matches_[0].contents, u"Document 4 longer title"); EXPECT_EQ(provider_->matches_[0].relevance, 600); - EXPECT_EQ(provider_->matches_[1].contents, - base::UTF8ToUTF16("Document 5 longer title")); + EXPECT_EQ(provider_->matches_[1].contents, u"Document 5 longer title"); EXPECT_EQ(provider_->matches_[1].relevance, 600); // Sync matches from previous responses should not have scores. - EXPECT_EQ(provider_->matches_[2].contents, - base::UTF8ToUTF16("Document 0 longer title")); + EXPECT_EQ(provider_->matches_[2].contents, u"Document 0 longer title"); EXPECT_EQ(provider_->matches_[2].relevance, 0); // Sync matches beyond |provider_max_matches_| should have scores set to 0. - EXPECT_EQ(provider_->matches_[3].contents, - base::UTF8ToUTF16("Document 1 longer title")); + EXPECT_EQ(provider_->matches_[3].contents, u"Document 1 longer title"); EXPECT_EQ(provider_->matches_[3].relevance, 0); } diff --git a/components/omnibox/browser/history_quick_provider_unittest.cc b/components/omnibox/browser/history_quick_provider_unittest.cc index 08f7897fad327e..ba82327aa7c8e3 100644 --- a/components/omnibox/browser/history_quick_provider_unittest.cc +++ b/components/omnibox/browser/history_quick_provider_unittest.cc @@ -569,7 +569,7 @@ TEST_F(HistoryQuickProviderTest, ContentsClass) { "http://ja.wikipedia.org/wiki/%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%B8%96%E7" "%95%8C%E5%A4%A7%E6%88%A6#.E3.83.B4.E3.82.A7.E3.83.AB.E3.82.B5.E3.82." "A4.E3.83.A6.E4.BD.93.E5.88.B6"); - RunTest(base::UTF8ToUTF16("第二 e3"), false, expected_urls, false, + RunTest(u"第二 e3", false, expected_urls, false, base::UTF8ToUTF16("ja.wikipedia.org/wiki/第二次世界大戦#.E3.83.B4.E3." "82.A7.E3.83.AB.E3.82.B5.E3.82.A4.E3.83.A6.E4.BD." "93.E5.88.B6"), diff --git a/components/omnibox/browser/history_url_provider_unittest.cc b/components/omnibox/browser/history_url_provider_unittest.cc index b3cc685decab1a..a29948f0c71954 100644 --- a/components/omnibox/browser/history_url_provider_unittest.cc +++ b/components/omnibox/browser/history_url_provider_unittest.cc @@ -1060,9 +1060,8 @@ TEST_F(HistoryURLProviderTest, CullSearchResults) { }; for (size_t i = 0; i < base::size(test_cases); ++i) { client_->GetHistoryService()->AddPageWithDetails( - GURL(test_cases[i].url), base::UTF8ToUTF16("Title"), - test_cases[i].count, test_cases[i].count, Time::Now(), false, - history::SOURCE_BROWSED); + GURL(test_cases[i].url), u"Title", test_cases[i].count, + test_cases[i].count, Time::Now(), false, history::SOURCE_BROWSED); } // We should not see search URLs when typing a previously used query. diff --git a/components/omnibox/browser/in_memory_url_index_types_unittest.cc b/components/omnibox/browser/in_memory_url_index_types_unittest.cc index bcd890111de79e..58fd088b2d44f0 100644 --- a/components/omnibox/browser/in_memory_url_index_types_unittest.cc +++ b/components/omnibox/browser/in_memory_url_index_types_unittest.cc @@ -34,20 +34,19 @@ class InMemoryURLIndexTypesTest : public testing::Test { TEST_F(InMemoryURLIndexTypesTest, StaticFunctions) { // Test String16VectorFromString16 - std::u16string string_a( - base::UTF8ToUTF16("http://www.google.com/ frammy the brammy")); + std::u16string string_a(u"http://www.google.com/ frammy the brammy"); WordStarts actual_starts_a; String16Vector string_vec = String16VectorFromString16(string_a, false, &actual_starts_a); ASSERT_EQ(7U, string_vec.size()); // See if we got the words we expected. - EXPECT_EQ(UTF8ToUTF16("http"), string_vec[0]); - EXPECT_EQ(UTF8ToUTF16("www"), string_vec[1]); - EXPECT_EQ(UTF8ToUTF16("google"), string_vec[2]); - EXPECT_EQ(UTF8ToUTF16("com"), string_vec[3]); - EXPECT_EQ(UTF8ToUTF16("frammy"), string_vec[4]); - EXPECT_EQ(UTF8ToUTF16("the"), string_vec[5]); - EXPECT_EQ(UTF8ToUTF16("brammy"), string_vec[6]); + EXPECT_EQ(u"http", string_vec[0]); + EXPECT_EQ(u"www", string_vec[1]); + EXPECT_EQ(u"google", string_vec[2]); + EXPECT_EQ(u"com", string_vec[3]); + EXPECT_EQ(u"frammy", string_vec[4]); + EXPECT_EQ(u"the", string_vec[5]); + EXPECT_EQ(u"brammy", string_vec[6]); // Verify the word starts. size_t expected_starts_a[] = {0, 7, 11, 18, 23, 31, 35}; EXPECT_TRUE(IntArraysEqual(expected_starts_a, base::size(expected_starts_a), @@ -56,11 +55,11 @@ TEST_F(InMemoryURLIndexTypesTest, StaticFunctions) { WordStarts actual_starts_b; string_vec = String16VectorFromString16(string_a, true, &actual_starts_b); ASSERT_EQ(5U, string_vec.size()); - EXPECT_EQ(UTF8ToUTF16("http://"), string_vec[0]); - EXPECT_EQ(UTF8ToUTF16("www.google.com/"), string_vec[1]); - EXPECT_EQ(UTF8ToUTF16("frammy"), string_vec[2]); - EXPECT_EQ(UTF8ToUTF16("the"), string_vec[3]); - EXPECT_EQ(UTF8ToUTF16("brammy"), string_vec[4]); + EXPECT_EQ(u"http://", string_vec[0]); + EXPECT_EQ(u"www.google.com/", string_vec[1]); + EXPECT_EQ(u"frammy", string_vec[2]); + EXPECT_EQ(u"the", string_vec[3]); + EXPECT_EQ(u"brammy", string_vec[4]); size_t expected_starts_b[] = {0, 7, 23, 31, 35}; EXPECT_TRUE(IntArraysEqual(expected_starts_b, base::size(expected_starts_b), actual_starts_b)); @@ -75,18 +74,17 @@ TEST_F(InMemoryURLIndexTypesTest, StaticFunctions) { EXPECT_TRUE(IntArraysEqual(expected_starts_c, base::size(expected_starts_c), actual_starts_c)); - std::u16string string_d( - base::UTF8ToUTF16("http://www.google.com/frammy_the_brammy")); + std::u16string string_d(u"http://www.google.com/frammy_the_brammy"); WordStarts actual_starts_d; string_vec = String16VectorFromString16(string_d, false, &actual_starts_d); ASSERT_EQ(7U, string_vec.size()); - EXPECT_EQ(UTF8ToUTF16("http"), string_vec[0]); - EXPECT_EQ(UTF8ToUTF16("www"), string_vec[1]); - EXPECT_EQ(UTF8ToUTF16("google"), string_vec[2]); - EXPECT_EQ(UTF8ToUTF16("com"), string_vec[3]); - EXPECT_EQ(UTF8ToUTF16("frammy"), string_vec[4]); - EXPECT_EQ(UTF8ToUTF16("the"), string_vec[5]); - EXPECT_EQ(UTF8ToUTF16("brammy"), string_vec[6]); + EXPECT_EQ(u"http", string_vec[0]); + EXPECT_EQ(u"www", string_vec[1]); + EXPECT_EQ(u"google", string_vec[2]); + EXPECT_EQ(u"com", string_vec[3]); + EXPECT_EQ(u"frammy", string_vec[4]); + EXPECT_EQ(u"the", string_vec[5]); + EXPECT_EQ(u"brammy", string_vec[6]); size_t expected_starts_d[] = {0, 7, 11, 18, 22, 29, 33}; EXPECT_TRUE(IntArraysEqual(expected_starts_d, base::size(expected_starts_d), actual_starts_d)); @@ -98,11 +96,11 @@ TEST_F(InMemoryURLIndexTypesTest, StaticFunctions) { String16Set string_set = String16SetFromString16(string_e, &actual_starts_e); EXPECT_EQ(5U, string_set.size()); // See if we got the words we expected. - EXPECT_TRUE(string_set.find(UTF8ToUTF16("com")) != string_set.end()); - EXPECT_TRUE(string_set.find(UTF8ToUTF16("google")) != string_set.end()); - EXPECT_TRUE(string_set.find(UTF8ToUTF16("http")) != string_set.end()); - EXPECT_TRUE(string_set.find(UTF8ToUTF16("search")) != string_set.end()); - EXPECT_TRUE(string_set.find(UTF8ToUTF16("web")) != string_set.end()); + EXPECT_TRUE(string_set.find(u"com") != string_set.end()); + EXPECT_TRUE(string_set.find(u"google") != string_set.end()); + EXPECT_TRUE(string_set.find(u"http") != string_set.end()); + EXPECT_TRUE(string_set.find(u"search") != string_set.end()); + EXPECT_TRUE(string_set.find(u"web") != string_set.end()); size_t expected_starts_e[] = {0, 7, 11, 18, 22, 29, 36, 40}; EXPECT_TRUE(IntArraysEqual(expected_starts_e, base::size(expected_starts_e), actual_starts_e)); @@ -133,8 +131,8 @@ TEST_F(InMemoryURLIndexTypesTest, StaticFunctions) { EXPECT_EQ(6, matches_f[3].term_num); // Test MatchTermInString - TermMatches matches_g = MatchTermInString( - UTF8ToUTF16("x"), UTF8ToUTF16("axbxcxdxex fxgx/hxixjx.kx"), 123); + TermMatches matches_g = + MatchTermInString(u"x", u"axbxcxdxex fxgx/hxixjx.kx", 123); const size_t expected_offsets[] = { 1, 3, 5, 7, 9, 12, 14, 17, 19, 21, 24 }; ASSERT_EQ(base::size(expected_offsets), matches_g.size()); for (size_t i = 0; i < base::size(expected_offsets); ++i) diff --git a/components/omnibox/browser/inline_autocompletion_util_unittest.cc b/components/omnibox/browser/inline_autocompletion_util_unittest.cc index e535c4ef4b42f3..c6ec9aae46e3f9 100644 --- a/components/omnibox/browser/inline_autocompletion_util_unittest.cc +++ b/components/omnibox/browser/inline_autocompletion_util_unittest.cc @@ -14,64 +14,46 @@ namespace { TEST(InlineAutocompletionUtilTest, FindAtWordbreak) { // Should find the first wordbreak occurrence. - EXPECT_EQ(FindAtWordbreak(base::UTF8ToUTF16("prefixmatch wordbreak_match"), - base::UTF8ToUTF16("match")), - 22u); + EXPECT_EQ(FindAtWordbreak(u"prefixmatch wordbreak_match", u"match"), 22u); // Should return npos when no occurrences exist. - EXPECT_EQ(FindAtWordbreak(base::UTF8ToUTF16("prefixmatch"), - base::UTF8ToUTF16("match")), - std::string::npos); + EXPECT_EQ(FindAtWordbreak(u"prefixmatch", u"match"), std::string::npos); // Should skip occurrences before |search_start|. - EXPECT_EQ(FindAtWordbreak(base::UTF8ToUTF16("match match"), - base::UTF8ToUTF16("match"), 1), - 6u); + EXPECT_EQ(FindAtWordbreak(u"match match", u"match", 1), 6u); } TEST(InlineAutocompletionUtilTest, FindWordsSequentiallyAtWordbreak) { using pair = std::pair; // Occurrences must be sequential. - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a b c"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a b c", u"a c"), testing::ElementsAre(pair{0, 1}, pair{1, 2}, pair{4, 5})); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("c b a"), - base::UTF8ToUTF16("a b")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"c b a", u"a b"), testing::ElementsAre()); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("b a b"), - base::UTF8ToUTF16("a b")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"b a b", u"a b"), testing::ElementsAre(pair{2, 3}, pair{3, 4}, pair{4, 5})); // Occurrences must be at word breaks. - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a b-c"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a b-c", u"a c"), testing::ElementsAre(pair{0, 1}, pair{1, 2}, pair{4, 5})); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a bc"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a bc", u"a c"), testing::ElementsAre()); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a bc c"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a bc c", u"a c"), testing::ElementsAre(pair{0, 1}, pair{1, 2}, pair{5, 6})); // Whitespaces must also match - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a-c"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a-c", u"a c"), testing::ElementsAre()); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a c"), - base::UTF8ToUTF16("a c ")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a c", u"a c "), testing::ElementsAre()); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a -c"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a -c", u"a c"), testing::ElementsAre(pair{0, 1}, pair{1, 2}, pair{3, 4})); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a- c"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a- c", u"a c"), testing::ElementsAre(pair{0, 1}, pair{2, 3}, pair{3, 4})); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a c c"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a c c", u"a c"), testing::ElementsAre()); - EXPECT_THAT(FindWordsSequentiallyAtWordbreak(base::UTF8ToUTF16("a c c"), - base::UTF8ToUTF16("a c")), + EXPECT_THAT(FindWordsSequentiallyAtWordbreak(u"a c c", u"a c"), testing::ElementsAre(pair{0, 1}, pair{3, 5}, pair{5, 6})); } diff --git a/components/omnibox/browser/omnibox_edit_model_unittest.cc b/components/omnibox/browser/omnibox_edit_model_unittest.cc index 6d25bf6a3d8c84..b426afb2e30a97 100644 --- a/components/omnibox/browser/omnibox_edit_model_unittest.cc +++ b/components/omnibox/browser/omnibox_edit_model_unittest.cc @@ -490,16 +490,15 @@ TEST_F(OmniboxEditModelTest, ConsumeCtrlKeyOnCtrlAction) { TEST_F(OmniboxEditModelTest, KeywordModePreservesInlineAutocompleteText) { // Set the edit model into an inline autocompletion state. - view()->SetUserText(base::UTF8ToUTF16("user")); - view()->OnInlineAutocompleteTextMaybeChanged(base::UTF8ToUTF16("user text"), - {{9, 4}}, 4); + view()->SetUserText(u"user"); + view()->OnInlineAutocompleteTextMaybeChanged(u"user text", {{9, 4}}, 4); // Entering keyword search mode should preserve the full display text as the // user text, and select all. model()->EnterKeywordModeForDefaultSearchProvider( OmniboxEventProto::KEYBOARD_SHORTCUT); - EXPECT_EQ(base::UTF8ToUTF16("user text"), model()->GetUserTextForTesting()); - EXPECT_EQ(base::UTF8ToUTF16("user text"), view()->GetText()); + EXPECT_EQ(u"user text", model()->GetUserTextForTesting()); + EXPECT_EQ(u"user text", view()->GetText()); EXPECT_TRUE(view()->IsSelectAll()); // Deleting the user text (exiting keyword) mode should clear everything. @@ -516,11 +515,11 @@ TEST_F(OmniboxEditModelTest, KeywordModePreservesInlineAutocompleteText) { TEST_F(OmniboxEditModelTest, KeywordModePreservesTemporaryText) { // Set the edit model into a temporary text state. - view()->SetUserText(base::UTF8ToUTF16("user text")); + view()->SetUserText(u"user text"); GURL destination_url("http://example.com"); // OnPopupDataChanged() is called when the user focuses a suggestion. - model()->OnPopupDataChanged(base::UTF8ToUTF16("match text"), + model()->OnPopupDataChanged(u"match text", /*is_temporary_text=*/true, std::u16string(), std::u16string(), {}, std::u16string(), false, std::u16string()); @@ -529,17 +528,16 @@ TEST_F(OmniboxEditModelTest, KeywordModePreservesTemporaryText) { // text, and select all. model()->EnterKeywordModeForDefaultSearchProvider( OmniboxEventProto::KEYBOARD_SHORTCUT); - EXPECT_EQ(base::UTF8ToUTF16("match text"), model()->GetUserTextForTesting()); - EXPECT_EQ(base::UTF8ToUTF16("match text"), view()->GetText()); + EXPECT_EQ(u"match text", model()->GetUserTextForTesting()); + EXPECT_EQ(u"match text", view()->GetText()); EXPECT_TRUE(view()->IsSelectAll()); } TEST_F(OmniboxEditModelTest, CtrlEnterNavigatesToDesiredTLD) { // Set the edit model into an inline autocomplete state. - view()->SetUserText(base::UTF8ToUTF16("foo")); + view()->SetUserText(u"foo"); model()->StartAutocomplete(false, false); - view()->OnInlineAutocompleteTextMaybeChanged(base::UTF8ToUTF16("foobar"), - {{6, 3}}, 3); + view()->OnInlineAutocompleteTextMaybeChanged(u"foobar", {{6, 3}}, 3); model()->OnControlKeyChanged(true); model()->AcceptInput(WindowOpenDisposition::UNKNOWN); @@ -550,7 +548,7 @@ TEST_F(OmniboxEditModelTest, CtrlEnterNavigatesToDesiredTLD) { TEST_F(OmniboxEditModelTest, CtrlEnterNavigatesToDesiredTLDTemporaryText) { // But if it's the temporary text, the View text should be used. - view()->SetUserText(base::UTF8ToUTF16("foo")); + view()->SetUserText(u"foo"); model()->StartAutocomplete(false, false); model()->OnPopupDataChanged(base::ASCIIToUTF16("foobar"), /*is_temporary_text=*/true, std::u16string(), diff --git a/components/omnibox/browser/omnibox_popup_model_unittest.cc b/components/omnibox/browser/omnibox_popup_model_unittest.cc index 8e943168bcf6f5..3d29c11dd6db5e 100644 --- a/components/omnibox/browser/omnibox_popup_model_unittest.cc +++ b/components/omnibox/browser/omnibox_popup_model_unittest.cc @@ -147,8 +147,7 @@ TEST_F(OmniboxPopupModelTest, SetSelectedLine) { matches.push_back(match); } auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("match"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"match", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); result->SortAndCull(input, nullptr); @@ -170,8 +169,7 @@ TEST_F(OmniboxPopupModelTest, SetSelectedLineWithNoDefaultMatches) { matches.push_back(match); } auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("match"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"match", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); result->SortAndCull(input, nullptr); @@ -203,8 +201,7 @@ TEST_F(OmniboxPopupModelTest, PopupPositionChanging) { matches.push_back(match); } auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("match"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"match", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); result->SortAndCull(input, nullptr); @@ -243,11 +240,10 @@ TEST_F(OmniboxPopupModelTest, PopupStepSelection) { matches[3].suggestion_group_id = 7; auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("match"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"match", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); - result->MergeHeadersMap({{7, base::UTF8ToUTF16("header")}}); + result->MergeHeadersMap({{7, u"header"}}); result->SortAndCull(input, nullptr); popup_model()->OnResultChanged(); EXPECT_EQ(0u, model()->popup_model()->selected_line()); @@ -325,11 +321,10 @@ TEST_F(OmniboxPopupModelTest, PopupStepSelectionWithHiddenGroupIds) { pref_service(), 7, omnibox::SuggestionGroupVisibility::HIDDEN); auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("match"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"match", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); - result->MergeHeadersMap({{7, base::UTF8ToUTF16("header")}}); + result->MergeHeadersMap({{7, u"header"}}); result->SortAndCull(input, nullptr); popup_model()->OnResultChanged(); EXPECT_EQ(0u, model()->popup_model()->selected_line()); @@ -405,11 +400,10 @@ TEST_F(OmniboxPopupModelSuggestionButtonRowTest, matches[3].suggestion_group_id = 7; auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("match"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"match", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); - result->MergeHeadersMap({{7, base::UTF8ToUTF16("header")}}); + result->MergeHeadersMap({{7, u"header"}}); result->SortAndCull(input, nullptr); popup_model()->OnResultChanged(); EXPECT_EQ(0u, model()->popup_model()->selected_line()); @@ -501,11 +495,10 @@ TEST_F(OmniboxPopupModelSuggestionButtonRowTest, matches[4].suggestion_group_id = 7; auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("match"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"match", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); - result->MergeHeadersMap({{7, base::UTF8ToUTF16("header")}}); + result->MergeHeadersMap({{7, u"header"}}); result->SortAndCull(input, nullptr); popup_model()->OnResultChanged(); EXPECT_EQ(0u, model()->popup_model()->selected_line()); @@ -586,29 +579,28 @@ TEST_F(OmniboxPopupModelTest, PopupInlineAutocompleteAndTemporaryText) { matches.push_back(match); } - matches[0].fill_into_edit = base::UTF8ToUTF16("a1"); - matches[0].inline_autocompletion = base::UTF8ToUTF16("1"); - matches[1].fill_into_edit = base::UTF8ToUTF16("a2"); - matches[2].fill_into_edit = base::UTF8ToUTF16("a3"); + matches[0].fill_into_edit = u"a1"; + matches[0].inline_autocompletion = u"1"; + matches[1].fill_into_edit = u"a2"; + matches[2].fill_into_edit = u"a3"; matches[2].suggestion_group_id = 7; auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("a"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"a", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); - result->MergeHeadersMap({{7, base::UTF8ToUTF16("header")}}); + result->MergeHeadersMap({{7, u"header"}}); result->SortAndCull(input, nullptr); popup_model()->OnResultChanged(); // Simulate OmniboxController updating the popup, then check initial state. model()->OnPopupDataChanged(std::u16string(), - /*is_temporary_text=*/false, - base::UTF8ToUTF16("1"), std::u16string(), {}, - std::u16string(), false, std::u16string()); + /*is_temporary_text=*/false, u"1", + std::u16string(), {}, std::u16string(), false, + std::u16string()); EXPECT_EQ(Selection(0, OmniboxPopupModel::NORMAL), model()->popup_model()->selection()); - EXPECT_EQ(base::UTF8ToUTF16("1"), model()->text()); + EXPECT_EQ(u"1", model()->text()); EXPECT_FALSE(model()->is_temporary_text()); // Tab down to second match. @@ -616,7 +608,7 @@ TEST_F(OmniboxPopupModelTest, PopupInlineAutocompleteAndTemporaryText) { OmniboxPopupModel::kStateOrLine); EXPECT_EQ(Selection(1, OmniboxPopupModel::NORMAL), model()->popup_model()->selection()); - EXPECT_EQ(base::UTF8ToUTF16("a2"), model()->text()); + EXPECT_EQ(u"a2", model()->text()); EXPECT_TRUE(model()->is_temporary_text()); // Tab down to header above the third match, expect that we have an empty @@ -634,7 +626,7 @@ TEST_F(OmniboxPopupModelTest, PopupInlineAutocompleteAndTemporaryText) { OmniboxPopupModel::kStateOrLine); EXPECT_EQ(Selection(2, OmniboxPopupModel::NORMAL), model()->popup_model()->selection()); - EXPECT_EQ(base::UTF8ToUTF16("a3"), model()->text()); + EXPECT_EQ(u"a3", model()->text()); EXPECT_TRUE(model()->is_temporary_text()); // Now tab backwards to the header again, expect that we have an empty string @@ -652,7 +644,7 @@ TEST_F(OmniboxPopupModelTest, PopupInlineAutocompleteAndTemporaryText) { OmniboxPopupModel::kStateOrLine); EXPECT_EQ(Selection(1, OmniboxPopupModel::NORMAL), model()->popup_model()->selection()); - EXPECT_EQ(base::UTF8ToUTF16("a2"), model()->text()); + EXPECT_EQ(u"a2", model()->text()); EXPECT_TRUE(model()->is_temporary_text()); } @@ -805,8 +797,7 @@ TEST_F(OmniboxPopupModelTest, TestFocusFixing) { matches.push_back(match); auto* result = &model()->autocomplete_controller()->result_; - AutocompleteInput input(base::UTF8ToUTF16("match"), - metrics::OmniboxEventProto::NTP, + AutocompleteInput input(u"match", metrics::OmniboxEventProto::NTP, TestSchemeClassifier()); result->AppendMatches(input, matches); result->SortAndCull(input, nullptr); diff --git a/components/omnibox/browser/on_device_head_provider_unittest.cc b/components/omnibox/browser/on_device_head_provider_unittest.cc index a63bfa145447bb..05f6c1c533f21d 100644 --- a/components/omnibox/browser/on_device_head_provider_unittest.cc +++ b/components/omnibox/browser/on_device_head_provider_unittest.cc @@ -79,8 +79,7 @@ TEST_F(OnDeviceHeadProviderTest, ModelInstanceNotCreated) { scoped_feature_list.InitAndEnableFeatureWithParameters( omnibox::kOnDeviceHeadProviderNonIncognito, {{OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, "0"}}); - AutocompleteInput input(base::UTF8ToUTF16("M"), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input(u"M", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input.set_want_asynchronous_matches(true); ResetModelInstance(); @@ -103,8 +102,7 @@ TEST_F(OnDeviceHeadProviderTest, RejectSynchronousRequest) { scoped_feature_list.InitAndEnableFeatureWithParameters( omnibox::kOnDeviceHeadProviderNonIncognito, {{OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, "0"}}); - AutocompleteInput input(base::UTF8ToUTF16("M"), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input(u"M", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input.set_want_asynchronous_matches(false); @@ -112,8 +110,7 @@ TEST_F(OnDeviceHeadProviderTest, RejectSynchronousRequest) { } TEST_F(OnDeviceHeadProviderTest, TestIfIncognitoIsAllowed) { - AutocompleteInput input(base::UTF8ToUTF16("M"), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input(u"M", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input.set_want_asynchronous_matches(true); @@ -132,8 +129,7 @@ TEST_F(OnDeviceHeadProviderTest, RejectOnFocusRequest) { scoped_feature_list.InitAndEnableFeatureWithParameters( omnibox::kOnDeviceHeadProviderNonIncognito, {{OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, "0"}}); - AutocompleteInput input(base::UTF8ToUTF16("M"), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input(u"M", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input.set_want_asynchronous_matches(true); input.set_focus_type(OmniboxFocusType::ON_FOCUS); @@ -149,8 +145,7 @@ TEST_F(OnDeviceHeadProviderTest, NoMatches) { scoped_feature_list.InitAndEnableFeatureWithParameters( omnibox::kOnDeviceHeadProviderNonIncognito, {{OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, "0"}}); - AutocompleteInput input(base::UTF8ToUTF16("b"), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input(u"b", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input.set_want_asynchronous_matches(true); @@ -172,8 +167,7 @@ TEST_F(OnDeviceHeadProviderTest, HasMatches) { scoped_feature_list.InitAndEnableFeatureWithParameters( omnibox::kOnDeviceHeadProviderNonIncognito, {{OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, "0"}}); - AutocompleteInput input(base::UTF8ToUTF16("M"), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input(u"M", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input.set_want_asynchronous_matches(true); @@ -188,9 +182,9 @@ TEST_F(OnDeviceHeadProviderTest, HasMatches) { EXPECT_TRUE(provider_->done()); ASSERT_EQ(3U, provider_->matches().size()); - EXPECT_EQ(base::UTF8ToUTF16("maps"), provider_->matches()[0].contents); - EXPECT_EQ(base::UTF8ToUTF16("mail"), provider_->matches()[1].contents); - EXPECT_EQ(base::UTF8ToUTF16("map"), provider_->matches()[2].contents); + EXPECT_EQ(u"maps", provider_->matches()[0].contents); + EXPECT_EQ(u"mail", provider_->matches()[1].contents); + EXPECT_EQ(u"map", provider_->matches()[2].contents); } TEST_F(OnDeviceHeadProviderTest, CancelInProgressRequest) { @@ -198,12 +192,10 @@ TEST_F(OnDeviceHeadProviderTest, CancelInProgressRequest) { scoped_feature_list.InitAndEnableFeatureWithParameters( omnibox::kOnDeviceHeadProviderNonIncognito, {{OmniboxFieldTrial::kOnDeviceHeadSuggestDelaySuggestRequestMs, "0"}}); - AutocompleteInput input1(base::UTF8ToUTF16("g"), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input1(u"g", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input1.set_want_asynchronous_matches(true); - AutocompleteInput input2(base::UTF8ToUTF16("m"), - metrics::OmniboxEventProto::OTHER, + AutocompleteInput input2(u"m", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier()); input2.set_want_asynchronous_matches(true); @@ -220,7 +212,7 @@ TEST_F(OnDeviceHeadProviderTest, CancelInProgressRequest) { EXPECT_TRUE(provider_->done()); ASSERT_EQ(3U, provider_->matches().size()); - EXPECT_EQ(base::UTF8ToUTF16("maps"), provider_->matches()[0].contents); - EXPECT_EQ(base::UTF8ToUTF16("mail"), provider_->matches()[1].contents); - EXPECT_EQ(base::UTF8ToUTF16("map"), provider_->matches()[2].contents); + EXPECT_EQ(u"maps", provider_->matches()[0].contents); + EXPECT_EQ(u"mail", provider_->matches()[1].contents); + EXPECT_EQ(u"map", provider_->matches()[2].contents); } diff --git a/components/omnibox/browser/search_suggestion_parser.cc b/components/omnibox/browser/search_suggestion_parser.cc index 1a3f0b20359b33..5d44a65d73300a 100644 --- a/components/omnibox/browser/search_suggestion_parser.cc +++ b/components/omnibox/browser/search_suggestion_parser.cc @@ -611,8 +611,7 @@ bool SearchSuggestionParser::ParseSuggestResults( std::u16string annotation; std::u16string match_contents = suggestion; if (match_type == AutocompleteMatchType::CALCULATOR) { - const bool has_equals_prefix = - !suggestion.compare(0, 2, base::UTF8ToUTF16("= ")); + const bool has_equals_prefix = !suggestion.compare(0, 2, u"= "); if (has_equals_prefix) { // Calculator results include a "= " prefix but we don't want to // include this in the search terms. diff --git a/components/omnibox/browser/shortcuts_backend_unittest.cc b/components/omnibox/browser/shortcuts_backend_unittest.cc index b6264bbfa94096..a35c2182969894 100644 --- a/components/omnibox/browser/shortcuts_backend_unittest.cc +++ b/components/omnibox/browser/shortcuts_backend_unittest.cc @@ -98,8 +98,8 @@ ShortcutsBackendTest::MatchCoreForTesting(const std::string& url, void ShortcutsBackendTest::SetSearchProvider() { TemplateURLData data; data.SetURL("http://foo.com/search?bar={searchTerms}"); - data.SetShortName(base::UTF8ToUTF16("foo")); - data.SetKeyword(base::UTF8ToUTF16("foo")); + data.SetShortName(u"foo"); + data.SetKeyword(u"foo"); TemplateURL* template_url = template_url_service_->Add(std::make_unique(data)); @@ -227,16 +227,16 @@ TEST_F(ShortcutsBackendTest, SanitizeMatchCore) { TEST_F(ShortcutsBackendTest, EntitySuggestionTest) { SetSearchProvider(); AutocompleteMatch match; - match.fill_into_edit = base::UTF8ToUTF16("franklin d roosevelt"); + match.fill_into_edit = u"franklin d roosevelt"; match.type = AutocompleteMatchType::SEARCH_SUGGEST_ENTITY; - match.contents = base::UTF8ToUTF16("roosevelt"); + match.contents = u"roosevelt"; match.contents_class = AutocompleteMatch::ClassificationsFromString("0,0,5,2"); - match.description = base::UTF8ToUTF16("Franklin D. Roosevelt"); + match.description = u"Franklin D. Roosevelt"; match.description_class = AutocompleteMatch::ClassificationsFromString("0,4"); match.destination_url = GURL("http://www.foo.com/search?bar=franklin+d+roosevelt&gs_ssp=1234"); - match.keyword = base::UTF8ToUTF16("foo"); + match.keyword = u"foo"; match.search_terms_args.reset( new TemplateURLRef::SearchTermsArgs(match.fill_into_edit)); @@ -257,7 +257,7 @@ TEST_F(ShortcutsBackendTest, MatchCoreDescriptionTest) { // match.description. { AutocompleteMatch match; - match.description = base::UTF8ToUTF16("the cat"); + match.description = u"the cat"; match.description_class = AutocompleteMatch::ClassificationsFromString("0,1"); @@ -275,10 +275,10 @@ TEST_F(ShortcutsBackendTest, MatchCoreDescriptionTest) { // instead of match.description. { AutocompleteMatch match; - match.description = base::UTF8ToUTF16("the cat"); + match.description = u"the cat"; match.description_class = AutocompleteMatch::ClassificationsFromString("0,1"); - match.description_for_shortcuts = base::UTF8ToUTF16("the elephant"); + match.description_for_shortcuts = u"the elephant"; match.description_class_for_shortcuts = AutocompleteMatch::ClassificationsFromString("0,4"); diff --git a/components/omnibox/browser/suggestion_answer_unittest.cc b/components/omnibox/browser/suggestion_answer_unittest.cc index 6363d1efed9004..b2f8b5ddcd6c37 100644 --- a/components/omnibox/browser/suggestion_answer_unittest.cc +++ b/components/omnibox/browser/suggestion_answer_unittest.cc @@ -22,7 +22,7 @@ bool ParseAnswer(const std::string& answer_json, SuggestionAnswer* answer) { // ParseAnswer previously did not change the default answer type of -1, so // here we keep the same behavior by explicitly supplying default value. - return SuggestionAnswer::ParseAnswer(*value, base::UTF8ToUTF16("-1"), answer); + return SuggestionAnswer::ParseAnswer(*value, u"-1", answer); } } // namespace @@ -79,7 +79,7 @@ TEST(SuggestionAnswerTest, DifferentValuesAreUnequal) { // Same but with different text for one of the text fields. answer2 = answer1; EXPECT_TRUE(answer1.Equals(answer2)); - answer2.first_line_.text_fields_[0].text_ = base::UTF8ToUTF16("some text"); + answer2.first_line_.text_fields_[0].text_ = u"some text"; EXPECT_FALSE(answer1.Equals(answer2)); // Same but with a new URL on the second line. @@ -222,9 +222,9 @@ TEST(SuggestionAnswerTest, ValidPropertyValues) { const SuggestionAnswer::ImageLine& first_line = answer.first_line(); EXPECT_EQ(2U, first_line.text_fields().size()); - EXPECT_EQ(base::UTF8ToUTF16("text"), first_line.text_fields()[0].text()); + EXPECT_EQ(u"text", first_line.text_fields()[0].text()); EXPECT_EQ(8, first_line.text_fields()[0].type()); - EXPECT_EQ(base::UTF8ToUTF16("moar text"), first_line.text_fields()[1].text()); + EXPECT_EQ(u"moar text", first_line.text_fields()[1].text()); EXPECT_EQ(0, first_line.text_fields()[1].type()); EXPECT_FALSE(first_line.text_fields()[1].has_num_lines()); EXPECT_EQ(1, first_line.num_text_lines()); @@ -237,21 +237,18 @@ TEST(SuggestionAnswerTest, ValidPropertyValues) { const SuggestionAnswer::ImageLine& second_line = answer.second_line(); EXPECT_EQ(1U, second_line.text_fields().size()); - EXPECT_EQ( - base::UTF8ToUTF16("other text"), second_line.text_fields()[0].text()); + EXPECT_EQ(u"other text", second_line.text_fields()[0].text()); EXPECT_EQ(5, second_line.text_fields()[0].type()); EXPECT_TRUE(second_line.text_fields()[0].has_num_lines()); EXPECT_EQ(3, second_line.text_fields()[0].num_lines()); EXPECT_EQ(3, second_line.num_text_lines()); EXPECT_TRUE(second_line.additional_text()); - EXPECT_EQ( - base::UTF8ToUTF16("slatfatf"), second_line.additional_text()->text()); + EXPECT_EQ(u"slatfatf", second_line.additional_text()->text()); EXPECT_EQ(42, second_line.additional_text()->type()); EXPECT_TRUE(second_line.status_text()); - EXPECT_EQ( - base::UTF8ToUTF16("oh hi, Mark"), second_line.status_text()->text()); + EXPECT_EQ(u"oh hi, Mark", second_line.status_text()->text()); EXPECT_EQ(729347, second_line.status_text()->type()); EXPECT_FALSE(second_line.image_url().is_valid()); diff --git a/components/omnibox/browser/tailored_word_break_iterator_unittest.cc b/components/omnibox/browser/tailored_word_break_iterator_unittest.cc index f4a4be0642310d..a6b1c26a032d56 100644 --- a/components/omnibox/browser/tailored_word_break_iterator_unittest.cc +++ b/components/omnibox/browser/tailored_word_break_iterator_unittest.cc @@ -10,7 +10,7 @@ #include "testing/gtest/include/gtest/gtest.h" TEST(TailoredWordBreakIterator, BreakWord) { - std::u16string underscore(base::UTF8ToUTF16("_")); + std::u16string underscore(u"_"); std::u16string str(base::UTF8ToUTF16("_foo_bar!_\npouet_boom")); TailoredWordBreakIterator iter(str, TailoredWordBreakIterator::BREAK_WORD); ASSERT_TRUE(iter.Init()); @@ -19,16 +19,16 @@ TEST(TailoredWordBreakIterator, BreakWord) { EXPECT_EQ(underscore, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(base::UTF8ToUTF16("foo"), iter.GetString()); + EXPECT_EQ(u"foo", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_EQ(underscore, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(base::UTF8ToUTF16("bar"), iter.GetString()); + EXPECT_EQ(u"bar", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); - EXPECT_EQ(base::UTF8ToUTF16("!"), iter.GetString()); + EXPECT_EQ(u"!", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_EQ(underscore, iter.GetString()); @@ -37,13 +37,13 @@ TEST(TailoredWordBreakIterator, BreakWord) { EXPECT_EQ(base::UTF8ToUTF16("\n"), iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(base::UTF8ToUTF16("pouet"), iter.GetString()); + EXPECT_EQ(u"pouet", iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_EQ(underscore, iter.GetString()); EXPECT_TRUE(iter.Advance()); EXPECT_TRUE(iter.IsWord()); - EXPECT_EQ(base::UTF8ToUTF16("boom"), iter.GetString()); + EXPECT_EQ(u"boom", iter.GetString()); EXPECT_FALSE(iter.Advance()); EXPECT_FALSE(iter.IsWord()); EXPECT_FALSE(iter.Advance()); diff --git a/components/omnibox/browser/titled_url_match_utils.cc b/components/omnibox/browser/titled_url_match_utils.cc index 93269d4e976436..c602e6baff1508 100644 --- a/components/omnibox/browser/titled_url_match_utils.cc +++ b/components/omnibox/browser/titled_url_match_utils.cc @@ -29,8 +29,7 @@ std::u16string ConcatAncestorsTitles( : std::accumulate(std::next(ancestors.rbegin()), ancestors.rend(), std::u16string(*ancestors.rbegin()), [](std::u16string& a, base::StringPiece16& b) { - return a + base::UTF8ToUTF16("/") + - std::u16string(b); + return a + u"/" + std::u16string(b); }); } @@ -106,11 +105,11 @@ AutocompleteMatch TitledUrlMatchToAutocompleteMatch( if (base::GetFieldTrialParamByFeatureAsBool( omnibox::kBookmarkPaths, OmniboxFieldTrial::kBookmarkPathsUiReplaceTitle, false)) { - match.description = path + base::UTF8ToUTF16("/") + title; + match.description = path + u"/" + title; } else if (base::GetFieldTrialParamByFeatureAsBool( omnibox::kBookmarkPaths, OmniboxFieldTrial::kBookmarkPathsUiAppendAfterTitle, false)) { - match.description = title + base::UTF8ToUTF16(" : ") + path; + match.description = title + u" : " + path; } else { match.description = title; } diff --git a/components/omnibox/browser/titled_url_match_utils_unittest.cc b/components/omnibox/browser/titled_url_match_utils_unittest.cc index 394a8a5a05e107..acfc92724f6345 100644 --- a/components/omnibox/browser/titled_url_match_utils_unittest.cc +++ b/components/omnibox/browser/titled_url_match_utils_unittest.cc @@ -309,8 +309,7 @@ TEST(TitledUrlMatchUtilsTest, PathsInContentsAndDescription) { scoped_refptr provider = new FakeAutocompleteProvider(AutocompleteProvider::Type::TYPE_BOOKMARK); TestSchemeClassifier classifier; - std::vector ancestors = {base::UTF8ToUTF16("parent"), - base::UTF8ToUTF16("grandparent")}; + std::vector ancestors = {u"parent", u"grandparent"}; // Verifies contents and description of the AutocompleteMatch returned from // |bookmarks::TitledUrlMatchToAutocompleteMatch()|. diff --git a/components/password_manager/core/browser/browser_save_password_progress_logger_unittest.cc b/components/password_manager/core/browser/browser_save_password_progress_logger_unittest.cc index 84aba3161d7b35..e580af758e7514 100644 --- a/components/password_manager/core/browser/browser_save_password_progress_logger_unittest.cc +++ b/components/password_manager/core/browser/browser_save_password_progress_logger_unittest.cc @@ -53,11 +53,11 @@ class BrowserSavePasswordProgressLoggerTest : public testing::Test { BrowserSavePasswordProgressLoggerTest() { form_.url = GURL("http://myform.com/form.html"); form_.action = GURL("http://m.myform.com/submit.html"); - form_.name = base::UTF8ToUTF16("form_name"); + form_.name = u"form_name"; // Add a password field. autofill::FormFieldData field; - field.name = base::UTF8ToUTF16("password"); + field.name = u"password"; field.form_control_type = "password"; field.is_focusable = true; field.autocomplete_attribute = "new-password"; @@ -65,11 +65,11 @@ class BrowserSavePasswordProgressLoggerTest : public testing::Test { form_.fields.push_back(field); // Add a text field. - field.name = base::UTF8ToUTF16("email"); + field.name = u"email"; field.form_control_type = "text"; field.is_focusable = false; field.unique_renderer_id = autofill::FieldRendererId(42); - field.value = base::UTF8ToUTF16("a@example.com"); + field.value = u"a@example.com"; field.autocomplete_attribute.clear(); form_.fields.push_back(field); } @@ -103,9 +103,9 @@ TEST(SavePasswordProgressLoggerTest, LogPasswordForm) { TestLogger logger(&log_manager); PasswordForm form; form.action = GURL("http://example.org/verysecret?verysecret"); - form.password_element = UTF8ToUTF16("pwdelement"); - form.password_value = UTF8ToUTF16("verysecret"); - form.username_value = UTF8ToUTF16("verysecret"); + form.password_element = u"pwdelement"; + form.password_value = u"verysecret"; + form.username_value = u"verysecret"; logger.LogPasswordForm(Logger::STRING_MESSAGE, form); SCOPED_TRACE(testing::Message() << "Log string = [" << logger.accumulated_log() << "]"); diff --git a/components/password_manager/core/browser/export/password_csv_writer_unittest.cc b/components/password_manager/core/browser/export/password_csv_writer_unittest.cc index a5bbfe87884ad0..d8126336499cc7 100644 --- a/components/password_manager/core/browser/export/password_csv_writer_unittest.cc +++ b/components/password_manager/core/browser/export/password_csv_writer_unittest.cc @@ -42,8 +42,8 @@ TEST(PasswordCSVWriterTest, SerializePasswords_SinglePassword) { std::vector> passwords; PasswordForm form; form.url = GURL("http://example.com"); - form.username_value = base::UTF8ToUTF16("Someone"); - form.password_value = base::UTF8ToUTF16("Secret"); + form.username_value = u"Someone"; + form.password_value = u"Secret"; passwords.push_back(std::make_unique(form)); CSVPasswordSequence seq(PasswordCSVWriter::SerializePasswords(passwords)); @@ -61,12 +61,12 @@ TEST(PasswordCSVWriterTest, SerializePasswords_TwoPasswords) { std::vector> passwords; PasswordForm form; form.url = GURL("http://example.com"); - form.username_value = base::UTF8ToUTF16("Someone"); - form.password_value = base::UTF8ToUTF16("Secret"); + form.username_value = u"Someone"; + form.password_value = u"Secret"; passwords.push_back(std::make_unique(form)); form.url = GURL("http://other.org"); - form.username_value = base::UTF8ToUTF16("Anyone"); - form.password_value = base::UTF8ToUTF16("None"); + form.username_value = u"Anyone"; + form.password_value = u"None"; passwords.push_back(std::make_unique(form)); CSVPasswordSequence seq(PasswordCSVWriter::SerializePasswords(passwords)); diff --git a/components/password_manager/core/browser/form_parsing/form_parser_unittest.cc b/components/password_manager/core/browser/form_parsing/form_parser_unittest.cc index c405420c14d32a..d57b10c015ab77 100644 --- a/components/password_manager/core/browser/form_parsing/form_parser_unittest.cc +++ b/components/password_manager/core/browser/form_parsing/form_parser_unittest.cc @@ -2648,7 +2648,7 @@ TEST(FormParserTest, FindUsernameInPredictions_SkipPrediction) { const autofill::FormFieldData* field_data = FindUsernameInPredictions( predictions, processed_fields, Interactability::kCertain); ASSERT_TRUE(field_data); - EXPECT_EQ(base::UTF8ToUTF16("id"), field_data->name); + EXPECT_EQ(u"id", field_data->name); } } // namespace diff --git a/components/password_manager/core/browser/form_parsing/fuzzer/data_accessor_unittest.cc b/components/password_manager/core/browser/form_parsing/fuzzer/data_accessor_unittest.cc index fc5942ef8d49c9..3447e03c24b8c1 100644 --- a/components/password_manager/core/browser/form_parsing/fuzzer/data_accessor_unittest.cc +++ b/components/password_manager/core/browser/form_parsing/fuzzer/data_accessor_unittest.cc @@ -64,12 +64,12 @@ TEST(DataAccessorTest, String) { } TEST(DataAccessorTest, String16) { - const std::u16string str = UTF8ToUTF16("Test string 123."); + const std::u16string str = u"Test string 123."; DataAccessor accessor(reinterpret_cast(str.c_str()), str.size() * 2); - EXPECT_EQ(UTF8ToUTF16("Test"), accessor.ConsumeString16(4)); + EXPECT_EQ(u"Test", accessor.ConsumeString16(4)); accessor.ConsumeNumber(13); // Skip 13 bits to test re-alignment. - EXPECT_EQ(UTF8ToUTF16("string 123"), accessor.ConsumeString16(10)); + EXPECT_EQ(u"string 123", accessor.ConsumeString16(10)); EXPECT_EQ(std::u16string(), accessor.ConsumeString16(0)); // Test also that padding is included. EXPECT_EQ(UTF8ToUTF16(std::string(".\0\0", 3)), accessor.ConsumeString16(3)); @@ -86,7 +86,7 @@ TEST(DataAccessorTest, Mix) { EXPECT_EQ(9u + (1u << 8), accessor.ConsumeNumber(9)); EXPECT_EQ(false, accessor.ConsumeBit()); EXPECT_EQ("cd", accessor.ConsumeString(2)); - EXPECT_EQ(UTF8ToUTF16("e"), accessor.ConsumeString16(1)); + EXPECT_EQ(u"e", accessor.ConsumeString16(1)); } } // namespace diff --git a/components/password_manager/core/browser/form_parsing/fuzzer/form_data_producer.cc b/components/password_manager/core/browser/form_parsing/fuzzer/form_data_producer.cc index e69019b9c6993c..b40b64d63b7884 100644 --- a/components/password_manager/core/browser/form_parsing/fuzzer/form_data_producer.cc +++ b/components/password_manager/core/browser/form_parsing/fuzzer/form_data_producer.cc @@ -148,9 +148,8 @@ autofill::FormData GenerateWithDataAccessor( } #if defined(OS_IOS) - result.fields[i].unique_id = result.fields[i].id_attribute + - base::UTF8ToUTF16("-") + - base::NumberToString16(i); + result.fields[i].unique_id = + result.fields[i].id_attribute + u"-" + base::NumberToString16(i); #endif if (field_params[i].same_value_field && first_field_with_same_value != static_cast(i)) { diff --git a/components/password_manager/core/browser/form_parsing/fuzzer/form_data_proto_producer.cc b/components/password_manager/core/browser/form_parsing/fuzzer/form_data_proto_producer.cc index 342f5d4ce6ac7d..d2c046854204ea 100644 --- a/components/password_manager/core/browser/form_parsing/fuzzer/form_data_proto_producer.cc +++ b/components/password_manager/core/browser/form_parsing/fuzzer/form_data_proto_producer.cc @@ -46,9 +46,8 @@ FormData GenerateWithProto(const ::form_data_fuzzer::Form& form_proto) { const ::form_data_fuzzer::FormField& form_data_proto = form_proto.fields(i); result.fields[i].id_attribute = UTF8ToUTF16(form_data_proto.id()); #if defined(OS_IOS) - result.fields[i].unique_id = result.fields[i].id_attribute + - base::UTF8ToUTF16("-") + - base::NumberToString16(i); + result.fields[i].unique_id = + result.fields[i].id_attribute + u"-" + base::NumberToString16(i); #endif result.fields[i].name_attribute = UTF8ToUTF16(form_data_proto.name()); result.fields[i].is_focusable = form_data_proto.is_focusable(); diff --git a/components/password_manager/core/browser/hash_password_manager_unittest.cc b/components/password_manager/core/browser/hash_password_manager_unittest.cc index 4bce32643ad1ff..8c22ef7f893368 100644 --- a/components/password_manager/core/browser/hash_password_manager_unittest.cc +++ b/components/password_manager/core/browser/hash_password_manager_unittest.cc @@ -42,7 +42,7 @@ TEST_F(HashPasswordManagerTest, SavingPasswordHashData) { ASSERT_FALSE(prefs_.HasPrefPath(prefs::kPasswordHashDataList)); HashPasswordManager hash_password_manager; hash_password_manager.set_prefs(&prefs_); - std::u16string password(base::UTF8ToUTF16("password")); + std::u16string password(u"password"); std::string username("user@example.com"); // Verify |SavePasswordHash(const std::string,const std::u16string&)| @@ -66,7 +66,7 @@ TEST_F(HashPasswordManagerTest, SavingPasswordHashData) { EXPECT_TRUE(existing_password_data->is_gaia_password); // Verify |SavePasswordHash(const PasswordHashData&)| behavior. - std::u16string new_password(base::UTF8ToUTF16("new_password")); + std::u16string new_password(u"new_password"); PasswordHashData new_password_data(username, new_password, /*force_update=*/true); EXPECT_TRUE(hash_password_manager.SavePasswordHash(new_password_data)); @@ -80,7 +80,7 @@ TEST_F(HashPasswordManagerTest, SavingPasswordHashDataNotCanonicalized) { ASSERT_FALSE(prefs_.HasPrefPath(prefs::kPasswordHashDataList)); HashPasswordManager hash_password_manager; hash_password_manager.set_prefs(&prefs_); - std::u16string password(base::UTF8ToUTF16("password")); + std::u16string password(u"password"); std::string canonical_username("user@gmail.com"); std::string username("US.ER@gmail.com"); std::string gmail_prefix("user"); @@ -141,7 +141,7 @@ TEST_F(HashPasswordManagerTest, SavingGaiaPasswordAndNonGaiaPassword) { ASSERT_FALSE(prefs_.HasPrefPath(prefs::kPasswordHashDataList)); HashPasswordManager hash_password_manager; hash_password_manager.set_prefs(&prefs_); - std::u16string password(base::UTF8ToUTF16("password")); + std::u16string password(u"password"); std::string username("user@example.com"); // Saves a Gaia password. @@ -161,7 +161,7 @@ TEST_F(HashPasswordManagerTest, SavingMultipleHashesAndRetrieveAll) { ASSERT_FALSE(prefs_.HasPrefPath(prefs::kPasswordHashDataList)); HashPasswordManager hash_password_manager; hash_password_manager.set_prefs(&prefs_); - std::u16string password(base::UTF8ToUTF16("password")); + std::u16string password(u"password"); // Save password hash for 6 different users. hash_password_manager.SavePasswordHash("username1", password, @@ -212,18 +212,14 @@ TEST_F(HashPasswordManagerTest, ClearingPasswordHashData) { ASSERT_FALSE(prefs_.HasPrefPath(prefs::kPasswordHashDataList)); HashPasswordManager hash_password_manager; hash_password_manager.set_prefs(&prefs_); - hash_password_manager.SavePasswordHash("username1", - base::UTF8ToUTF16("sync_password"), + hash_password_manager.SavePasswordHash("username1", u"sync_password", /*is_gaia_password=*/true); - hash_password_manager.SavePasswordHash("username2", - base::UTF8ToUTF16("sync_password"), + hash_password_manager.SavePasswordHash("username2", u"sync_password", /*is_gaia_password=*/true); - hash_password_manager.SavePasswordHash( - "username3", base::UTF8ToUTF16("enterprise_password"), - /*is_gaia_password=*/false); - hash_password_manager.SavePasswordHash( - "username4", base::UTF8ToUTF16("enterprise_password"), - /*is_gaia_password=*/false); + hash_password_manager.SavePasswordHash("username3", u"enterprise_password", + /*is_gaia_password=*/false); + hash_password_manager.SavePasswordHash("username4", u"enterprise_password", + /*is_gaia_password=*/false); hash_password_manager.ClearSavedPasswordHash("other_username", /*is_gaia_password=*/true); @@ -247,8 +243,7 @@ TEST_F(HashPasswordManagerTest, RetrievingPasswordHashData) { ASSERT_FALSE(prefs_.HasPrefPath(prefs::kPasswordHashDataList)); HashPasswordManager hash_password_manager; hash_password_manager.set_prefs(&prefs_); - hash_password_manager.SavePasswordHash("username@gmail.com", - base::UTF8ToUTF16("password"), + hash_password_manager.SavePasswordHash("username@gmail.com", u"password", /*is_gaia_password=*/true); EXPECT_EQ(1u, hash_password_manager.RetrieveAllPasswordHashes().size()); @@ -261,8 +256,8 @@ TEST_F(HashPasswordManagerTest, RetrievingPasswordHashData) { ASSERT_TRUE(password_hash_data); EXPECT_EQ(8u, password_hash_data->length); EXPECT_EQ(16u, password_hash_data->salt.size()); - uint64_t expected_hash = CalculatePasswordHash(base::UTF8ToUTF16("password"), - password_hash_data->salt); + uint64_t expected_hash = + CalculatePasswordHash(u"password", password_hash_data->salt); EXPECT_EQ(expected_hash, password_hash_data->hash); // Retrieve not canonicalized version of "username@gmail.com" should return diff --git a/components/password_manager/core/browser/password_autofill_manager_unittest.cc b/components/password_manager/core/browser/password_autofill_manager_unittest.cc index fffd332ef0493d..7bbfc446f01746 100644 --- a/components/password_manager/core/browser/password_autofill_manager_unittest.cc +++ b/components/password_manager/core/browser/password_autofill_manager_unittest.cc @@ -915,11 +915,9 @@ TEST_F(PasswordAutofillManagerTest, ExtractSuggestions) { SuggestionVectorValuesAre(testing::UnorderedElementsAre( test_username_, additional.username, GetManagePasswordsTitle()))); EXPECT_THAT(open_args.suggestions, - SuggestionVectorLabelsAre( - testing::Contains(base::UTF8ToUTF16("foo.com")))); + SuggestionVectorLabelsAre(testing::Contains(u"foo.com"))); EXPECT_THAT(open_args.suggestions, - SuggestionVectorLabelsAre( - testing::Contains(base::UTF8ToUTF16("foobarrealm.org")))); + SuggestionVectorLabelsAre(testing::Contains(u"foobarrealm.org"))); // Now simulate displaying suggestions matching "John". EXPECT_CALL(autofill_client, ShowAutofillPopup) diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index f6f135b7eba8c7..12294626387d6f 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc @@ -2077,23 +2077,22 @@ TEST_P(PasswordFormManagerTest, iOSUsingFieldDataManagerData) { auto field_data_manager = base::MakeRefCounted(); field_data_manager->UpdateFieldDataMap( - observed_form_.fields[1].unique_renderer_id, - base::UTF8ToUTF16("typed_username"), FieldPropertiesFlags::kUserTyped); + observed_form_.fields[1].unique_renderer_id, u"typed_username", + FieldPropertiesFlags::kUserTyped); field_data_manager->UpdateFieldDataMap( - observed_form_.fields[2].unique_renderer_id, - base::UTF8ToUTF16("autofilled_pw"), + observed_form_.fields[2].unique_renderer_id, u"autofilled_pw", FieldPropertiesFlags::kAutofilledOnUserTrigger); form_manager_->ProvisionallySaveFieldDataManagerInfo(field_data_manager.get(), &driver_); EXPECT_EQ(form_manager_->observed_form()->fields[1].user_input, - base::UTF8ToUTF16("typed_username")); + u"typed_username"); EXPECT_EQ(form_manager_->observed_form()->fields[1].properties_mask, FieldPropertiesFlags::kUserTyped); EXPECT_EQ(form_manager_->observed_form()->fields[2].user_input, - base::UTF8ToUTF16("autofilled_pw")); + u"autofilled_pw"); EXPECT_EQ(form_manager_->observed_form()->fields[2].properties_mask, FieldPropertiesFlags::kAutofilledOnUserTrigger); } diff --git a/components/password_manager/core/browser/password_store_unittest.cc b/components/password_manager/core/browser/password_store_unittest.cc index e85a1ef4c35551..c899602ae7bda1 100644 --- a/components/password_manager/core/browser/password_store_unittest.cc +++ b/components/password_manager/core/browser/password_store_unittest.cc @@ -184,9 +184,9 @@ PasswordStoreChangeList AddChangeForForm(const PasswordForm& form) { PasswordForm MakePasswordForm(const std::string& signon_realm) { PasswordForm form; form.url = GURL("http://www.origin.com"); - form.username_element = base::UTF8ToUTF16("username_element"); - form.username_value = base::UTF8ToUTF16("username_value"); - form.password_element = base::UTF8ToUTF16("password_element"); + form.username_element = u"username_element"; + form.username_value = u"username_value"; + form.password_element = u"password_element"; form.signon_realm = signon_realm; return form; } diff --git a/components/password_manager/core/browser/sync/password_sync_bridge.cc b/components/password_manager/core/browser/sync/password_sync_bridge.cc index df1149b3685089..403646acabfc0d 100644 --- a/components/password_manager/core/browser/sync/password_sync_bridge.cc +++ b/components/password_manager/core/browser/sync/password_sync_bridge.cc @@ -945,7 +945,7 @@ void PasswordSyncBridge::GetAllDataForDebugging(DataCallback callback) { PasswordForm form = *pair.second; const std::vector insecure_credentials = password_store_sync_->ReadSecurityIssues(pair.first); - form.password_value = base::UTF8ToUTF16(""); + form.password_value = u""; batch->Put(base::NumberToString(pair.first.value()), CreateEntityData(form, insecure_credentials)); } diff --git a/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc b/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc index aa6c6563796fe7..84015857ec4072 100644 --- a/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc +++ b/components/password_manager/core/browser/sync/password_sync_bridge_unittest.cc @@ -161,9 +161,9 @@ sync_pb::PasswordSpecifics CreateSpecificsWithSignonRealmAndIssues( PasswordForm MakePasswordForm(const std::string& signon_realm) { PasswordForm form; form.url = GURL("http://www.origin.com"); - form.username_element = base::UTF8ToUTF16("username_element"); - form.username_value = base::UTF8ToUTF16("username_value"); - form.password_element = base::UTF8ToUTF16("password_element"); + form.username_element = u"username_element"; + form.username_value = u"username_value"; + form.password_element = u"password_element"; form.signon_realm = signon_realm; return form; } diff --git a/components/payments/content/autofill_payment_app.cc b/components/payments/content/autofill_payment_app.cc index bd8dd1ce95d0fe..25abbc2b32be14 100644 --- a/components/payments/content/autofill_payment_app.cc +++ b/components/payments/content/autofill_payment_app.cc @@ -227,7 +227,7 @@ void AutofillPaymentApp::GenerateBasicCardResponse() { delegate_ = nullptr; } - cvc_ = base::UTF8ToUTF16(""); + cvc_ = u""; } void AutofillPaymentApp::OnAddressNormalized( diff --git a/components/payments/content/payment_credential_enrollment_model_unittest.cc b/components/payments/content/payment_credential_enrollment_model_unittest.cc index 952da7798ced6a..1a56b4c4320d3e 100644 --- a/components/payments/content/payment_credential_enrollment_model_unittest.cc +++ b/components/payments/content/payment_credential_enrollment_model_unittest.cc @@ -14,13 +14,12 @@ namespace payments { TEST(PaymentCredentialEnrollmentModelTest, SmokeTest) { PaymentCredentialEnrollmentModel model; - std::u16string title( - base::UTF8ToUTF16("Use Touch ID to verify and complete your purchase?")); + std::u16string title(u"Use Touch ID to verify and complete your purchase?"); std::u16string description(base::UTF8ToUTF16( "Save payment information to this device and skip bank verification next " "time when you use Touch ID to verify your payment with Visa ••••4444.")); - std::u16string accept_button_label(base::UTF8ToUTF16("Use Touch ID")); - std::u16string cancel_button_label(base::UTF8ToUTF16("No thanks")); + std::u16string accept_button_label(u"Use Touch ID"); + std::u16string cancel_button_label(u"No thanks"); model.set_title(title); EXPECT_EQ(title, model.title()); diff --git a/components/payments/content/payment_request_spec_unittest.cc b/components/payments/content/payment_request_spec_unittest.cc index 2e1372caecfced..3737a60e4d4772 100644 --- a/components/payments/content/payment_request_spec_unittest.cc +++ b/components/payments/content/payment_request_spec_unittest.cc @@ -488,10 +488,10 @@ TEST_F(PaymentRequestSpecTest, RetryWithShippingAddressErrors) { spec()->Retry(std::move(errors)); - EXPECT_EQ(base::UTF8ToUTF16("Invalid city"), + EXPECT_EQ(u"Invalid city", spec()->GetShippingAddressError(autofill::ADDRESS_HOME_CITY)); EXPECT_EQ( - base::UTF8ToUTF16("Invalid address line"), + u"Invalid address line", spec()->GetShippingAddressError(autofill::ADDRESS_HOME_STREET_ADDRESS)); EXPECT_TRUE(spec()->has_shipping_address_error()); @@ -518,11 +518,9 @@ TEST_F(PaymentRequestSpecTest, RetryWithPayerErrors) { spec()->Retry(std::move(errors)); - EXPECT_EQ(base::UTF8ToUTF16("Invalid email"), - spec()->GetPayerError(autofill::EMAIL_ADDRESS)); - EXPECT_EQ(base::UTF8ToUTF16("Invalid name"), - spec()->GetPayerError(autofill::NAME_FULL)); - EXPECT_EQ(base::UTF8ToUTF16("Invalid phone"), + EXPECT_EQ(u"Invalid email", spec()->GetPayerError(autofill::EMAIL_ADDRESS)); + EXPECT_EQ(u"Invalid name", spec()->GetPayerError(autofill::NAME_FULL)); + EXPECT_EQ(u"Invalid phone", spec()->GetPayerError(autofill::PHONE_HOME_WHOLE_NUMBER)); EXPECT_TRUE(spec()->has_payer_error()); diff --git a/components/payments/content/payment_response_helper_unittest.cc b/components/payments/content/payment_response_helper_unittest.cc index 23c1a1f5ef9dd4..1ddd77676e0c28 100644 --- a/components/payments/content/payment_response_helper_unittest.cc +++ b/components/payments/content/payment_response_helper_unittest.cc @@ -277,7 +277,7 @@ TEST_F(PaymentResponseHelperTest, mojom::PaymentOptionsPtr options = mojom::PaymentOptions::New(); options->request_payer_phone = true; test_address()->SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("(515) 223-1234")); + u"(515) 223-1234"); RecreateSpecWithOptions(std::move(options)); PaymentResponseHelper helper("en-US", spec(), test_app(), @@ -296,7 +296,7 @@ TEST_F(PaymentResponseHelperTest, mojom::PaymentOptionsPtr options = mojom::PaymentOptions::New(); options->request_payer_phone = true; test_address()->SetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER, - base::UTF8ToUTF16("(515) 123-1234")); + u"(515) 123-1234"); RecreateSpecWithOptions(std::move(options)); PaymentResponseHelper helper("en-US", spec(), test_app(), diff --git a/components/payments/content/secure_payment_confirmation_model_unittest.cc b/components/payments/content/secure_payment_confirmation_model_unittest.cc index 9e8e2d54d3a3a9..0891ec41e7a591 100644 --- a/components/payments/content/secure_payment_confirmation_model_unittest.cc +++ b/components/payments/content/secure_payment_confirmation_model_unittest.cc @@ -18,17 +18,16 @@ class SecurePaymentConfirmationModelTest : public testing::Test {}; TEST_F(SecurePaymentConfirmationModelTest, SmokeTest) { SecurePaymentConfirmationModel model; - std::u16string title( - base::UTF8ToUTF16("Use Touch ID to verify and complete your purchase?")); - std::u16string merchant_label(base::UTF8ToUTF16("Store")); - std::u16string merchant_value(base::UTF8ToUTF16("merchant.com")); - std::u16string instrument_label(base::UTF8ToUTF16("Payment")); - std::u16string instrument_value(base::UTF8ToUTF16("Mastercard ****4444")); + std::u16string title(u"Use Touch ID to verify and complete your purchase?"); + std::u16string merchant_label(u"Store"); + std::u16string merchant_value(u"merchant.com"); + std::u16string instrument_label(u"Payment"); + std::u16string instrument_value(u"Mastercard ****4444"); SkBitmap instrument_icon; - std::u16string total_label(base::UTF8ToUTF16("Total")); - std::u16string total_value(base::UTF8ToUTF16("$20.00 USD")); - std::u16string verify_button_label(base::UTF8ToUTF16("Verify")); - std::u16string cancel_button_label(base::UTF8ToUTF16("Cancel")); + std::u16string total_label(u"Total"); + std::u16string total_value(u"$20.00 USD"); + std::u16string verify_button_label(u"Verify"); + std::u16string cancel_button_label(u"Cancel"); model.set_title(title); EXPECT_EQ(title, model.title()); diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc index 3f12c3661fd960..ff982395d864b9 100644 --- a/components/policy/core/common/policy_map_unittest.cc +++ b/components/policy/core/common/policy_map_unittest.cc @@ -122,9 +122,8 @@ TEST_F(PolicyMapTest, AddMessage_Error) { EXPECT_EQ(std::u16string(), entry1->GetLocalizedMessages( PolicyMap::MessageType::kError, lookup)); map.AddMessage(kTestPolicyName1, PolicyMap::MessageType::kError, 1234); - EXPECT_EQ( - base::UTF8ToUTF16("1234"), - entry1->GetLocalizedMessages(PolicyMap::MessageType::kError, lookup)); + EXPECT_EQ(u"1234", entry1->GetLocalizedMessages( + PolicyMap::MessageType::kError, lookup)); map.AddMessage(kTestPolicyName1, PolicyMap::MessageType::kError, 5678); EXPECT_EQ( base::UTF8ToUTF16("1234\n5678"), @@ -135,8 +134,7 @@ TEST_F(PolicyMapTest, AddMessage_Error) { PolicyMap::Entry* entry2 = map.GetMutable(kTestPolicyName2); // Test adding Error message with placeholder replacement (one arg) map.AddMessage(kTestPolicyName2, PolicyMap::MessageType::kError, - IDS_POLICY_MIGRATED_OLD_POLICY, - {base::UTF8ToUTF16("SomeNewPolicy")}); + IDS_POLICY_MIGRATED_OLD_POLICY, {u"SomeNewPolicy"}); EXPECT_EQ( base::UTF8ToUTF16("1234\n5678"), entry1->GetLocalizedMessages(PolicyMap::MessageType::kError, lookup)); @@ -153,10 +151,9 @@ TEST_F(PolicyMapTest, AddMessage_Error) { "the SomeNewPolicy policy instead."), entry2->GetLocalizedMessages(PolicyMap::MessageType::kError, lookup)); // Test adding Error message with placeholder replacement (two args) - map.AddMessage( - kTestPolicyName1, PolicyMap::MessageType::kError, - IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, - {base::UTF8ToUTF16("SomeSource"), base::UTF8ToUTF16("SomeDestination")}); + map.AddMessage(kTestPolicyName1, PolicyMap::MessageType::kError, + IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, + {u"SomeSource", u"SomeDestination"}); EXPECT_EQ( base::UTF8ToUTF16( "1234\n5678\nSharing from SomeSource to SomeDestination has " @@ -183,9 +180,8 @@ TEST_F(PolicyMapTest, AddMessage_Warning) { EXPECT_EQ(std::u16string(), entry1->GetLocalizedMessages( PolicyMap::MessageType::kWarning, lookup)); entry1->AddMessage(PolicyMap::MessageType::kWarning, 1234); - EXPECT_EQ( - base::UTF8ToUTF16("1234"), - entry1->GetLocalizedMessages(PolicyMap::MessageType::kWarning, lookup)); + EXPECT_EQ(u"1234", entry1->GetLocalizedMessages( + PolicyMap::MessageType::kWarning, lookup)); entry1->AddMessage(PolicyMap::MessageType::kWarning, 5678); EXPECT_EQ( base::UTF8ToUTF16("1234\n5678"), @@ -196,8 +192,7 @@ TEST_F(PolicyMapTest, AddMessage_Warning) { PolicyMap::Entry* entry2 = map.GetMutable(kTestPolicyName2); // Test adding Warning message with placeholder replacement (one arg) entry2->AddMessage(PolicyMap::MessageType::kWarning, - IDS_POLICY_MIGRATED_OLD_POLICY, - {base::UTF8ToUTF16("SomeNewPolicy")}); + IDS_POLICY_MIGRATED_OLD_POLICY, {u"SomeNewPolicy"}); EXPECT_EQ( base::UTF8ToUTF16("1234\n5678"), entry1->GetLocalizedMessages(PolicyMap::MessageType::kWarning, lookup)); @@ -214,10 +209,9 @@ TEST_F(PolicyMapTest, AddMessage_Warning) { "the SomeNewPolicy policy instead."), entry2->GetLocalizedMessages(PolicyMap::MessageType::kWarning, lookup)); // Test adding Warning message with placeholder replacement (two args) - entry1->AddMessage( - PolicyMap::MessageType::kWarning, - IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, - {base::UTF8ToUTF16("SomeSource"), base::UTF8ToUTF16("SomeDestination")}); + entry1->AddMessage(PolicyMap::MessageType::kWarning, + IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, + {u"SomeSource", u"SomeDestination"}); EXPECT_EQ( base::UTF8ToUTF16( "1234\n5678\nSharing from SomeSource to SomeDestination has " @@ -244,9 +238,8 @@ TEST_F(PolicyMapTest, AddMessage_Info) { EXPECT_EQ(std::u16string(), entry1->GetLocalizedMessages( PolicyMap::MessageType::kInfo, lookup)); entry1->AddMessage(PolicyMap::MessageType::kInfo, 1234); - EXPECT_EQ( - base::UTF8ToUTF16("1234"), - entry1->GetLocalizedMessages(PolicyMap::MessageType::kInfo, lookup)); + EXPECT_EQ(u"1234", entry1->GetLocalizedMessages(PolicyMap::MessageType::kInfo, + lookup)); entry1->AddMessage(PolicyMap::MessageType::kInfo, 5678); EXPECT_EQ( base::UTF8ToUTF16("1234\n5678"), @@ -257,8 +250,7 @@ TEST_F(PolicyMapTest, AddMessage_Info) { PolicyMap::Entry* entry2 = map.GetMutable(kTestPolicyName2); // Test adding Info message with placeholder replacement (one arg) entry2->AddMessage(PolicyMap::MessageType::kInfo, - IDS_POLICY_MIGRATED_OLD_POLICY, - {base::UTF8ToUTF16("SomeNewPolicy")}); + IDS_POLICY_MIGRATED_OLD_POLICY, {u"SomeNewPolicy"}); EXPECT_EQ( base::UTF8ToUTF16("1234\n5678"), entry1->GetLocalizedMessages(PolicyMap::MessageType::kInfo, lookup)); @@ -275,10 +267,9 @@ TEST_F(PolicyMapTest, AddMessage_Info) { "the SomeNewPolicy policy instead."), entry2->GetLocalizedMessages(PolicyMap::MessageType::kInfo, lookup)); // Test adding Info message with placeholder replacement (two args) - entry1->AddMessage( - PolicyMap::MessageType::kInfo, - IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, - {base::UTF8ToUTF16("SomeSource"), base::UTF8ToUTF16("SomeDestination")}); + entry1->AddMessage(PolicyMap::MessageType::kInfo, + IDS_POLICY_DLP_CLIPBOARD_BLOCKED_ON_COPY_VM, + {u"SomeSource", u"SomeDestination"}); EXPECT_EQ( base::UTF8ToUTF16( "1234\n5678\nSharing from SomeSource to SomeDestination has " diff --git a/components/query_parser/snippet_unittest.cc b/components/query_parser/snippet_unittest.cc index 0c6e10beea7235..534a4e212cc07d 100644 --- a/components/query_parser/snippet_unittest.cc +++ b/components/query_parser/snippet_unittest.cc @@ -129,10 +129,10 @@ std::u16string BuildSnippet(const std::string& document, for (match = snippet.matches().begin(); match != snippet.matches().end(); ++match) { star_snippet += snippet.text().substr(pos, match->first - pos); - star_snippet += base::UTF8ToUTF16("**"); + star_snippet += u"**"; star_snippet += snippet.text().substr(match->first, match->second - match->first); - star_snippet += base::UTF8ToUTF16("**"); + star_snippet += u"**"; pos = match->second; } star_snippet += snippet.text().substr(pos); diff --git a/components/search_engines/default_search_manager_unittest.cc b/components/search_engines/default_search_manager_unittest.cc index 478cd6324be6ba..09a3555f49e824 100644 --- a/components/search_engines/default_search_manager_unittest.cc +++ b/components/search_engines/default_search_manager_unittest.cc @@ -103,8 +103,8 @@ TEST_F(DefaultSearchManagerTest, ReadAndWritePref) { DefaultSearchManager manager(pref_service(), DefaultSearchManager::ObserverCallback()); TemplateURLData data; - data.SetShortName(base::UTF8ToUTF16("name1")); - data.SetKeyword(base::UTF8ToUTF16("key1")); + data.SetShortName(u"name1"); + data.SetKeyword(u"key1"); data.SetURL("http://foo1/{searchTerms}"); data.suggestions_url = "http://sugg1"; data.alternate_urls.push_back("http://foo1/alt"); diff --git a/components/send_tab_to_self/send_tab_to_self_infobar_delegate.cc b/components/send_tab_to_self/send_tab_to_self_infobar_delegate.cc index f18567b234c185..e4c62b5005445e 100644 --- a/components/send_tab_to_self/send_tab_to_self_infobar_delegate.cc +++ b/components/send_tab_to_self/send_tab_to_self_infobar_delegate.cc @@ -25,7 +25,7 @@ SendTabToSelfInfoBarDelegate::~SendTabToSelfInfoBarDelegate() {} std::u16string SendTabToSelfInfoBarDelegate::GetInfobarMessage() const { // TODO(crbug.com/944602): Define real string. NOTIMPLEMENTED(); - return base::UTF8ToUTF16("Open"); + return u"Open"; } void SendTabToSelfInfoBarDelegate::OpenTab() { diff --git a/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc b/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc index 221e39ee751c56..63ab75328d9185 100644 --- a/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc +++ b/components/spellcheck/renderer/spellcheck_multilingual_unittest.cc @@ -191,7 +191,7 @@ TEST_F(MultilingualSpellCheckTest, MultilingualSpellCheckParagraphBlank) { ExpectSpellCheckParagraphResults( // English, German, Spanish, and a misspelled word. - base::UTF8ToUTF16("rocket Schwarzkommando destruyan pcnyhon"), + u"rocket Schwarzkommando destruyan pcnyhon", std::vector()); } @@ -202,8 +202,7 @@ TEST_F(MultilingualSpellCheckTest, MultilingualSpellCheckParagraphCorrect) { ExpectSpellCheckParagraphResults( // English, German, and Spanish words, all spelled correctly. - base::UTF8ToUTF16("rocket Schwarzkommando destruyan"), - std::vector()); + u"rocket Schwarzkommando destruyan", std::vector()); } // Make sure that all the misspellings in the text are found. @@ -215,7 +214,7 @@ TEST_F(MultilingualSpellCheckTest, MultilingualSpellCheckParagraph) { ExpectSpellCheckParagraphResults( // English, German, Spanish, and a misspelled word. - base::UTF8ToUTF16("rocket Schwarzkommando destruyan pcnyhon"), expected); + u"rocket Schwarzkommando destruyan pcnyhon", expected); } // Ensure that suggestions are handled properly for multiple languages. diff --git a/components/spellcheck/renderer/spellcheck_unittest.cc b/components/spellcheck/renderer/spellcheck_unittest.cc index 7a8a97adeb1034..ac879cae57bc6f 100644 --- a/components/spellcheck/renderer/spellcheck_unittest.cc +++ b/components/spellcheck/renderer/spellcheck_unittest.cc @@ -1029,19 +1029,19 @@ TEST_F(SpellCheckTest, MisspelledWords) { // Make sure SpellCheckParagraph does not crash if the input is empty. TEST_F(SpellCheckTest, SpellCheckParagraphEmptyParagraph) { std::vector expected; - TestSpellCheckParagraph(base::UTF8ToUTF16(""), expected); + TestSpellCheckParagraph(u"", expected); } // A simple test case having no misspellings. TEST_F(SpellCheckTest, SpellCheckParagraphNoMisspellings) { - const std::u16string text = base::UTF8ToUTF16("apple"); + const std::u16string text = u"apple"; std::vector expected; TestSpellCheckParagraph(text, expected); } // A simple test case having one misspelling. TEST_F(SpellCheckTest, SpellCheckParagraphSingleMisspellings) { - const std::u16string text = base::UTF8ToUTF16("zz"); + const std::u16string text = u"zz"; std::vector expected; expected.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 2)); @@ -1051,7 +1051,7 @@ TEST_F(SpellCheckTest, SpellCheckParagraphSingleMisspellings) { // A simple test case having multiple misspellings. TEST_F(SpellCheckTest, SpellCheckParagraphMultipleMisspellings) { - const std::u16string text = base::UTF8ToUTF16("zz, zz"); + const std::u16string text = u"zz, zz"; std::vector expected; expected.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 2)); @@ -1283,18 +1283,18 @@ TEST_F(SpellCheckTest, CreateTextCheckingResultsKeepsTypographicalApostrophe) { std::vector spellcheck_results; // All typewriter apostrophe results. - spellcheck_results.push_back(SpellCheckResult(SpellCheckResult::SPELLING, 0, - 5, base::UTF8ToUTF16("I've"))); - spellcheck_results.push_back(SpellCheckResult( - SpellCheckResult::SPELLING, 6, 6, base::UTF8ToUTF16("haven't"))); - spellcheck_results.push_back(SpellCheckResult( - SpellCheckResult::SPELLING, 13, 10, base::UTF8ToUTF16("in'n'out's"))); + spellcheck_results.push_back( + SpellCheckResult(SpellCheckResult::SPELLING, 0, 5, u"I've")); + spellcheck_results.push_back( + SpellCheckResult(SpellCheckResult::SPELLING, 6, 6, u"haven't")); + spellcheck_results.push_back( + SpellCheckResult(SpellCheckResult::SPELLING, 13, 10, u"in'n'out's")); // Replacements that differ only by apostrophe type should be ignored. - spellcheck_results.push_back(SpellCheckResult(SpellCheckResult::SPELLING, 24, - 4, base::UTF8ToUTF16("I've"))); - spellcheck_results.push_back(SpellCheckResult(SpellCheckResult::SPELLING, 29, - 4, base::UTF8ToUTF16("I've"))); + spellcheck_results.push_back( + SpellCheckResult(SpellCheckResult::SPELLING, 24, 4, u"I've")); + spellcheck_results.push_back( + SpellCheckResult(SpellCheckResult::SPELLING, 29, 4, u"I've")); // All typographical apostrophe results. spellcheck_results.push_back( @@ -1318,31 +1318,26 @@ TEST_F(SpellCheckTest, CreateTextCheckingResultsKeepsTypographicalApostrophe) { // we should ignore this misspelling. spellcheck_results.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 11, - std::vector( - {base::UTF8ToUTF16("Ik've havn'"), u"Ik’ve havn’"}))); + std::vector({u"Ik've havn'", u"Ik’ve havn’"}))); // If we have multiple replacements where some only differ by apostrophe type // and some don't, we should keep this misspelling, but remove the // replacements that only differ by apostrophe type. spellcheck_results.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 0, 5, - std::vector( - {base::UTF8ToUTF16("I've"), base::UTF8ToUTF16("Ive"), u"Ik’ve"}))); + std::vector({u"I've", u"Ive", u"Ik’ve"}))); // Similar to the previous case except with the apostrophe changing from // typographical to straight instead of the other direction spellcheck_results.push_back(SpellCheckResult( SpellCheckResult::SPELLING, 6, 6, - std::vector({base::UTF8ToUTF16("havn't"), - base::UTF8ToUTF16("havnt"), - base::UTF8ToUTF16("haven't")}))); + std::vector({u"havn't", u"havnt", u"haven't"}))); // If we have multiple replacements, none of which differ only by apostrophe // type, we should keep this misspelling. - spellcheck_results.push_back(SpellCheckResult( - SpellCheckResult::SPELLING, 6, 6, - std::vector( - {base::UTF8ToUTF16("have"), base::UTF8ToUTF16("haven't")}))); + spellcheck_results.push_back( + SpellCheckResult(SpellCheckResult::SPELLING, 6, 6, + std::vector({u"have", u"haven't"}))); blink::WebVector textcheck_results; spell_check()->CreateTextCheckingResults(SpellCheck::USE_HUNSPELL_FOR_GRAMMAR, diff --git a/components/spellcheck/renderer/spellcheck_worditerator.h b/components/spellcheck/renderer/spellcheck_worditerator.h index 8f882385e07d63..f8b259e545c16a 100644 --- a/components/spellcheck/renderer/spellcheck_worditerator.h +++ b/components/spellcheck/renderer/spellcheck_worditerator.h @@ -104,7 +104,7 @@ class SpellcheckCharAttribute { // // Set up a SpellcheckWordIterator object which extracts English words, // // and retrieve them. // SpellcheckWordIterator iterator; -// std::u16string text(base::UTF8ToUTF16("this is a test.")); +// std::u16string text(u"this is a test."); // iterator.Initialize(&attribute, true); // iterator.SetText(text.c_str(), text_.length()); // diff --git a/components/spellcheck/renderer/spellcheck_worditerator_unittest.cc b/components/spellcheck/renderer/spellcheck_worditerator_unittest.cc index 937ec0e2efa811..37bc30310fd00a 100644 --- a/components/spellcheck/renderer/spellcheck_worditerator_unittest.cc +++ b/components/spellcheck/renderer/spellcheck_worditerator_unittest.cc @@ -361,25 +361,25 @@ TEST(SpellcheckWordIteratorTest, FindSkippableWordsEnglish) { EXPECT_TRUE(iter.Advance()); // Finds "foo". - EXPECT_EQ(base::UTF8ToUTF16("foo"), iter.GetString()); + EXPECT_EQ(u"foo", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_WORD_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the space and then the Khmer characters. - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); EXPECT_EQ(u"\x1791\x17C1", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); // Finds the next space and "Can". - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("Can"), iter.GetString()); + EXPECT_EQ(u"Can", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_WORD_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the next space and each Russian character. - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); EXPECT_EQ(u"\x041C", iter.GetString()); @@ -389,13 +389,13 @@ TEST(SpellcheckWordIteratorTest, FindSkippableWordsEnglish) { EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); // Finds the periods at the end. - EXPECT_EQ(base::UTF8ToUTF16("."), iter.GetString()); + EXPECT_EQ(u".", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("."), iter.GetString()); + EXPECT_EQ(u".", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("."), iter.GetString()); + EXPECT_EQ(u".", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_FALSE(iter.Advance()); } @@ -411,10 +411,10 @@ TEST(SpellcheckWordIteratorTest, FindSkippableWordsRussian) { EXPECT_TRUE(iter.Advance()); // Finds the period and semicolon. - EXPECT_EQ(base::UTF8ToUTF16("."), iter.GetString()); + EXPECT_EQ(u".", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16(";"), iter.GetString()); + EXPECT_EQ(u";", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); // Finds all the Russian characters. @@ -422,29 +422,29 @@ TEST(SpellcheckWordIteratorTest, FindSkippableWordsRussian) { EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_WORD_BREAK); EXPECT_TRUE(iter.Advance()); // Finds the space and each character in "Can". - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("C"), iter.GetString()); + EXPECT_EQ(u"C", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("a"), iter.GetString()); + EXPECT_EQ(u"a", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("n"), iter.GetString()); + EXPECT_EQ(u"n", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); // Finds the next space, the Khmer characters, and the last two spaces. - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); EXPECT_EQ(u"\x1791\x17C1", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_FALSE(iter.Advance()); } @@ -468,7 +468,7 @@ TEST(SpellcheckWordIteratorTest, FindSkippableWordsKhmer) { EXPECT_EQ(u"\x0438", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); // Finds the first two-character Khmer word. @@ -483,23 +483,23 @@ TEST(SpellcheckWordIteratorTest, FindSkippableWordsKhmer) { EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_WORD_BREAK); EXPECT_TRUE(iter.Advance()); // Finds each character in "zoo". - EXPECT_EQ(base::UTF8ToUTF16("z"), iter.GetString()); + EXPECT_EQ(u"z", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("o"), iter.GetString()); + EXPECT_EQ(u"o", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16("o"), iter.GetString()); + EXPECT_EQ(u"o", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); // Finds the period, space, and comma. - EXPECT_EQ(base::UTF8ToUTF16("."), iter.GetString()); + EXPECT_EQ(u".", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16(" "), iter.GetString()); + EXPECT_EQ(u" ", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_TRUE(iter.Advance()); - EXPECT_EQ(base::UTF8ToUTF16(","), iter.GetString()); + EXPECT_EQ(u",", iter.GetString()); EXPECT_EQ(iter.GetWordBreakStatus(), BreakIterator::IS_SKIPPABLE_WORD); EXPECT_FALSE(iter.Advance()); } diff --git a/components/storage_monitor/storage_info.cc b/components/storage_monitor/storage_info.cc index 2b4f8ae696bb69..5f13c6eb474c35 100644 --- a/components/storage_monitor/storage_info.cc +++ b/components/storage_monitor/storage_info.cc @@ -41,7 +41,7 @@ std::u16string GetFullProductName(const std::u16string& vendor_name, else if (model_name.empty()) product_name = vendor_name; else if (!vendor_name.empty() && !model_name.empty()) - product_name = vendor_name + base::UTF8ToUTF16(", ") + model_name; + product_name = vendor_name + u", " + model_name; return product_name; } diff --git a/components/sync_bookmarks/bookmark_model_merger_unittest.cc b/components/sync_bookmarks/bookmark_model_merger_unittest.cc index c47c301b682da0..a798934d77deb5 100644 --- a/components/sync_bookmarks/bookmark_model_merger_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_merger_unittest.cc @@ -886,8 +886,7 @@ TEST(BookmarkModelMergerTest, ShouldMergeBookmarkByGUIDAndReparent) { const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model->bookmark_bar_node(); const bookmarks::BookmarkNode* folder = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, - base::UTF8ToUTF16("Folder Title")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"Folder Title"); const bookmarks::BookmarkNode* bookmark = bookmark_model->AddURL( /*parent=*/folder, /*index=*/0, base::UTF8ToUTF16(kLocalTitle), GURL(kUrl), /*meta_info=*/nullptr, base::Time::Now(), kGuid); @@ -1074,7 +1073,7 @@ TEST( /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16(kOriginalTitle), /*meta_info=*/nullptr, kGuid1); const bookmarks::BookmarkNode* bookmark = bookmark_model->AddURL( - /*parent=*/folder, /*index=*/0, base::UTF8ToUTF16("Bookmark Title"), + /*parent=*/folder, /*index=*/0, u"Bookmark Title", GURL("http://foo.com/")); ASSERT_TRUE(folder); ASSERT_TRUE(bookmark); @@ -1156,7 +1155,7 @@ TEST(BookmarkModelMergerTest, /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16(kOriginalTitle), /*meta_info=*/nullptr, kGuid1); const bookmarks::BookmarkNode* bookmark = bookmark_model->AddURL( - /*parent=*/folder, /*index=*/0, base::UTF8ToUTF16("Bookmark Title"), + /*parent=*/folder, /*index=*/0, u"Bookmark Title", GURL("http://foo.com/")); ASSERT_TRUE(folder); ASSERT_TRUE(bookmark); @@ -1327,11 +1326,11 @@ TEST(BookmarkModelMergerTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model->bookmark_bar_node(); const bookmarks::BookmarkNode* folder = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, - base::UTF8ToUTF16("Folder Title"), /*meta_info=*/nullptr, kGuid1); + /*parent=*/bookmark_bar_node, /*index=*/0, u"Folder Title", + /*meta_info=*/nullptr, kGuid1); const bookmarks::BookmarkNode* bookmark = bookmark_model->AddURL( - /*parent=*/folder, /*index=*/0, base::UTF8ToUTF16("Foo's title"), - GURL("http://foo.com"), /*meta_info=*/nullptr, base::Time::Now(), kGuid2); + /*parent=*/folder, /*index=*/0, u"Foo's title", GURL("http://foo.com"), + /*meta_info=*/nullptr, base::Time::Now(), kGuid2); ASSERT_TRUE(folder); ASSERT_TRUE(bookmark); ASSERT_THAT(bookmark_bar_node->children(), ElementRawPointersAre(folder)); diff --git a/components/sync_bookmarks/bookmark_model_observer_impl_unittest.cc b/components/sync_bookmarks/bookmark_model_observer_impl_unittest.cc index 3af7b6e9cddd7d..4a9eab7e7ec0df 100644 --- a/components/sync_bookmarks/bookmark_model_observer_impl_unittest.cc +++ b/components/sync_bookmarks/bookmark_model_observer_impl_unittest.cc @@ -289,10 +289,9 @@ TEST_F(BookmarkModelObserverImplTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); const bookmarks::BookmarkNode* folder1_node = bookmark_model()->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("folder1")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"folder1"); const bookmarks::BookmarkNode* bookmark1_node = bookmark_model()->AddURL( - /*parent=*/folder1_node, /*index=*/0, base::UTF8ToUTF16("bookmark1"), - kUrl); + /*parent=*/folder1_node, /*index=*/0, u"bookmark1", kUrl); // Verify number of entities local changes. Should be the same as number of // new nodes. @@ -384,18 +383,15 @@ TEST_F(BookmarkModelObserverImplTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); const bookmarks::BookmarkNode* folder1_node = bookmark_model()->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("folder1")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"folder1"); const bookmarks::BookmarkNode* bookmark1_node = bookmark_model()->AddURL( - /*parent=*/folder1_node, /*index=*/0, base::UTF8ToUTF16("bookmark1"), - kUrl); + /*parent=*/folder1_node, /*index=*/0, u"bookmark1", kUrl); const bookmarks::BookmarkNode* folder2_node = bookmark_model()->AddFolder( - /*parent=*/folder1_node, /*index=*/1, base::UTF8ToUTF16("folder2")); + /*parent=*/folder1_node, /*index=*/1, u"folder2"); const bookmarks::BookmarkNode* bookmark2_node = bookmark_model()->AddURL( - /*parent=*/folder2_node, /*index=*/0, base::UTF8ToUTF16("bookmark2"), - kUrl); + /*parent=*/folder2_node, /*index=*/0, u"bookmark2", kUrl); const bookmarks::BookmarkNode* bookmark3_node = bookmark_model()->AddURL( - /*parent=*/folder2_node, /*index=*/1, base::UTF8ToUTF16("bookmark3"), - kUrl); + /*parent=*/folder2_node, /*index=*/1, u"bookmark3", kUrl); // All bookmarks should be tracked now. ASSERT_THAT(bookmark_tracker()->TrackedEntitiesCountForTest(), 8U); @@ -460,7 +456,7 @@ TEST_F(BookmarkModelObserverImplTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); const bookmarks::BookmarkNode* folder_node = bookmark_model()->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("folder")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"folder"); // Node should be tracked now. ASSERT_THAT(bookmark_tracker()->TrackedEntitiesCountForTest(), 4U); @@ -501,7 +497,7 @@ TEST_F(BookmarkModelObserverImplTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); const bookmarks::BookmarkNode* folder_node = bookmark_model()->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("folder")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"folder"); // Node should be tracked now. ASSERT_THAT(bookmark_tracker()->TrackedEntitiesCountForTest(), 4U); @@ -712,8 +708,7 @@ TEST_F(BookmarkModelObserverImplTest, ShouldNotIssueCommitUponFaviconLoad) { const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); const bookmarks::BookmarkNode* bookmark_node = bookmark_model()->AddURL( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("title"), - kBookmarkUrl); + /*parent=*/bookmark_bar_node, /*index=*/0, u"title", kBookmarkUrl); ASSERT_TRUE( bookmark_client()->SimulateFaviconLoaded(kBookmarkUrl, kIconUrl, kColor)); @@ -758,8 +753,7 @@ TEST_F(BookmarkModelObserverImplTest, ShouldCommitLocalFaviconChange) { const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); const bookmarks::BookmarkNode* bookmark_node = bookmark_model()->AddURL( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("title"), - kBookmarkUrl); + /*parent=*/bookmark_bar_node, /*index=*/0, u"title", kBookmarkUrl); ASSERT_TRUE(bookmark_node->is_favicon_loading()); ASSERT_TRUE(bookmark_client()->SimulateFaviconLoaded( @@ -808,8 +802,7 @@ TEST_F(BookmarkModelObserverImplTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); const bookmarks::BookmarkNode* bookmark_node = bookmark_model()->AddURL( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("title"), - kBookmarkUrl); + /*parent=*/bookmark_bar_node, /*index=*/0, u"title", kBookmarkUrl); sync_pb::EntitySpecifics specifics = CreateSpecificsFromBookmarkNode(bookmark_node, bookmark_model(), @@ -846,8 +839,8 @@ TEST_F(BookmarkModelObserverImplTest, ShouldAddRestoredBookmarkWhenTombstoneCommitMayHaveStarted) { const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); - const bookmarks::BookmarkNode* folder = bookmark_model()->AddFolder( - bookmark_bar_node, 0, base::UTF8ToUTF16("Title")); + const bookmarks::BookmarkNode* folder = + bookmark_model()->AddFolder(bookmark_bar_node, 0, u"Title"); const syncer::ClientTagHash folder_client_tag_hash = SyncedBookmarkTracker::GetClientTagHashFromGUID(folder->guid()); // Check that the bookmark was added by observer. @@ -899,8 +892,7 @@ TEST_F(BookmarkModelObserverImplTest, ShouldCommitOnDeleteFavicon) { const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model()->bookmark_bar_node(); const bookmarks::BookmarkNode* bookmark_node = bookmark_model()->AddURL( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("title"), - kBookmarkUrl); + /*parent=*/bookmark_bar_node, /*index=*/0, u"title", kBookmarkUrl); ASSERT_TRUE(bookmark_node->is_favicon_loading()); ASSERT_TRUE(bookmark_client()->SimulateFaviconLoaded(kBookmarkUrl, kIconUrl, diff --git a/components/sync_bookmarks/bookmark_specifics_conversions_unittest.cc b/components/sync_bookmarks/bookmark_specifics_conversions_unittest.cc index 5bcdbd3e8fc266..276dd7c256275d 100644 --- a/components/sync_bookmarks/bookmark_specifics_conversions_unittest.cc +++ b/components/sync_bookmarks/bookmark_specifics_conversions_unittest.cc @@ -118,7 +118,7 @@ TEST(BookmarkSpecificsConversionsTest, bookmarks::TestBookmarkClient::CreateModel(); const bookmarks::BookmarkNode* bookmark_bar_node = model->bookmark_bar_node(); const bookmarks::BookmarkNode* node = model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("Title")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"Title"); ASSERT_THAT(node, NotNull()); sync_pb::EntitySpecifics specifics = CreateSpecificsFromBookmarkNode( @@ -138,7 +138,7 @@ TEST(BookmarkSpecificsConversionsTest, const bookmarks::BookmarkNode* bookmark_bar_node = model->bookmark_bar_node(); const bookmarks::BookmarkNode* node = model->AddURL( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("Title"), + /*parent=*/bookmark_bar_node, /*index=*/0, u"Title", GURL("http://www.url.com")); ASSERT_THAT(node, NotNull()); ASSERT_FALSE(node->is_favicon_loaded()); @@ -159,7 +159,7 @@ TEST(BookmarkSpecificsConversionsTest, const bookmarks::BookmarkNode* bookmark_bar_node = model->bookmark_bar_node(); const bookmarks::BookmarkNode* node = model->AddURL( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("Title"), + /*parent=*/bookmark_bar_node, /*index=*/0, u"Title", GURL("http://www.url.com")); ASSERT_THAT(node, NotNull()); ASSERT_FALSE(node->is_favicon_loaded()); diff --git a/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc b/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc index 4d7474f44a7826..831cb7de3d148f 100644 --- a/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc +++ b/components/sync_bookmarks/synced_bookmark_tracker_unittest.cc @@ -368,9 +368,9 @@ TEST(SyncedBookmarkTrackerTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model->bookmark_bar_node(); const bookmarks::BookmarkNode* node0 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node0"); const bookmarks::BookmarkNode* node1 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node1")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node1"); sync_pb::BookmarkModelMetadata initial_model_metadata = CreateMetadataForPermanentNodes(bookmark_model.get()); @@ -426,15 +426,15 @@ TEST(SyncedBookmarkTrackerTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model->bookmark_bar_node(); const bookmarks::BookmarkNode* node0 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node0"); const bookmarks::BookmarkNode* node1 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node1")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node1"); const bookmarks::BookmarkNode* node2 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node2")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node2"); const bookmarks::BookmarkNode* node3 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node3")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node3"); const bookmarks::BookmarkNode* node4 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node4")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node4"); sync_pb::BookmarkModelMetadata initial_model_metadata = CreateMetadataForPermanentNodes(bookmark_model.get()); @@ -584,11 +584,11 @@ TEST(SyncedBookmarkTrackerTest, const bookmarks::BookmarkNode* bookmark_bar_node = bookmark_model->bookmark_bar_node(); const bookmarks::BookmarkNode* node0 = bookmark_model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node0"); const bookmarks::BookmarkNode* node1 = bookmark_model->AddFolder( - /*parent=*/node0, /*index=*/0, base::UTF8ToUTF16("node1")); + /*parent=*/node0, /*index=*/0, u"node1"); const bookmarks::BookmarkNode* node2 = bookmark_model->AddFolder( - /*parent=*/node1, /*index=*/0, base::UTF8ToUTF16("node2")); + /*parent=*/node1, /*index=*/0, u"node2"); // Server ids. const std::string kId0 = "id0"; @@ -640,7 +640,7 @@ TEST(SyncedBookmarkTrackerTest, ShouldNotInvalidateMetadata) { const bookmarks::BookmarkNode* bookmark_bar_node = model->bookmark_bar_node(); const bookmarks::BookmarkNode* node = model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node0"); sync_pb::BookmarkModelMetadata model_metadata = CreateMetadataForPermanentNodes(model.get()); @@ -747,8 +747,7 @@ TEST(SyncedBookmarkTrackerTest, CreateMetadataForPermanentNodes(model.get()); const bookmarks::BookmarkNode* node = model->AddFolder( - /*parent=*/model->bookmark_bar_node(), /*index=*/0, - base::UTF8ToUTF16("node")); + /*parent=*/model->bookmark_bar_node(), /*index=*/0, u"node"); *model_metadata.add_bookmarks_metadata() = CreateNodeMetadata(node, /*server_id=*/"serverid"); @@ -802,8 +801,7 @@ TEST(SyncedBookmarkTrackerTest, CreateMetadataForPermanentNodes(model.get()); const bookmarks::BookmarkNode* node = model->AddFolder( - /*parent=*/model->bookmark_bar_node(), /*index=*/0, - base::UTF8ToUTF16("node")); + /*parent=*/model->bookmark_bar_node(), /*index=*/0, u"node"); *model_metadata.add_bookmarks_metadata() = CreateNodeMetadata(node, /*server_id=*/"serverid"); @@ -828,7 +826,7 @@ TEST(SyncedBookmarkTrackerTest, ShouldInvalidateMetadataIfGuidMismatch) { const bookmarks::BookmarkNode* bookmark_bar_node = model->bookmark_bar_node(); const bookmarks::BookmarkNode* node0 = model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node0"); sync_pb::BookmarkModelMetadata model_metadata = CreateMetadataForPermanentNodes(model.get()); @@ -857,7 +855,7 @@ TEST(SyncedBookmarkTrackerTest, const bookmarks::BookmarkNode* bookmark_bar_node = model->bookmark_bar_node(); const bookmarks::BookmarkNode* node0 = model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node0"); sync_pb::BookmarkModelMetadata model_metadata = CreateMetadataForPermanentNodes(model.get()); @@ -899,7 +897,7 @@ TEST(SyncedBookmarkTrackerTest, const bookmarks::BookmarkNode* bookmark_bar_node = model->bookmark_bar_node(); const bookmarks::BookmarkNode* node0 = model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node0"); sync_pb::BookmarkModelMetadata model_metadata = CreateMetadataForPermanentNodes(model.get()); @@ -931,7 +929,7 @@ TEST(SyncedBookmarkTrackerTest, const bookmarks::BookmarkNode* bookmark_bar_node = model->bookmark_bar_node(); const bookmarks::BookmarkNode* node0 = model->AddFolder( - /*parent=*/bookmark_bar_node, /*index=*/0, base::UTF8ToUTF16("node0")); + /*parent=*/bookmark_bar_node, /*index=*/0, u"node0"); sync_pb::BookmarkModelMetadata model_metadata = CreateMetadataForPermanentNodes(model.get()); diff --git a/components/sync_sessions/open_tabs_ui_delegate_impl_unittest.cc b/components/sync_sessions/open_tabs_ui_delegate_impl_unittest.cc index c4d494bd81e745..97092fd1fe96c0 100644 --- a/components/sync_sessions/open_tabs_ui_delegate_impl_unittest.cc +++ b/components/sync_sessions/open_tabs_ui_delegate_impl_unittest.cc @@ -58,7 +58,7 @@ TEST_F(OpenTabsUIDelegateImplTest, ShouldSortSessions) { sessions::SerializedNavigationEntry entry1 = sessions::SerializedNavigationEntryTestHelper::CreateNavigationForTest(); entry1.set_virtual_url(GURL("http://url1")); - entry1.set_title(base::UTF8ToUTF16("title1")); + entry1.set_title(u"title1"); session_tracker_.GetTab(kSessionTag1, kTabId1)->navigations.push_back(entry1); session_tracker_.GetSession(kSessionTag1)->modified_time = kTime0 + base::TimeDelta::FromSeconds(3); @@ -68,7 +68,7 @@ TEST_F(OpenTabsUIDelegateImplTest, ShouldSortSessions) { sessions::SerializedNavigationEntry entry2 = sessions::SerializedNavigationEntryTestHelper::CreateNavigationForTest(); entry2.set_virtual_url(GURL("http://url2")); - entry2.set_title(base::UTF8ToUTF16("title2")); + entry2.set_title(u"title2"); session_tracker_.GetTab(kSessionTag2, kTabId2)->navigations.push_back(entry2); session_tracker_.GetSession(kSessionTag2)->modified_time = kTime0 + base::TimeDelta::FromSeconds(1); @@ -78,7 +78,7 @@ TEST_F(OpenTabsUIDelegateImplTest, ShouldSortSessions) { sessions::SerializedNavigationEntry entry3 = sessions::SerializedNavigationEntryTestHelper::CreateNavigationForTest(); entry3.set_virtual_url(GURL("http://url3")); - entry3.set_title(base::UTF8ToUTF16("title3")); + entry3.set_title(u"title3"); session_tracker_.GetTab(kSessionTag3, kTabId3)->navigations.push_back(entry3); session_tracker_.GetSession(kSessionTag3)->modified_time = kTime0 + base::TimeDelta::FromSeconds(2); @@ -154,7 +154,7 @@ TEST_F(OpenTabsUIDelegateImplTest, ShouldSkipNonSyncableTabs) { sessions::SerializedNavigationEntry nonsyncable_entry = sessions::SerializedNavigationEntryTestHelper::CreateNavigationForTest(); nonsyncable_entry.set_virtual_url(GURL("http://url1")); - nonsyncable_entry.set_title(base::UTF8ToUTF16("title1")); + nonsyncable_entry.set_title(u"title1"); session_tracker_.PutWindowInSession(kSessionTag1, kWindowId1); session_tracker_.PutTabInWindow(kSessionTag1, kWindowId1, kTabId1); session_tracker_.GetTab(kSessionTag1, kTabId1) @@ -163,7 +163,7 @@ TEST_F(OpenTabsUIDelegateImplTest, ShouldSkipNonSyncableTabs) { sessions::SerializedNavigationEntry syncable_entry = sessions::SerializedNavigationEntryTestHelper::CreateNavigationForTest(); syncable_entry.set_virtual_url(GURL("http://otherurl")); - syncable_entry.set_title(base::UTF8ToUTF16("title1")); + syncable_entry.set_title(u"title1"); session_tracker_.PutWindowInSession(kSessionTag2, kWindowId2); session_tracker_.PutTabInWindow(kSessionTag2, kWindowId2, kTabId2); session_tracker_.GetTab(kSessionTag2, kTabId2) diff --git a/components/translate/content/android/translate_utils_unittest.cc b/components/translate/content/android/translate_utils_unittest.cc index 97d20f4615d581..48f9ce90030a50 100644 --- a/components/translate/content/android/translate_utils_unittest.cc +++ b/components/translate/content/android/translate_utils_unittest.cc @@ -74,12 +74,9 @@ TEST_F(TranslateUtilsTest, GetJavaContentLangaugesEmpty) { // names). TEST_F(TranslateUtilsTest, GetJavaLangauges) { std::vector> translate_languages = { - {"en", base::UTF8ToUTF16("English")}, - {"de", base::UTF8ToUTF16("German")}, - {"pl", base::UTF8ToUTF16("Polish")}}; - std::vector expectedLanguageNames = { - base::UTF8ToUTF16("English"), base::UTF8ToUTF16("German"), - base::UTF8ToUTF16("Polish")}; + {"en", u"English"}, {"de", u"German"}, {"pl", u"Polish"}}; + std::vector expectedLanguageNames = {u"English", u"German", + u"Polish"}; std::vector expectedHashCodes = {metrics::MetricsLog::Hash("en"), metrics::MetricsLog::Hash("de"), metrics::MetricsLog::Hash("pl")}; diff --git a/components/translate/ios/browser/js_translate_manager.mm b/components/translate/ios/browser/js_translate_manager.mm index ae67273184b6aa..eef6c9088eb51a 100644 --- a/components/translate/ios/browser/js_translate_manager.mm +++ b/components/translate/ios/browser/js_translate_manager.mm @@ -90,8 +90,7 @@ - (void)revertTranslation { if (!_injected) return; - _web_state->ExecuteJavaScript( - base::UTF8ToUTF16("cr.googleTranslate.revert()")); + _web_state->ExecuteJavaScript(u"cr.googleTranslate.revert()"); } - (void)handleTranslateResponseWithURL:(const std::string&)URL diff --git a/components/translate/ios/browser/string_clipping_util_unittest.cc b/components/translate/ios/browser/string_clipping_util_unittest.cc index 65818472f156a9..58dfa7d7bb2b53 100644 --- a/components/translate/ios/browser/string_clipping_util_unittest.cc +++ b/components/translate/ios/browser/string_clipping_util_unittest.cc @@ -21,7 +21,7 @@ TEST(StringByClippingLastWordTest, ClipLongSentence) { // An arbitrary length. const size_t kStringLength = 10; std::u16string string(kStringLength, 'a'); - string.append(base::UTF8ToUTF16(" b cdefghijklmnopqrstuvwxyz")); + string.append(u" b cdefghijklmnopqrstuvwxyz"); // The string should be cut at the last whitespace, after the 'b' character. std::u16string result = GetStringByClippingLastWord(string, kStringLength + 3); diff --git a/components/url_formatter/elide_url.cc b/components/url_formatter/elide_url.cc index 171f5faaf77fc2..89be5e7c6d212b 100644 --- a/components/url_formatter/elide_url.cc +++ b/components/url_formatter/elide_url.cc @@ -120,7 +120,7 @@ void SplitHost(const GURL& url, // Get sub domain. const size_t domain_start_index = url_host->find(*url_domain); - std::u16string kWwwPrefix = base::UTF8ToUTF16("www."); + std::u16string kWwwPrefix = u"www."; if (domain_start_index != std::u16string::npos) *url_subdomain = url_host->substr(0, domain_start_index); if ((*url_subdomain == kWwwPrefix || url_subdomain->empty() || @@ -252,7 +252,7 @@ std::u16string ElideUrl(const GURL& url, const float kPixelWidthDotsTrailer = gfx::GetStringWidthF(std::u16string(gfx::kEllipsisUTF16), font_list); if (parsed.query.is_nonempty()) { - url_query = base::UTF8ToUTF16("?") + url_string.substr(parsed.query.begin); + url_query = u"?" + url_string.substr(parsed.query.begin); if (available_pixel_width >= (pixel_width_url_subdomain + pixel_width_url_domain + pixel_width_url_path - gfx::GetStringWidthF(url_query, font_list))) { diff --git a/components/url_formatter/spoof_checks/top_domains/make_top_domain_skeletons.cc b/components/url_formatter/spoof_checks/top_domains/make_top_domain_skeletons.cc index 944faef9289a5b..b106051395eed8 100644 --- a/components/url_formatter/spoof_checks/top_domains/make_top_domain_skeletons.cc +++ b/components/url_formatter/spoof_checks/top_domains/make_top_domain_skeletons.cc @@ -84,7 +84,7 @@ int GenerateSkeletons(const char* input_file_name, // These characters are used to separate labels in a hostname. We generate // skeletons of top 500 domains without these separators as well. These // skeletons could be used in lookalike heuristics such as Target Embedding. - std::u16string kLabelSeparators = base::UTF8ToUTF16(".-"); + std::u16string kLabelSeparators = u".-"; std::stringstream input(input_content); std::string output = R"(# Copyright 2018 The Chromium Authors. All rights reserved. diff --git a/components/user_manager/user_info_impl.cc b/components/user_manager/user_info_impl.cc index 81517d37fd0b54..7f48169b087f58 100644 --- a/components/user_manager/user_info_impl.cc +++ b/components/user_manager/user_info_impl.cc @@ -16,11 +16,11 @@ UserInfoImpl::~UserInfoImpl() { } std::u16string UserInfoImpl::GetDisplayName() const { - return base::UTF8ToUTF16("stub-user"); + return u"stub-user"; } std::u16string UserInfoImpl::GetGivenName() const { - return base::UTF8ToUTF16("Stub"); + return u"Stub"; } std::string UserInfoImpl::GetDisplayEmail() const { diff --git a/content/browser/accessibility/browser_accessibility_mac_unittest.mm b/content/browser/accessibility/browser_accessibility_mac_unittest.mm index 482ea5b81eadaf..df218bca51fb18 100644 --- a/content/browser/accessibility/browser_accessibility_mac_unittest.mm +++ b/content/browser/accessibility/browser_accessibility_mac_unittest.mm @@ -184,44 +184,44 @@ void SetRootValue(std::string value) { SetRootValue("text"); AXTextEdit text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("text"), text_edit.inserted_text); + EXPECT_EQ(u"text", text_edit.inserted_text); EXPECT_TRUE(text_edit.deleted_text.empty()); SetRootValue("new text"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("new "), text_edit.inserted_text); + EXPECT_EQ(u"new ", text_edit.inserted_text); EXPECT_TRUE(text_edit.deleted_text.empty()); SetRootValue("new text hello"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16(" hello"), text_edit.inserted_text); + EXPECT_EQ(u" hello", text_edit.inserted_text); EXPECT_TRUE(text_edit.deleted_text.empty()); SetRootValue("newer text hello"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("er"), text_edit.inserted_text); + EXPECT_EQ(u"er", text_edit.inserted_text); EXPECT_TRUE(text_edit.deleted_text.empty()); // Deletion but no insertion. SetRootValue("new text hello"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("er"), text_edit.deleted_text); + EXPECT_EQ(u"er", text_edit.deleted_text); EXPECT_TRUE(text_edit.inserted_text.empty()); SetRootValue("new text"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16(" hello"), text_edit.deleted_text); + EXPECT_EQ(u" hello", text_edit.deleted_text); EXPECT_TRUE(text_edit.inserted_text.empty()); SetRootValue("text"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("new "), text_edit.deleted_text); + EXPECT_EQ(u"new ", text_edit.deleted_text); EXPECT_TRUE(text_edit.inserted_text.empty()); SetRootValue(""); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("text"), text_edit.deleted_text); + EXPECT_EQ(u"text", text_edit.deleted_text); EXPECT_TRUE(text_edit.inserted_text.empty()); // Both insertion and deletion. @@ -230,18 +230,18 @@ void SetRootValue(std::string value) { text_edit = [accessibility_ computeTextEdit]; SetRootValue("new word hello"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("text"), text_edit.deleted_text); - EXPECT_EQ(base::UTF8ToUTF16("word"), text_edit.inserted_text); + EXPECT_EQ(u"text", text_edit.deleted_text); + EXPECT_EQ(u"word", text_edit.inserted_text); SetRootValue("new word there"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("hello"), text_edit.deleted_text); - EXPECT_EQ(base::UTF8ToUTF16("there"), text_edit.inserted_text); + EXPECT_EQ(u"hello", text_edit.deleted_text); + EXPECT_EQ(u"there", text_edit.inserted_text); SetRootValue("old word there"); text_edit = [accessibility_ computeTextEdit]; - EXPECT_EQ(base::UTF8ToUTF16("new"), text_edit.deleted_text); - EXPECT_EQ(base::UTF8ToUTF16("old"), text_edit.inserted_text); + EXPECT_EQ(u"new", text_edit.deleted_text); + EXPECT_EQ(u"old", text_edit.inserted_text); } // Test Mac-specific table APIs. diff --git a/content/browser/accessibility/browser_accessibility_win_unittest.cc b/content/browser/accessibility/browser_accessibility_win_unittest.cc index 5d58d22a2ca27c..de3fc7cca6f4f5 100644 --- a/content/browser/accessibility/browser_accessibility_win_unittest.cc +++ b/content/browser/accessibility/browser_accessibility_win_unittest.cc @@ -2961,21 +2961,16 @@ TEST_F(BrowserAccessibilityWinTest, TestInheritedStringAttributes) { ASSERT_NE(nullptr, child2_child2_accessible); // Test GetInheritedString16Attribute(attribute). - EXPECT_EQ(base::UTF8ToUTF16("en-US"), - root_accessible->GetInheritedString16Attribute( - ax::mojom::StringAttribute::kLanguage)); - EXPECT_EQ(base::UTF8ToUTF16("en-US"), - child1_accessible->GetInheritedString16Attribute( - ax::mojom::StringAttribute::kLanguage)); - EXPECT_EQ(base::UTF8ToUTF16("fr"), - child2_accessible->GetInheritedString16Attribute( - ax::mojom::StringAttribute::kLanguage)); - EXPECT_EQ(base::UTF8ToUTF16("fr"), - child2_child1_accessible->GetInheritedString16Attribute( - ax::mojom::StringAttribute::kLanguage)); - EXPECT_EQ(base::UTF8ToUTF16("fr"), - child2_child2_accessible->GetInheritedString16Attribute( - ax::mojom::StringAttribute::kLanguage)); + EXPECT_EQ(u"en-US", root_accessible->GetInheritedString16Attribute( + ax::mojom::StringAttribute::kLanguage)); + EXPECT_EQ(u"en-US", child1_accessible->GetInheritedString16Attribute( + ax::mojom::StringAttribute::kLanguage)); + EXPECT_EQ(u"fr", child2_accessible->GetInheritedString16Attribute( + ax::mojom::StringAttribute::kLanguage)); + EXPECT_EQ(u"fr", child2_child1_accessible->GetInheritedString16Attribute( + ax::mojom::StringAttribute::kLanguage)); + EXPECT_EQ(u"fr", child2_child2_accessible->GetInheritedString16Attribute( + ax::mojom::StringAttribute::kLanguage)); // Test GetInheritedStringAttribute(attribute). EXPECT_EQ("Helvetica", root_accessible->GetInheritedStringAttribute( diff --git a/content/browser/back_forward_cache_browsertest.cc b/content/browser/back_forward_cache_browsertest.cc index 6ef74ca0c4a61e..6c5929fb3882a3 100644 --- a/content/browser/back_forward_cache_browsertest.cc +++ b/content/browser/back_forward_cache_browsertest.cc @@ -1788,7 +1788,7 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, " document.title = 'unloaded!';" "});")); { - std::u16string title_when_loaded = base::UTF8ToUTF16("loaded!"); + std::u16string title_when_loaded = u"loaded!"; TitleWatcher title_watcher(web_contents(), title_when_loaded); EXPECT_EQ(title_watcher.WaitAndGetTitle(), title_when_loaded); } @@ -1809,7 +1809,7 @@ IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, EXPECT_EQ(rfh_a, current_frame_host()); EXPECT_TRUE(rfh_b->IsInBackForwardCache()); { - std::u16string title_when_loaded = base::UTF8ToUTF16("loaded!"); + std::u16string title_when_loaded = u"loaded!"; TitleWatcher title_watcher(web_contents(), title_when_loaded); EXPECT_EQ(title_watcher.WaitAndGetTitle(), title_when_loaded); } diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index 3c3fcebab8d922..8fa1d535a75448 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -3742,7 +3742,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, origin_one.StartAcceptingConnections(); origin_two.StartAcceptingConnections(); - std::u16string expected_title(base::UTF8ToUTF16("hello")); + std::u16string expected_title(u"hello"); TitleWatcher observer(shell()->web_contents(), expected_title); EXPECT_TRUE( NavigateToURL(shell(), referrer_url, diff --git a/content/browser/file_system_access/file_system_chooser_unittest.cc b/content/browser/file_system_access/file_system_chooser_unittest.cc index 3bafd4e45eec71..82febc097f5083 100644 --- a/content/browser/file_system_access/file_system_chooser_unittest.cc +++ b/content/browser/file_system_access/file_system_chooser_unittest.cc @@ -260,7 +260,7 @@ TEST_F(FileSystemChooserTest, DescriptionSanitization) { ASSERT_TRUE(dialog_params.file_types); ASSERT_EQ(4u, dialog_params.file_types->extension_description_overrides.size()); - EXPECT_EQ(base::UTF8ToUTF16("Description with a lot of spaces"), + EXPECT_EQ(u"Description with a lot of spaces", dialog_params.file_types->extension_description_overrides[0]); EXPECT_EQ( base::UTF8ToUTF16( diff --git a/content/browser/loader/reload_cache_control_browsertest.cc b/content/browser/loader/reload_cache_control_browsertest.cc index 5907b4efc99fc7..d8ae5c5b4c47ea 100644 --- a/content/browser/loader/reload_cache_control_browsertest.cc +++ b/content/browser/loader/reload_cache_control_browsertest.cc @@ -186,13 +186,13 @@ IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, // Open a page served by the service worker. EXPECT_TRUE(NavigateToURL( shell(), embedded_test_server()->GetURL("/service_worker/empty.html"))); - EXPECT_EQ(base::UTF8ToUTF16("Title"), shell()->web_contents()->GetTitle()); + EXPECT_EQ(u"Title", shell()->web_contents()->GetTitle()); // Reload from the browser. The page is still controlled by the service // worker. ReloadBlockUntilNavigationsComplete(shell(), 1); EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); - EXPECT_EQ(base::UTF8ToUTF16("Title"), shell()->web_contents()->GetTitle()); + EXPECT_EQ(u"Title", shell()->web_contents()->GetTitle()); } // Reloading with ReloadType::BYPASSING_CACHE should bypass service workers. @@ -207,12 +207,12 @@ IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, // Open a page served by the service worker. EXPECT_TRUE(NavigateToURL( shell(), embedded_test_server()->GetURL("/service_worker/empty.html"))); - EXPECT_EQ(base::UTF8ToUTF16("Title"), shell()->web_contents()->GetTitle()); + EXPECT_EQ(u"Title", shell()->web_contents()->GetTitle()); // Reload from the browser with pressing shift key. It bypasses the service // worker. ReloadBypassingCacheBlockUntilNavigationsComplete(shell(), 1); - EXPECT_EQ(base::UTF8ToUTF16("ServiceWorker test - empty page"), + EXPECT_EQ(u"ServiceWorker test - empty page", shell()->web_contents()->GetTitle()); } diff --git a/content/browser/network_service_instance_impl.cc b/content/browser/network_service_instance_impl.cc index 38c6b28be2af04..7485a8cd30b45c 100644 --- a/content/browser/network_service_instance_impl.cc +++ b/content/browser/network_service_instance_impl.cc @@ -329,11 +329,10 @@ network::mojom::NetworkService* GetNetworkService() { } else { if (service_was_bound) LOG(ERROR) << "Network service crashed, restarting service."; - ServiceProcessHost::Launch( - std::move(receiver), - ServiceProcessHost::Options() - .WithDisplayName(base::UTF8ToUTF16("Network Service")) - .Pass()); + ServiceProcessHost::Launch(std::move(receiver), + ServiceProcessHost::Options() + .WithDisplayName(u"Network Service") + .Pass()); } } else { // This should only be reached in unit tests. diff --git a/content/browser/notifications/notification_database_unittest.cc b/content/browser/notifications/notification_database_unittest.cc index 7b7fd1a1937efa..c1451a4d53e1aa 100644 --- a/content/browser/notifications/notification_database_unittest.cc +++ b/content/browser/notifications/notification_database_unittest.cc @@ -255,7 +255,7 @@ TEST_F(NotificationDatabaseTest, ReadNotificationDataDifferentOrigin) { NotificationDatabaseData database_data, read_database_data; database_data.notification_id = GenerateNotificationId(); - database_data.notification_data.title = base::UTF8ToUTF16("My Notification"); + database_data.notification_data.title = u"My Notification"; ASSERT_EQ(NotificationDatabase::STATUS_OK, database->WriteNotificationData(origin, database_data)); @@ -285,11 +285,11 @@ TEST_F(NotificationDatabaseTest, ReadNotificationDataReflection) { GURL origin("https://example.com"); blink::PlatformNotificationData notification_data; - notification_data.title = base::UTF8ToUTF16("My Notification"); + notification_data.title = u"My Notification"; notification_data.direction = blink::mojom::NotificationDirection::RIGHT_TO_LEFT; notification_data.lang = "nl-NL"; - notification_data.body = base::UTF8ToUTF16("Hello, world!"); + notification_data.body = u"Hello, world!"; notification_data.tag = "replace id"; notification_data.icon = GURL("https://example.com/icon.png"); notification_data.silent = true; @@ -355,7 +355,7 @@ TEST_F(NotificationDatabaseTest, ReadNotificationResourcesDifferentOrigin) { NotificationDatabaseData database_data; blink::NotificationResources database_resources; database_data.notification_id = GenerateNotificationId(); - database_data.notification_data.title = base::UTF8ToUTF16("My Notification"); + database_data.notification_data.title = u"My Notification"; database_data.notification_resources = blink::NotificationResources(); ASSERT_EQ(NotificationDatabase::STATUS_OK, @@ -465,7 +465,7 @@ TEST_F(NotificationDatabaseTest, ReadNotificationUpdateInteraction) { NotificationDatabaseData database_data, read_database_data; database_data.notification_id = GenerateNotificationId(); - database_data.notification_data.title = base::UTF8ToUTF16("My Notification"); + database_data.notification_data.title = u"My Notification"; ASSERT_EQ(NotificationDatabase::STATUS_OK, database->WriteNotificationData(origin, database_data)); diff --git a/content/browser/renderer_host/data_transfer_util.cc b/content/browser/renderer_host/data_transfer_util.cc index c1da59c02c0852..6775ec715bf6ac 100644 --- a/content/browser/renderer_host/data_transfer_util.cc +++ b/content/browser/renderer_host/data_transfer_util.cc @@ -155,7 +155,7 @@ blink::mojom::DragDataPtr DropMetaDataToDragData( // will contain an empty URL (which means no URL is dragged) if the URL in // WebDragData is empty. if (base::EqualsASCII(meta_data_item.mime_type, ui::kMimeTypeURIList)) { - item->string_data = base::UTF8ToUTF16("about:dragdrop-placeholder"); + item->string_data = u"about:dragdrop-placeholder"; } items.push_back(blink::mojom::DragItem::NewString(std::move(item))); continue; diff --git a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc index d5a9dcc33bb9a3..632c8ab82dbc35 100644 --- a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc @@ -9887,7 +9887,7 @@ IN_PROC_BROWSER_TEST_P(NavigationControllerBrowserTest, ReloadDoesntKeepTitle) { "/navigation_controller/simple_page_1.html")); GURL intermediate_url(embedded_test_server()->GetURL( "/navigation_controller/simple_page_2.html")); - std::u16string title = base::UTF8ToUTF16("title"); + std::u16string title = u"title"; // Reload from the browser side. { diff --git a/content/browser/renderer_host/render_frame_proxy_host.cc b/content/browser/renderer_host/render_frame_proxy_host.cc index 5011974dd09146..cdf53d64960baf 100644 --- a/content/browser/renderer_host/render_frame_proxy_host.cc +++ b/content/browser/renderer_host/render_frame_proxy_host.cc @@ -561,7 +561,7 @@ void RenderFrameProxyHost::RouteMessageEvent( // TODO(lukasza): Move opaque-ness check into ChildProcessSecurityPolicyImpl. auto* policy = ChildProcessSecurityPolicyImpl::GetInstance(); - if (source_origin != base::UTF8ToUTF16("null") && + if (source_origin != u"null" && !policy->CanAccessDataForOrigin( GetProcess()->GetID(), url::Origin::Create(GURL(source_origin)))) { bad_message::ReceivedBadMessage( diff --git a/content/browser/renderer_host/render_widget_host_browsertest.cc b/content/browser/renderer_host/render_widget_host_browsertest.cc index 7573d08c1a66ee..cc1717233ff4b6 100644 --- a/content/browser/renderer_host/render_widget_host_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_browsertest.cc @@ -631,8 +631,7 @@ IN_PROC_BROWSER_TEST_F(RenderWidgetHostSitePerProcessTest, } // Ensure the renderer didn't explode :). { - std::u16string title_when_done[] = {base::UTF8ToUTF16("done 0"), - base::UTF8ToUTF16("done 1")}; + std::u16string title_when_done[] = {u"done 0", u"done 1"}; TitleWatcher title_watcher(shell()->web_contents(), title_when_done[i]); EXPECT_TRUE(ExecuteScript(root_frame_host, JsReplace("document.title='done $1'", i))); diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 61532ad4869ff3..6c9cef9ce54aa1 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc @@ -6067,7 +6067,7 @@ TEST_F(InputMethodResultAuraTest, FinishComposingText) { TEST_F(InputMethodResultAuraTest, CommitText) { base::RepeatingClosure ime_call = base::BindRepeating( &ui::TextInputClient::InsertText, base::Unretained(text_input_client()), - base::UTF8ToUTF16("hello"), + u"hello", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); for (auto index : active_view_sequence_) { ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT); @@ -6083,7 +6083,7 @@ TEST_F(InputMethodResultAuraTest, CommitText) { TEST_F(InputMethodResultAuraTest, CommitTextBeforeCursor) { base::RepeatingClosure ime_call = base::BindRepeating( &ui::TextInputClient::InsertText, base::Unretained(text_input_client()), - base::UTF8ToUTF16("hello"), + u"hello", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorBeforeText); for (auto index : active_view_sequence_) { ActivateViewForTextInputManager(views_[index], ui::TEXT_INPUT_TYPE_TEXT); diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm index 650aa00f159e02..ac421e68c8252a 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm @@ -579,8 +579,7 @@ void ActivateViewWithTextInputManager(RenderWidgetHostViewBase* view, TEST_F(RenderWidgetHostViewMacTest, NSTextInputClientConformance) { EXPECT_NSEQ(NSMakeRange(0, 0), [rwhv_cocoa_ selectedRange]); - rwhv_mac_->SelectionChanged(base::UTF8ToUTF16("llo, world!"), 2, - gfx::Range(5, 10)); + rwhv_mac_->SelectionChanged(u"llo, world!", 2, gfx::Range(5, 10)); EXPECT_NSEQ(NSMakeRange(5, 5), [rwhv_cocoa_ selectedRange]); NSRange actualRange = NSMakeRange(1u, 2u); @@ -649,7 +648,7 @@ void ActivateViewWithTextInputManager(RenderWidgetHostViewBase* view, } TEST_F(RenderWidgetHostViewMacTest, GetFirstRectForCharacterRangeCaretCase) { - const std::u16string kDummyString = base::UTF8ToUTF16("hogehoge"); + const std::u16string kDummyString = u"hogehoge"; const size_t kDummyOffset = 0; gfx::Rect caret_rect(10, 11, 0, 10); @@ -2092,7 +2091,7 @@ void SetTextInputType(RenderWidgetHostViewBase* view, [FakeTextCheckingResult resultWithRange:NSMakeRange(0, 3) replacementString:@"foo"]; - const std::u16string kOriginalString = base::UTF8ToUTF16("abcxxxghi"); + const std::u16string kOriginalString = u"abcxxxghi"; // Change the selection once; requests completions from the spell checker. tab_view()->SelectionChanged(kOriginalString, 3, gfx::Range(3, 3)); @@ -2148,7 +2147,7 @@ void SetTextInputType(RenderWidgetHostViewBase* view, EXPECT_NSNE(nil, candidate_list_item()); candidate_list_item().allowsCollapsing = NO; - const std::u16string kOriginalString = base::UTF8ToUTF16("abcxxxghi"); + const std::u16string kOriginalString = u"abcxxxghi"; // Change the selection once; completions should *not* be requested. tab_view()->SelectionChanged(kOriginalString, 3, gfx::Range(3, 3)); @@ -2180,7 +2179,7 @@ void SetTextInputType(RenderWidgetHostViewBase* view, [FakeTextCheckingResult resultWithRange:NSMakeRange(0, 3) replacementString:@"foo"]; - const std::u16string kOriginalString = base::UTF8ToUTF16("abcxxxghi"); + const std::u16string kOriginalString = u"abcxxxghi"; tab_view()->SelectionChanged(kOriginalString, 3, gfx::Range::InvalidRange()); diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index b1dbc9fa138077..c3800866f2ff99 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc @@ -1417,7 +1417,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, TitleAfterCrossSiteIframe) { " function() { document.title = 'loaded'; };")); EXPECT_TRUE( ExecuteScript(shell()->web_contents(), "document.title = 'not loaded';")); - std::u16string expected_title(base::UTF8ToUTF16("loaded")); + std::u16string expected_title(u"loaded"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); // Navigate the iframe cross-site. @@ -4980,7 +4980,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, LoadEventForwarding) { { GURL main_url( embedded_test_server()->GetURL("/frame_with_load_event.html")); - std::u16string expected_title(base::UTF8ToUTF16("LOADED")); + std::u16string expected_title(u"LOADED"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); EXPECT_TRUE(NavigateToURL(shell(), main_url)); EXPECT_EQ(title_watcher.WaitAndGetTitle(), expected_title); @@ -4993,7 +4993,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, LoadEventForwarding) { // is fired. { GURL foo_url(embedded_test_server()->GetURL("foo.com", "/title1.html")); - std::u16string expected_title(base::UTF8ToUTF16("LOADEDLOADED")); + std::u16string expected_title(u"LOADEDLOADED"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); TestNavigationObserver observer(shell()->web_contents()); EXPECT_TRUE(NavigateToURLFromRenderer(root->child_at(0), foo_url)); @@ -7304,7 +7304,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, for (const auto& test : kTestCases) { GURL blocked_url = embedded_test_server()->GetURL("b.com", test.url); EXPECT_TRUE(ExecuteScript(shell(), "document.title = 'not loaded';")); - std::u16string expected_title(base::UTF8ToUTF16("loaded")); + std::u16string expected_title(u"loaded"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); WebContentsConsoleObserver console_observer(shell()->web_contents()); @@ -7390,7 +7390,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, "document.querySelector('iframe').onload = " " function() { document.title = 'loaded'; };")); EXPECT_TRUE(ExecuteScript(shell(), "document.title = 'not loaded';")); - std::u16string expected_title(base::UTF8ToUTF16("loaded")); + std::u16string expected_title(u"loaded"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); // Try to navigate the subframe to a blocked URL. @@ -7464,7 +7464,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, "document.querySelector('iframe').onload = " " function() { document.title = 'loaded'; };")); EXPECT_TRUE(ExecJs(shell(), "document.title = 'not loaded';")); - std::u16string expected_title(base::UTF8ToUTF16("loaded")); + std::u16string expected_title(u"loaded"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); // Try to navigate the subframe to a blocked URL. @@ -7536,7 +7536,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, "document.querySelector('iframe').onload = " " function() { window.top.postMessage('loaded', '*'); };")); EXPECT_TRUE(ExecJs(shell(), "document.title = 'not loaded';")); - std::u16string expected_title(base::UTF8ToUTF16("loaded")); + std::u16string expected_title(u"loaded"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); // Try to navigate the subframe to a blocked URL. @@ -8706,7 +8706,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, // Send a postMessage from the child to its parent. This verifies that the // parent's proxy in the child's SiteInstance was also restored. - std::u16string expected_title(base::UTF8ToUTF16("I am alive!")); + std::u16string expected_title(u"I am alive!"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); EXPECT_TRUE(ExecuteScript(child->current_frame_host(), "parent.postMessage('I am alive!', '*');")); @@ -9058,7 +9058,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, // |popup2|. This is allowed since the main tab is |popup2|'s opener. EXPECT_TRUE(NavigateToURLFromRenderer(shell(), b_url)); - std::u16string expected_title(base::UTF8ToUTF16("foo")); + std::u16string expected_title(u"foo"); TitleWatcher title_watcher(popup2->web_contents(), expected_title); EXPECT_TRUE(ExecuteScript( shell(), "window.open('','popup2').postMessage('foo', '*');")); @@ -16708,7 +16708,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessWebBundleBrowserTest, SameSiteBundle) { GURL main_url(https_server()->GetURL( "foo.test", "/web_bundle/frame_parent.html?wbn=" + bundle_url.spec())); EXPECT_TRUE(NavigateToURL(shell(), main_url)); - std::u16string expected_title(base::UTF8ToUTF16("OK")); + std::u16string expected_title(u"OK"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); @@ -16729,7 +16729,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessWebBundleBrowserTest, CrossSiteBundle) { GURL main_url(https_server()->GetURL( "foo.test", "/web_bundle/frame_parent.html?wbn=" + bundle_url.spec())); EXPECT_TRUE(NavigateToURL(shell(), main_url)); - std::u16string expected_title(base::UTF8ToUTF16("OK")); + std::u16string expected_title(u"OK"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); diff --git a/content/browser/site_per_process_hit_test_browsertest.cc b/content/browser/site_per_process_hit_test_browsertest.cc index 432aba22c6ca4a..263f6eafeae185 100644 --- a/content/browser/site_per_process_hit_test_browsertest.cc +++ b/content/browser/site_per_process_hit_test_browsertest.cc @@ -3263,7 +3263,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessHitTestBrowserTest, EXPECT_EQ(iteration != 0, b_frame_monitor.EventWasReceived()); b_frame_monitor.ResetEventReceived(); - tooltip_monitor.WaitUntil(base::UTF8ToUTF16("body_tooltip")); + tooltip_monitor.WaitUntil(u"body_tooltip"); tooltip_monitor.Reset(); // Next send a MouseMove to B frame, and A should receive a MouseMove event. diff --git a/content/browser/site_per_process_unload_browsertest.cc b/content/browser/site_per_process_unload_browsertest.cc index 8c6a0e06df008b..82a0b77adf1a2b 100644 --- a/content/browser/site_per_process_unload_browsertest.cc +++ b/content/browser/site_per_process_unload_browsertest.cc @@ -993,7 +993,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, // This performs window.open() and waits for the title of the original // document to change to signal that the unload handler has been registered. { - std::u16string title_when_loaded = base::UTF8ToUTF16("loaded"); + std::u16string title_when_loaded = u"loaded"; TitleWatcher title_watcher(shell()->web_contents(), title_when_loaded); EXPECT_TRUE( ExecuteScript(root, JsReplace("var w = window.open($1)", open_url))); @@ -1003,7 +1003,7 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, // The closes the window and waits for the title of the original document to // change again to signal that the unload handler has run. { - std::u16string title_when_done = base::UTF8ToUTF16("unloaded"); + std::u16string title_when_done = u"unloaded"; TitleWatcher title_watcher(shell()->web_contents(), title_when_done); EXPECT_TRUE(ExecuteScript(root, "w.close()")); EXPECT_EQ(title_watcher.WaitAndGetTitle(), title_when_done); diff --git a/content/browser/snapshot_browsertest.cc b/content/browser/snapshot_browsertest.cc index c41e78495af95c..b3630c1ad74109 100644 --- a/content/browser/snapshot_browsertest.cc +++ b/content/browser/snapshot_browsertest.cc @@ -110,7 +110,7 @@ class SnapshotBrowserTest : public ContentBrowserTest { } void WaitForAllWindowsToBeReady() { - const std::u16string expected_title = base::UTF8ToUTF16("Ready"); + const std::u16string expected_title = u"Ready"; // The subordinate windows may load asynchronously. Wait for all of // them to execute their script before proceeding. auto browser_list = Shell::windows(); diff --git a/content/browser/speech/speech_recognition_browsertest.cc b/content/browser/speech/speech_recognition_browsertest.cc index d6be828a8e6a53..98f4983f9f3bce 100644 --- a/content/browser/speech/speech_recognition_browsertest.cc +++ b/content/browser/speech/speech_recognition_browsertest.cc @@ -133,7 +133,7 @@ std::string MakeGoodResponse() { blink::mojom::SpeechRecognitionResultPtr result = blink::mojom::SpeechRecognitionResult::New(); result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("Pictures of the moon"), 1.0F)); + u"Pictures of the moon", 1.0F)); proto_result->set_final(!result->is_provisional); for (size_t i = 0; i < result->hypotheses.size(); ++i) { proto::SpeechRecognitionAlternative* proto_alternative = diff --git a/content/browser/speech/speech_recognition_engine_unittest.cc b/content/browser/speech/speech_recognition_engine_unittest.cc index fb0a3b28d29974..412ea7e8230916 100644 --- a/content/browser/speech/speech_recognition_engine_unittest.cc +++ b/content/browser/speech/speech_recognition_engine_unittest.cc @@ -138,10 +138,10 @@ TEST_F(SpeechRecognitionEngineTest, SingleDefinitiveResult) { results.push_back(blink::mojom::SpeechRecognitionResult::New()); blink::mojom::SpeechRecognitionResultPtr& result = results.back(); result->is_provisional = false; - result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("hypothesis 1"), 0.1F)); - result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("hypothesis 2"), 0.2F)); + result->hypotheses.push_back( + blink::mojom::SpeechRecognitionHypothesis::New(u"hypothesis 1", 0.1F)); + result->hypotheses.push_back( + blink::mojom::SpeechRecognitionHypothesis::New(u"hypothesis 2", 0.2F)); ProvideMockResultDownstream(result); ExpectResultsReceived(results); @@ -170,7 +170,7 @@ TEST_F(SpeechRecognitionEngineTest, SeveralStreamingResults) { result->is_provisional = (i % 2 == 0); // Alternate result types. float confidence = result->is_provisional ? 0.0F : (i * 0.1F); result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("hypothesis"), confidence)); + u"hypothesis", confidence)); ProvideMockResultDownstream(result); ExpectResultsReceived(results); @@ -188,7 +188,7 @@ TEST_F(SpeechRecognitionEngineTest, SeveralStreamingResults) { blink::mojom::SpeechRecognitionResultPtr& result = results.back(); result->is_provisional = false; result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("The final result"), 1.0F)); + u"The final result", 1.0F)); ProvideMockResultDownstream(result); ExpectResultsReceived(results); ASSERT_TRUE(engine_under_test_->IsRecognitionPending()); @@ -214,8 +214,8 @@ TEST_F(SpeechRecognitionEngineTest, NoFinalResultAfterAudioChunksEnded) { std::vector results; results.push_back(blink::mojom::SpeechRecognitionResult::New()); blink::mojom::SpeechRecognitionResultPtr& result = results.back(); - result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("hypothesis"), 1.0F)); + result->hypotheses.push_back( + blink::mojom::SpeechRecognitionHypothesis::New(u"hypothesis", 1.0F)); ProvideMockResultDownstream(result); ExpectResultsReceived(results); ASSERT_TRUE(engine_under_test_->IsRecognitionPending()); @@ -260,8 +260,8 @@ TEST_F(SpeechRecognitionEngineTest, ReRequestData) { std::vector results; results.push_back(blink::mojom::SpeechRecognitionResult::New()); blink::mojom::SpeechRecognitionResultPtr& result = results.back(); - result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("hypothesis"), 1.0F)); + result->hypotheses.push_back( + blink::mojom::SpeechRecognitionHypothesis::New(u"hypothesis", 1.0F)); ProvideMockResultDownstream(result); ExpectResultsReceived(results); ASSERT_TRUE(engine_under_test_->IsRecognitionPending()); @@ -312,7 +312,7 @@ TEST_F(SpeechRecognitionEngineTest, NoMatchError) { blink::mojom::SpeechRecognitionResultPtr& result = results.back(); result->is_provisional = true; result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("The final result"), 0.0F)); + u"The final result", 0.0F)); ProvideMockResultDownstream(result); ExpectResultsReceived(results); ASSERT_TRUE(engine_under_test_->IsRecognitionPending()); @@ -390,8 +390,8 @@ TEST_F(SpeechRecognitionEngineTest, Stability) { results.push_back(blink::mojom::SpeechRecognitionResult::New()); blink::mojom::SpeechRecognitionResultPtr& result = results.back(); result->is_provisional = true; - result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("foo"), 0.5)); + result->hypotheses.push_back( + blink::mojom::SpeechRecognitionHypothesis::New(u"foo", 0.5)); // Check that the protobuf generated the expected result. ExpectResultsReceived(results); @@ -471,8 +471,8 @@ TEST_F(SpeechRecognitionEngineTest, SendPreamble) { results.push_back(blink::mojom::SpeechRecognitionResult::New()); blink::mojom::SpeechRecognitionResultPtr& result = results.back(); result->is_provisional = false; - result->hypotheses.push_back(blink::mojom::SpeechRecognitionHypothesis::New( - base::UTF8ToUTF16("hypothesis 1"), 0.1F)); + result->hypotheses.push_back( + blink::mojom::SpeechRecognitionHypothesis::New(u"hypothesis 1", 0.1F)); ProvideMockResultDownstream(result); ExpectResultsReceived(results); diff --git a/content/browser/web_contents/web_contents_view_aura_unittest.cc b/content/browser/web_contents/web_contents_view_aura_unittest.cc index 0dd80e71eece86..0eaaf5cf8e9b4b 100644 --- a/content/browser/web_contents/web_contents_view_aura_unittest.cc +++ b/content/browser/web_contents/web_contents_view_aura_unittest.cc @@ -605,7 +605,7 @@ TEST_F(WebContentsViewAuraTest, StartDragging) { view->drag_in_progress_ = true; DropData drop_data; - drop_data.text.emplace(base::UTF8ToUTF16("Hello World!")); + drop_data.text.emplace(u"Hello World!"); view->StartDragging(drop_data, blink::DragOperationsMask::kDragOperationNone, gfx::ImageSkia(), gfx::Vector2d(), blink::mojom::DragEventSourceInfo(), diff --git a/content/browser/web_package/link_web_bundle_browsertest.cc b/content/browser/web_package/link_web_bundle_browsertest.cc index ecded6453e5d96..32da7ec1b9e8c2 100644 --- a/content/browser/web_package/link_web_bundle_browsertest.cc +++ b/content/browser/web_package/link_web_bundle_browsertest.cc @@ -329,7 +329,7 @@ IN_PROC_BROWSER_TEST_F(LinkWebBundleBrowserTest, NetworkIsolationKey) { GURL page_url(https_server()->GetURL( "page.test", "/web_bundle/frame_parent.html?wbn=" + bundle_url.spec())); EXPECT_TRUE(NavigateToURL(shell(), page_url)); - std::u16string expected_title(base::UTF8ToUTF16("OK")); + std::u16string expected_title(u"OK"); TitleWatcher title_watcher(shell()->web_contents(), expected_title); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); diff --git a/content/browser/webui/web_ui_main_frame_observer_unittest.cc b/content/browser/webui/web_ui_main_frame_observer_unittest.cc index b4f318b2e61992..45dda80b8ccd6e 100644 --- a/content/browser/webui/web_ui_main_frame_observer_unittest.cc +++ b/content/browser/webui/web_ui_main_frame_observer_unittest.cc @@ -251,9 +251,9 @@ TEST_F(WebUIMainFrameObserverTest, NotSentIfFlagDisabled) { TEST_F(WebUIMainFrameObserverTest, NotSentIfInvalidURL) { NavigateToPage(); - CallOnDidAddMessageToConsole( - web_ui_->frame_host(), blink::mojom::ConsoleMessageLevel::kError, - kMessage16, 5, base::UTF8ToUTF16("invalid URL"), kStackTrace16); + CallOnDidAddMessageToConsole(web_ui_->frame_host(), + blink::mojom::ConsoleMessageLevel::kError, + kMessage16, 5, u"invalid URL", kStackTrace16); task_environment()->RunUntilIdle(); EXPECT_EQ(processor_->error_report_count(), 0); } diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index a8c5ca23651cd0..f8685eb22d22d7 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc @@ -2324,7 +2324,7 @@ TEST_F(RenderViewImplTest, GetCompositionCharacterBoundsTest) { widget_input_handler->SetFocus(true); // ASCII composition - const std::u16string ascii_composition = base::UTF8ToUTF16("aiueo"); + const std::u16string ascii_composition = u"aiueo"; widget_input_handler->ImeSetComposition( ascii_composition, empty_ime_text_span, gfx::Range::InvalidRange(), 0, 0); bounds = LastCompositionBounds(); @@ -2367,7 +2367,7 @@ TEST_F(RenderViewImplTest, GetCompositionCharacterBoundsTest) { // Mixed string. const std::u16string surrogate_pair_mixed_composition = surrogate_pair_char + base::UTF8ToUTF16("\xE3\x81\x82") + - surrogate_pair_char + base::UTF8ToUTF16("b") + surrogate_pair_char; + surrogate_pair_char + u"b" + surrogate_pair_char; const size_t utf16_length = 8UL; const bool is_surrogate_pair_empty_rect[8] = {false, true, false, false, true, false, false, true}; @@ -3051,7 +3051,7 @@ TEST_F(RenderViewImplAddMessageToConsoleTest, message_mock_frame_host()->SetDidAddMessageToConsoleCallback( base::BindOnce(base::BindLambdaForTesting([&](const std::u16string& msg) { // Makes sure this happens during the beforeunload handler. - EXPECT_EQ(base::UTF8ToUTF16("OnBeforeUnload called"), msg); + EXPECT_EQ(u"OnBeforeUnload called", msg); // Unloads the main frame. static_cast(frame())->Unload( @@ -3099,7 +3099,7 @@ class RenderViewImplModalDialogTest : public RenderViewImplTest { // Test that invoking one of the modal dialogs doesn't crash. TEST_F(RenderViewImplModalDialogTest, ModalDialogs) { LoadHTML(""); - std::u16string alert_message = base::UTF8ToUTF16("Please don't crash"); + std::u16string alert_message = u"Please don't crash"; EXPECT_CALL(*alert_mock_frame_host(), RunModalAlertDialog(alert_message, testing::_)) .WillOnce(base::test::RunOnceCallback<1>()); @@ -3253,7 +3253,7 @@ TEST_F(RenderViewImplEnableZoomForDSFTest, widget_input_handler->SetFocus(true); // ASCII composition - const std::u16string ascii_composition = base::UTF8ToUTF16("aiueo"); + const std::u16string ascii_composition = u"aiueo"; widget_input_handler->ImeSetComposition( ascii_composition, empty_ime_text_span, gfx::Range::InvalidRange(), 0, 0); bounds_at_1x = LastCompositionBounds(); diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc index 840efaf890be7e..8493dec4d93551 100644 --- a/device/bluetooth/bluetooth_device_unittest.cc +++ b/device/bluetooth/bluetooth_device_unittest.cc @@ -1163,9 +1163,8 @@ TEST_F(BluetoothTest, MAYBE_GetName_NullName) { // TODO(https://crbug.com/588083): Enable the check below when GetAppearance() // is implemented for Android and Mac. #if !defined(OS_ANDROID) && !defined(OS_MAC) - EXPECT_EQ( - device->GetNameForDisplay(), - base::UTF8ToUTF16("Unknown or Unsupported Device (01:00:00:90:1E:BE)")); + EXPECT_EQ(device->GetNameForDisplay(), + u"Unknown or Unsupported Device (01:00:00:90:1E:BE)"); #endif } diff --git a/device/fido/auth_token_requester_unittest.cc b/device/fido/auth_token_requester_unittest.cc index bd276930a0cd7c..e06f348e0ddbde 100644 --- a/device/fido/auth_token_requester_unittest.cc +++ b/device/fido/auth_token_requester_unittest.cc @@ -402,14 +402,14 @@ TEST_F(AuthTokenRequesterTest, PINTooShort) { config.ctap2_versions = {std::begin(kCtap2Versions2_1), std::end(kCtap2Versions2_1)}; auto state = base::MakeRefCounted(); - RunTestCase(std::move(config), state, - TestCase{ClientPinAvailability::kSupportedAndPinSet, - UserVerificationAvailability::kNotSupported, - true, - {{.reason = pin::PINEntryReason::kChallenge, - .pin = base::UTF8ToUTF16("まどか")}, - {pin::PINEntryReason::kChallenge, - pin::PINEntryError::kTooShort}}}); + RunTestCase( + std::move(config), state, + TestCase{ + ClientPinAvailability::kSupportedAndPinSet, + UserVerificationAvailability::kNotSupported, + true, + {{.reason = pin::PINEntryReason::kChallenge, .pin = u"まどか"}, + {pin::PINEntryReason::kChallenge, pin::PINEntryError::kTooShort}}}); } TEST_F(AuthTokenRequesterTest, UVLockedPINFallback) { diff --git a/docs/webui_in_chrome.md b/docs/webui_in_chrome.md index 12e4352cb0d819..9eef10b268de96 100644 --- a/docs/webui_in_chrome.md +++ b/docs/webui_in_chrome.md @@ -287,7 +287,7 @@ ui::ModalType HelloWorldDialog::GetDialogModalType() const { } std::u16string HelloWorldDialog::GetDialogTitle() const { - return base::UTF8ToUTF16("Hello world"); + return u"Hello world"; } GURL HelloWorldDialog::GetDialogContentURL() const { diff --git a/extensions/browser/api/bluetooth/bluetooth_apitest.cc b/extensions/browser/api/bluetooth/bluetooth_apitest.cc index 35a3b7a38e7ae4..7ebb3d0cbff5ea 100644 --- a/extensions/browser/api/bluetooth/bluetooth_apitest.cc +++ b/extensions/browser/api/bluetooth/bluetooth_apitest.cc @@ -175,7 +175,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, DeviceEvents) { .WillRepeatedly( testing::Return(base::Optional("the real d2"))); EXPECT_CALL(*device2_, GetNameForDisplay()) - .WillRepeatedly(testing::Return(base::UTF8ToUTF16("the real d2"))); + .WillRepeatedly(testing::Return(u"the real d2")); event_router()->DeviceChanged(mock_adapter_, device2_.get()); event_router()->DeviceAdded(mock_adapter_, device3_.get()); @@ -400,7 +400,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, DeviceInfo) { .WillRepeatedly( testing::Return(base::Optional("Chromebook Pixel"))); EXPECT_CALL(*device1_, GetNameForDisplay()) - .WillRepeatedly(testing::Return(base::UTF8ToUTF16("Chromebook Pixel"))); + .WillRepeatedly(testing::Return(u"Chromebook Pixel")); EXPECT_CALL(*device1_, GetBluetoothClass()) .WillRepeatedly(testing::Return(0x080104)); EXPECT_CALL(*device1_, GetDeviceType()) diff --git a/extensions/browser/api/hid/hid_apitest.cc b/extensions/browser/api/hid/hid_apitest.cc index da18d9b2670e12..ac67fcf8ef42b1 100644 --- a/extensions/browser/api/hid/hid_apitest.cc +++ b/extensions/browser/api/hid/hid_apitest.cc @@ -68,7 +68,7 @@ class TestDevicePermissionsPrompt } else { for (size_t i = 0; i < prompt()->GetDeviceCount(); ++i) { // Always choose the device whose serial number is "A". - if (prompt()->GetDeviceSerialNumber(i) == base::UTF8ToUTF16("A")) { + if (prompt()->GetDeviceSerialNumber(i) == u"A") { prompt()->GrantDevicePermission(i); prompt()->Dismissed(); return; diff --git a/extensions/browser/service_worker_task_queue.cc b/extensions/browser/service_worker_task_queue.cc index 43e6b018f6e443..e8c2c5edd52eb7 100644 --- a/extensions/browser/service_worker_task_queue.cc +++ b/extensions/browser/service_worker_task_queue.cc @@ -444,7 +444,7 @@ void ServiceWorkerTaskQueue::DidRegisterServiceWorker( if (!success) { auto error = std::make_unique( - extension_id, base::UTF8ToUTF16("Service worker registration failed"), + extension_id, u"Service worker registration failed", base::UTF8ToUTF16(manifest_keys::kBackground), base::UTF8ToUTF16( BackgroundInfo::GetBackgroundServiceWorkerScript(extension))); diff --git a/ios/chrome/browser/autofill/autofill_controller_unittest.mm b/ios/chrome/browser/autofill/autofill_controller_unittest.mm index 7270449a666eb6..b48ba239b79685 100644 --- a/ios/chrome/browser/autofill/autofill_controller_unittest.mm +++ b/ios/chrome/browser/autofill/autofill_controller_unittest.mm @@ -379,7 +379,7 @@ bool LoadHtmlAndWaitForFormFetched(NSString* html, ->autofill_manager(); const auto& forms = autofill_manager->form_structures(); const auto& form = *(forms.begin()->second); - EXPECT_EQ(base::UTF8ToUTF16("form1"), form.ToFormData().name); + EXPECT_EQ(u"form1", form.ToFormData().name); } // Checks that an HTML page containing a profile-type form which is submitted @@ -406,16 +406,14 @@ bool LoadHtmlAndWaitForFormFetched(NSString* html, if (profiles.size() != 1) FAIL() << "Not exactly one profile found after attempted import"; const AutofillProfile& profile = *profiles[0]; - EXPECT_EQ(base::UTF8ToUTF16("Homer Simpson"), + EXPECT_EQ(u"Homer Simpson", profile.GetInfo(AutofillType(NAME_FULL), "en-US")); - EXPECT_EQ(base::UTF8ToUTF16("123 Main Street"), + EXPECT_EQ(u"123 Main Street", profile.GetInfo(AutofillType(ADDRESS_HOME_LINE1), "en-US")); - EXPECT_EQ(base::UTF8ToUTF16("Springfield"), + EXPECT_EQ(u"Springfield", profile.GetInfo(AutofillType(ADDRESS_HOME_CITY), "en-US")); - EXPECT_EQ(base::UTF8ToUTF16("IL"), - profile.GetInfo(AutofillType(ADDRESS_HOME_STATE), "en-US")); - EXPECT_EQ(base::UTF8ToUTF16("55123"), - profile.GetInfo(AutofillType(ADDRESS_HOME_ZIP), "en-US")); + EXPECT_EQ(u"IL", profile.GetInfo(AutofillType(ADDRESS_HOME_STATE), "en-US")); + EXPECT_EQ(u"55123", profile.GetInfo(AutofillType(ADDRESS_HOME_ZIP), "en-US")); } void AutofillControllerTest::SetUpForSuggestions( @@ -425,11 +423,11 @@ bool LoadHtmlAndWaitForFormFetched(NSString* html, PersonalDataManagerFactory::GetForBrowserState( ChromeBrowserState::FromBrowserState(GetBrowserState())); AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/"); - profile.SetRawInfo(NAME_FULL, base::UTF8ToUTF16("Homer Simpson")); - profile.SetRawInfo(ADDRESS_HOME_LINE1, base::UTF8ToUTF16("123 Main Street")); - profile.SetRawInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("Springfield")); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("IL")); - profile.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("55123")); + profile.SetRawInfo(NAME_FULL, u"Homer Simpson"); + profile.SetRawInfo(ADDRESS_HOME_LINE1, u"123 Main Street"); + profile.SetRawInfo(ADDRESS_HOME_CITY, u"Springfield"); + profile.SetRawInfo(ADDRESS_HOME_STATE, u"IL"); + profile.SetRawInfo(ADDRESS_HOME_ZIP, u"55123"); EXPECT_EQ(0U, personal_data_manager->GetProfiles().size()); personal_data_manager->SaveImportedProfile(profile); EXPECT_EQ(1U, personal_data_manager->GetProfiles().size()); @@ -492,11 +490,11 @@ bool LoadHtmlAndWaitForFormFetched(NSString* html, PersonalDataManagerFinishedProfileTasksWaiter waiter(personal_data_manager); AutofillProfile profile(base::GenerateGUID(), "https://www.example.com/"); - profile.SetRawInfo(NAME_FULL, base::UTF8ToUTF16("Homer Simpson")); - profile.SetRawInfo(ADDRESS_HOME_LINE1, base::UTF8ToUTF16("123 Main Street")); - profile.SetRawInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("Springfield")); - profile.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("IL")); - profile.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("55123")); + profile.SetRawInfo(NAME_FULL, u"Homer Simpson"); + profile.SetRawInfo(ADDRESS_HOME_LINE1, u"123 Main Street"); + profile.SetRawInfo(ADDRESS_HOME_CITY, u"Springfield"); + profile.SetRawInfo(ADDRESS_HOME_STATE, u"IL"); + profile.SetRawInfo(ADDRESS_HOME_ZIP, u"55123"); EXPECT_EQ(0U, personal_data_manager->GetProfiles().size()); personal_data_manager->SaveImportedProfile(profile); @@ -504,12 +502,11 @@ bool LoadHtmlAndWaitForFormFetched(NSString* html, EXPECT_EQ(1U, personal_data_manager->GetProfiles().size()); AutofillProfile profile2(base::GenerateGUID(), "https://www.example.com/"); - profile2.SetRawInfo(NAME_FULL, base::UTF8ToUTF16("Larry Page")); - profile2.SetRawInfo(ADDRESS_HOME_LINE1, - base::UTF8ToUTF16("1600 Amphitheatre Parkway")); - profile2.SetRawInfo(ADDRESS_HOME_CITY, base::UTF8ToUTF16("Mountain View")); - profile2.SetRawInfo(ADDRESS_HOME_STATE, base::UTF8ToUTF16("CA")); - profile2.SetRawInfo(ADDRESS_HOME_ZIP, base::UTF8ToUTF16("94043")); + profile2.SetRawInfo(NAME_FULL, u"Larry Page"); + profile2.SetRawInfo(ADDRESS_HOME_LINE1, u"1600 Amphitheatre Parkway"); + profile2.SetRawInfo(ADDRESS_HOME_CITY, u"Mountain View"); + profile2.SetRawInfo(ADDRESS_HOME_STATE, u"CA"); + profile2.SetRawInfo(ADDRESS_HOME_ZIP, u"94043"); personal_data_manager->SaveImportedProfile(profile2); EXPECT_EQ(2U, personal_data_manager->GetProfiles().size()); EXPECT_TRUE(LoadHtmlAndWaitForFormFetched(kProfileFormHtml, 1)); @@ -535,23 +532,23 @@ bool LoadHtmlAndWaitForFormFetched(NSString* html, consumer.result_ = {CreateAutofillEntry(base::ASCIIToUTF16("Should")), CreateAutofillEntry(base::ASCIIToUTF16("get")), CreateAutofillEntry(base::ASCIIToUTF16("overwritten"))}; - web_data_service->GetFormValuesForElementName( - base::UTF8ToUTF16("greeting"), std::u16string(), limit, &consumer); + web_data_service->GetFormValuesForElementName(u"greeting", std::u16string(), + limit, &consumer); base::ThreadPoolInstance::Get()->FlushForTesting(); WaitForBackgroundTasks(); // No value should be returned before anything is loaded via form submission. ASSERT_EQ(0U, consumer.result_.size()); ExecuteJavaScript(@"submit.click()"); WaitForCondition(^bool { - web_data_service->GetFormValuesForElementName( - base::UTF8ToUTF16("greeting"), std::u16string(), limit, &consumer); + web_data_service->GetFormValuesForElementName(u"greeting", std::u16string(), + limit, &consumer); return consumer.result_.size(); }); base::ThreadPoolInstance::Get()->FlushForTesting(); WaitForBackgroundTasks(); // One result should be returned, matching the filled value. ASSERT_EQ(1U, consumer.result_.size()); - EXPECT_EQ(base::UTF8ToUTF16("Hello"), consumer.result_[0].key().value()); + EXPECT_EQ(u"Hello", consumer.result_[0].key().value()); } void AutofillControllerTest::SetUpKeyValueData() { @@ -561,8 +558,8 @@ bool LoadHtmlAndWaitForFormFetched(NSString* html, // Load value into database. std::vector values; FormFieldData fieldData; - fieldData.name = base::UTF8ToUTF16("greeting"); - fieldData.value = base::UTF8ToUTF16("Bonjour"); + fieldData.name = u"greeting"; + fieldData.value = u"Bonjour"; values.push_back(fieldData); web_data_service->AddFormFields(values); @@ -686,15 +683,14 @@ bool LoadHtmlAndWaitForFormFetched(NSString* html, personal_data_manager->GetCreditCards(); ASSERT_EQ(1U, credit_cards.size()); const CreditCard& credit_card = *credit_cards[0]; - EXPECT_EQ(base::UTF8ToUTF16("Superman"), + EXPECT_EQ(u"Superman", credit_card.GetInfo(AutofillType(CREDIT_CARD_NAME_FULL), "en-US")); - EXPECT_EQ(base::UTF8ToUTF16("4000444444444444"), + EXPECT_EQ(u"4000444444444444", credit_card.GetInfo(AutofillType(CREDIT_CARD_NUMBER), "en-US")); - EXPECT_EQ(base::UTF8ToUTF16("11"), + EXPECT_EQ(u"11", credit_card.GetInfo(AutofillType(CREDIT_CARD_EXP_MONTH), "en-US")); - EXPECT_EQ( - base::UTF8ToUTF16("2999"), - credit_card.GetInfo(AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), "en-US")); + EXPECT_EQ(u"2999", credit_card.GetInfo( + AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), "en-US")); } } // namespace diff --git a/ios/chrome/browser/credential_provider/archivable_credential+password_form_unittest.mm b/ios/chrome/browser/credential_provider/archivable_credential+password_form_unittest.mm index b6b70b8588fed3..47c76d2e169a07 100644 --- a/ios/chrome/browser/credential_provider/archivable_credential+password_form_unittest.mm +++ b/ios/chrome/browser/credential_provider/archivable_credential+password_form_unittest.mm @@ -30,8 +30,8 @@ PasswordForm passwordForm; passwordForm.times_used = 10; - passwordForm.username_element = base::UTF8ToUTF16("username_element"); - passwordForm.password_element = base::UTF8ToUTF16("password_element"); + passwordForm.username_element = u"username_element"; + passwordForm.password_element = u"password_element"; passwordForm.username_value = base::SysNSStringToUTF16(username); passwordForm.encrypted_password = base::SysNSStringToUTF8(keychainIdentifier); passwordForm.url = GURL(base::SysNSStringToUTF16(url)); diff --git a/ios/chrome/browser/credential_provider/credential_provider_util.mm b/ios/chrome/browser/credential_provider/credential_provider_util.mm index 69c0f525fecb9b..d8814bdacd7232 100644 --- a/ios/chrome/browser/credential_provider/credential_provider_util.mm +++ b/ios/chrome/browser/credential_provider/credential_provider_util.mm @@ -17,8 +17,8 @@ NSString* RecordIdentifierForPasswordForm( const password_manager::PasswordForm& form) { // These are the UNIQUE keys in the login database. - return SysUTF16ToNSString( - UTF8ToUTF16(form.url.spec() + "|") + form.username_element + - UTF8ToUTF16("|") + form.username_value + UTF8ToUTF16("|") + - form.password_element + UTF8ToUTF16("|" + form.signon_realm)); + return SysUTF16ToNSString(UTF8ToUTF16(form.url.spec() + "|") + + form.username_element + u"|" + form.username_value + + u"|" + form.password_element + + UTF8ToUTF16("|" + form.signon_realm)); } diff --git a/ios/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.mm b/ios/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.mm index 545d80d99ec5ff..1fd09011e49f72 100644 --- a/ios/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.mm +++ b/ios/chrome/browser/safe_browsing/chrome_password_protection_service_unittest.mm @@ -486,9 +486,8 @@ void SetUpSyncAccount(const std::string& hosted_domain, domains.push_back("amazon.com"); service_->set_saved_passwords_matching_domains(domains); warning_text = l10n_util::GetStringFUTF16( - IDS_PAGE_INFO_CHECK_PASSWORD_DETAILS_SAVED_3_DOMAIN, - base::UTF8ToUTF16("amazon.com"), base::UTF8ToUTF16(domains[0]), - base::UTF8ToUTF16(domains[1])); + IDS_PAGE_INFO_CHECK_PASSWORD_DETAILS_SAVED_3_DOMAIN, u"amazon.com", + base::UTF8ToUTF16(domains[0]), base::UTF8ToUTF16(domains[1])); EXPECT_EQ(warning_text, service_->GetWarningDetailText(reused_password_type, &placeholder_offsets)); } @@ -502,7 +501,7 @@ void SetUpSyncAccount(const std::string& hosted_domain, service_->set_saved_passwords_matching_domains(domains); // Default domains should be prioritzed over other domains. std::vector expected_placeholders{ - base::UTF8ToUTF16("amazon.com"), base::UTF8ToUTF16(domains[0]), + u"amazon.com", base::UTF8ToUTF16(domains[0]), base::UTF8ToUTF16(domains[1])}; EXPECT_EQ(expected_placeholders, service_->GetPlaceholdersForSavedPasswordWarningText()); diff --git a/ios/chrome/browser/search_engines/search_engine_tab_helper_unittest.mm b/ios/chrome/browser/search_engines/search_engine_tab_helper_unittest.mm index 6a9b908303ee92..0682534739d863 100644 --- a/ios/chrome/browser/search_engines/search_engine_tab_helper_unittest.mm +++ b/ios/chrome/browser/search_engines/search_engine_tab_helper_unittest.mm @@ -137,8 +137,8 @@ bool SendMessageOfSearchableUrl(const GURL& searchable_url) { } } ASSERT_TRUE(new_url); - EXPECT_EQ(base::UTF8ToUTF16("chromium.test"), new_url->data().keyword()); - EXPECT_EQ(base::UTF8ToUTF16("Chrooome"), new_url->data().short_name()); + EXPECT_EQ(u"chromium.test", new_url->data().keyword()); + EXPECT_EQ(u"Chrooome", new_url->data().short_name()); EXPECT_EQ( "https://chromium.test/index.php?title=chrooome&search={searchTerms}", new_url->data().url()); @@ -186,8 +186,8 @@ GURL searchable_url( } } ASSERT_TRUE(new_url); - EXPECT_EQ(base::UTF8ToUTF16("chromium.test"), new_url->data().keyword()); - EXPECT_EQ(base::UTF8ToUTF16("chromium.test"), new_url->data().short_name()); + EXPECT_EQ(u"chromium.test", new_url->data().keyword()); + EXPECT_EQ(u"chromium.test", new_url->data().short_name()); EXPECT_EQ(searchable_url.spec(), new_url->data().url()); const GURL expected_favicon_url = GURL(page_url.spec() + "favicon.ico"); EXPECT_EQ(expected_favicon_url, new_url->data().favicon_url); diff --git a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_browser_agent_unittest.mm b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_browser_agent_unittest.mm index 879ee0d4b40ed1..d769700b54e5f0 100644 --- a/ios/chrome/browser/send_tab_to_self/send_tab_to_self_browser_agent_unittest.mm +++ b/ios/chrome/browser/send_tab_to_self/send_tab_to_self_browser_agent_unittest.mm @@ -126,7 +126,7 @@ void RemoteAddEntry(send_tab_to_self::SendTabToSelfEntry* entry) { // Create a navigation item to match the URL and give it a title. std::unique_ptr item = web::NavigationItem::Create(); item->SetURL(url); - item->SetTitle(base::UTF8ToUTF16("Page title")); + item->SetTitle(u"Page title"); auto navigation_manager = std::make_unique(); navigation_manager->SetLastCommittedItem(item.get()); // Test nav manager doesn't own its items, so move |item| into the storage diff --git a/ios/chrome/browser/tabs/tab_title_util_unittest.mm b/ios/chrome/browser/tabs/tab_title_util_unittest.mm index 11b0194abebb55..e314c51e463a11 100644 --- a/ios/chrome/browser/tabs/tab_title_util_unittest.mm +++ b/ios/chrome/browser/tabs/tab_title_util_unittest.mm @@ -72,7 +72,7 @@ EXPECT_NSEQ(ns_default_title, tab_util::GetTabTitle(&web_state_)); // Title is set on the web state. - std::u16string custom_title = base::UTF8ToUTF16("TestTitle"); + std::u16string custom_title = u"TestTitle"; NSString* ns_custom_title = base::SysUTF16ToNSString(custom_title); web_state_.SetTitle(custom_title); diff --git a/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm b/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm index 7ca511b7109879..b6122c384bcae7 100644 --- a/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm +++ b/ios/chrome/browser/ui/autofill/save_card_infobar_controller.mm @@ -109,7 +109,7 @@ - (UIView*)infobarView { linkText.length())], nil]; // Append the link text to the message. - messageText += base::UTF8ToUTF16(" ") + linkText; + messageText += u" " + linkText; } message.messageText = base::SysUTF16ToNSString(messageText); [self.infoBarView setMessage:message]; diff --git a/ios/chrome/browser/ui/translate/translate_infobar_mediator_unittest.mm b/ios/chrome/browser/ui/translate/translate_infobar_mediator_unittest.mm index f54bc833e3c281..95e551882295f6 100644 --- a/ios/chrome/browser/ui/translate/translate_infobar_mediator_unittest.mm +++ b/ios/chrome/browser/ui/translate/translate_infobar_mediator_unittest.mm @@ -180,7 +180,7 @@ void CreateTranslateClient() { TEST_F(TranslateInfobarMediatorTest, TranslateOptionMenuItems) { // Set up what TranslateInfoBarDelegate should return. EXPECT_CALL(*GetDelegate(), source_language_name()) - .WillRepeatedly(testing::Return(base::UTF8ToUTF16("French"))); + .WillRepeatedly(testing::Return(u"French")); EXPECT_CALL(*GetDelegate(), ShouldAlwaysTranslate()) .WillOnce(testing::Return(true)); @@ -230,11 +230,11 @@ void CreateTranslateClient() { EXPECT_CALL(*GetDelegate(), language_code_at(0)) .WillOnce(testing::Return("en")); EXPECT_CALL(*GetDelegate(), language_name_at(0)) - .WillOnce(testing::Return(base::UTF8ToUTF16("English"))); + .WillOnce(testing::Return(u"English")); EXPECT_CALL(*GetDelegate(), language_code_at(2)) .WillOnce(testing::Return("fr")); EXPECT_CALL(*GetDelegate(), language_name_at(2)) - .WillOnce(testing::Return(base::UTF8ToUTF16("French"))); + .WillOnce(testing::Return(u"French")); LegacyTranslateInfobarMediator* translate_infobar_mediator = mediator(); translate_infobar_mediator.type = TranslatePopupMenuTypeLanguageSelection; diff --git a/ios/chrome/browser/web/window_open_by_dom_egtest.mm b/ios/chrome/browser/web/window_open_by_dom_egtest.mm index 47e3cba554db92..b3bc05a4b6ab88 100644 --- a/ios/chrome/browser/web/window_open_by_dom_egtest.mm +++ b/ios/chrome/browser/web/window_open_by_dom_egtest.mm @@ -33,9 +33,8 @@ id PopupBlocker() { return grey_allOf( grey_accessibilityID(kInfobarBannerViewIdentifier), - grey_accessibilityLabel( - base::SysUTF16ToNSString(l10n_util::GetStringFUTF16( - IDS_IOS_POPUPS_BLOCKED_MOBILE, base::UTF8ToUTF16("1")))), + grey_accessibilityLabel(base::SysUTF16ToNSString( + l10n_util::GetStringFUTF16(IDS_IOS_POPUPS_BLOCKED_MOBILE, u"1"))), nil); } diff --git a/ios/web/cookie_blocking_inttest.mm b/ios/web/cookie_blocking_inttest.mm index aee827b4ff4b33..1f2ab9d6337738 100644 --- a/ios/web/cookie_blocking_inttest.mm +++ b/ios/web/cookie_blocking_inttest.mm @@ -298,7 +298,7 @@ void SetUp() override { return web_state()->GetWebFramesManager()->GetAllWebFrames().size() == 2; })); - web_state()->ExecuteJavaScript(base::UTF8ToUTF16("delete docuemnt.cookie")); + web_state()->ExecuteJavaScript(u"delete docuemnt.cookie"); WebFrame* main_frame = web_state()->GetWebFramesManager()->GetMainWebFrame(); EXPECT_TRUE(web::test::SetCookie(main_frame, @"x", @"value")); @@ -414,7 +414,7 @@ void SetUp() override { return web_state()->GetWebFramesManager()->GetAllWebFrames().size() == 2; })); - web_state()->ExecuteJavaScript(base::UTF8ToUTF16("delete localStorage")); + web_state()->ExecuteJavaScript(u"delete localStorage"); WebFrame* main_frame = web_state()->GetWebFramesManager()->GetMainWebFrame(); @@ -537,7 +537,7 @@ void SetUp() override { return web_state()->GetWebFramesManager()->GetAllWebFrames().size() == 2; })); - web_state()->ExecuteJavaScript(base::UTF8ToUTF16("delete sessionStorage")); + web_state()->ExecuteJavaScript(u"delete sessionStorage"); NSString* error_message; WebFrame* main_frame = web_state()->GetWebFramesManager()->GetMainWebFrame(); diff --git a/ios/web/js_messaging/web_frames_manager_impl.mm b/ios/web/js_messaging/web_frames_manager_impl.mm index 3ec157fffb3f13..dd50d70fada8b6 100644 --- a/ios/web/js_messaging/web_frames_manager_impl.mm +++ b/ios/web/js_messaging/web_frames_manager_impl.mm @@ -42,7 +42,7 @@ void WebFramesManagerImpl::RegisterExistingFrames() { delegate_.GetWebState()->ExecuteJavaScript( - base::UTF8ToUTF16("__gCrWeb.message.getExistingFrames();")); + u"__gCrWeb.message.getExistingFrames();"); } void WebFramesManagerImpl::OnWebViewUpdated( diff --git a/ios/web/navigation/navigation_item_impl_unittest.mm b/ios/web/navigation/navigation_item_impl_unittest.mm index 43e33ac1e18fbf..52421993863a7d 100644 --- a/ios/web/navigation/navigation_item_impl_unittest.mm +++ b/ios/web/navigation/navigation_item_impl_unittest.mm @@ -51,7 +51,7 @@ void SetUp() override { #ifndef NDEBUG // Tests that the debug description is as expected. TEST_F(NavigationItemTest, Description) { - item_->SetTitle(base::UTF8ToUTF16("Title")); + item_->SetTitle(u"Title"); NSString* description = item_->GetDescription(); EXPECT_TRUE([description containsString:@"url:http://init.test/"]); EXPECT_TRUE([description containsString:@"originalurl:http://init.test/"]); diff --git a/ios/web/web_state/web_state_unittest.mm b/ios/web/web_state/web_state_unittest.mm index 81cec088853604..ac84acec897563 100644 --- a/ios/web/web_state/web_state_unittest.mm +++ b/ios/web/web_state/web_state_unittest.mm @@ -75,12 +75,12 @@ ASSERT_TRUE(LoadHtml("")); // Execute script without callback. - web_state()->ExecuteJavaScript(base::UTF8ToUTF16("window.foo = 'bar'")); + web_state()->ExecuteJavaScript(u"window.foo = 'bar'"); // Execute script with callback. __block std::unique_ptr execution_result; __block bool execution_complete = false; - web_state()->ExecuteJavaScript(base::UTF8ToUTF16("window.foo"), + web_state()->ExecuteJavaScript(u"window.foo", base::BindOnce(^(const base::Value* value) { execution_result = value->CreateDeepCopy(); execution_complete = true; diff --git a/ios/web_view/internal/cwv_download_task_unittest.mm b/ios/web_view/internal/cwv_download_task_unittest.mm index ab8dce4b909012..45d0b9094fcc35 100644 --- a/ios/web_view/internal/cwv_download_task_unittest.mm +++ b/ios/web_view/internal/cwv_download_task_unittest.mm @@ -163,7 +163,7 @@ bool FinishResponseWriter() WARN_UNUSED_RESULT { cwv_task_.originalURL); EXPECT_NSEQ(@"text/plain", cwv_task_.MIMEType); - fake_internal_task_->SetSuggestedFilename(base::UTF8ToUTF16("foo.txt")); + fake_internal_task_->SetSuggestedFilename(u"foo.txt"); EXPECT_NSEQ(@"foo.txt", cwv_task_.suggestedFileName); fake_internal_task_->SetTotalBytes(1024); diff --git a/net/ntlm/ntlm_unittest.cc b/net/ntlm/ntlm_unittest.cc index a3cc62d5861d38..ad3ab5bbdda1e2 100644 --- a/net/ntlm/ntlm_unittest.cc +++ b/net/ntlm/ntlm_unittest.cc @@ -106,8 +106,8 @@ TEST(NtlmTest, GenerateNtlmHashV1PasswordSpecTests) { } TEST(NtlmTest, GenerateNtlmHashV1PasswordChangesHash) { - std::u16string password1 = base::UTF8ToUTF16("pwd01"); - std::u16string password2 = base::UTF8ToUTF16("pwd02"); + std::u16string password1 = u"pwd01"; + std::u16string password2 = u"pwd02"; uint8_t hash1[kNtlmHashLen]; uint8_t hash2[kNtlmHashLen]; diff --git a/remoting/host/chromeos/clipboard_aura_unittest.cc b/remoting/host/chromeos/clipboard_aura_unittest.cc index a758cc3d62a5a1..db080edf891c8d 100644 --- a/remoting/host/chromeos/clipboard_aura_unittest.cc +++ b/remoting/host/chromeos/clipboard_aura_unittest.cc @@ -112,7 +112,7 @@ TEST_F(ClipboardAuraTest, MonitorClipboardChanges) { { // |clipboard_writer| will write to the clipboard when it goes out of scope. ui::ScopedClipboardWriter clipboard_writer(ui::ClipboardBuffer::kCopyPaste); - clipboard_writer.WriteText(base::UTF8ToUTF16("Test data.")); + clipboard_writer.WriteText(u"Test data."); } EXPECT_CALL(*client_clipboard_, diff --git a/rlz/lib/machine_id_unittest.cc b/rlz/lib/machine_id_unittest.cc index d0db0ebb7278bd..2221bdebc4c921 100644 --- a/rlz/lib/machine_id_unittest.cc +++ b/rlz/lib/machine_id_unittest.cc @@ -14,8 +14,7 @@ // This test will fail if the behavior of GetMachineId changes. TEST(MachineDealCodeTestMachineId, MachineId) { - std::u16string computer_sid( - base::UTF8ToUTF16("S-1-5-21-2345599882-2448789067-1921365677")); + std::u16string computer_sid(u"S-1-5-21-2345599882-2448789067-1921365677"); std::string id; rlz_lib::testing::GetMachineIdImpl(computer_sid, -1643738288, &id); EXPECT_STREQ("A341BA986A7E86840688977FCF20C86E253F00919E068B50F8", diff --git a/rlz/mac/lib/machine_id_mac.cc b/rlz/mac/lib/machine_id_mac.cc index 756d00082a122c..4b4fcc073edcaa 100644 --- a/rlz/mac/lib/machine_id_mac.cc +++ b/rlz/mac/lib/machine_id_mac.cc @@ -116,8 +116,8 @@ bool GetRawMachineId(std::u16string* data, int* more_data) { std::string serial = base::mac::GetPlatformSerialNumber(); if (!serial.empty()) { if (!data->empty()) - *data += base::UTF8ToUTF16(" "); - *data += base::UTF8ToUTF16("serial:") + base::UTF8ToUTF16(serial); + *data += u" "; + *data += u"serial:" + base::UTF8ToUTF16(serial); } // On windows, this is set to the volume id. Since it's not scrambled before diff --git a/services/device/public/cpp/bluetooth/bluetooth_utils_unittest.cc b/services/device/public/cpp/bluetooth/bluetooth_utils_unittest.cc index 0a3b9ba392b671..21755d23d54892 100644 --- a/services/device/public/cpp/bluetooth/bluetooth_utils_unittest.cc +++ b/services/device/public/cpp/bluetooth/bluetooth_utils_unittest.cc @@ -32,9 +32,8 @@ TEST(BluetoothUtilsTest, info->address = kAddress; info->name = base::nullopt; info->device_type = BluetoothDeviceInfo::DeviceType::kUnknown; - EXPECT_EQ( - base::UTF8ToUTF16("Unknown or Unsupported Device (00:00:00:00:00:00)"), - GetBluetoothDeviceNameForDisplay(info)); + EXPECT_EQ(u"Unknown or Unsupported Device (00:00:00:00:00:00)", + GetBluetoothDeviceNameForDisplay(info)); } TEST(BluetoothUtilsTest, @@ -43,7 +42,7 @@ TEST(BluetoothUtilsTest, info->address = kAddress; info->name = base::nullopt; info->device_type = BluetoothDeviceInfo::DeviceType::kPeripheral; - EXPECT_EQ(base::UTF8ToUTF16("Peripheral (00:00:00:00:00:00)"), + EXPECT_EQ(u"Peripheral (00:00:00:00:00:00)", GetBluetoothDeviceNameForDisplay(info)); } @@ -53,7 +52,7 @@ TEST(BluetoothUtilsTest, info->address = kAddress; info->name = base::nullopt; info->device_type = BluetoothDeviceInfo::DeviceType::kComputer; - EXPECT_EQ(base::UTF8ToUTF16("Computer (00:00:00:00:00:00)"), + EXPECT_EQ(u"Computer (00:00:00:00:00:00)", GetBluetoothDeviceNameForDisplay(info)); } @@ -89,7 +88,7 @@ TEST(BluetoothUtilsTest, GetBluetoothDeviceNameForDisplay_EmptyName) { info->address = kAddress; info->name = kEmptyName; info->device_type = BluetoothDeviceInfo::DeviceType::kComputer; - EXPECT_EQ(base::UTF8ToUTF16("Computer (00:00:00:00:00:00)"), + EXPECT_EQ(u"Computer (00:00:00:00:00:00)", GetBluetoothDeviceNameForDisplay(info)); } @@ -98,7 +97,7 @@ TEST(BluetoothUtilsTest, GetBluetoothDeviceNameForDisplay_WhitespaceName) { info->address = kAddress; info->name = kWhitespaceName; info->device_type = BluetoothDeviceInfo::DeviceType::kComputer; - EXPECT_EQ(base::UTF8ToUTF16("Computer (00:00:00:00:00:00)"), + EXPECT_EQ(u"Computer (00:00:00:00:00:00)", GetBluetoothDeviceNameForDisplay(info)); } @@ -108,14 +107,13 @@ TEST(BluetoothUtilsTest, info->address = kAddress; info->name = kUnicodeWhitespaceName; info->device_type = BluetoothDeviceInfo::DeviceType::kComputer; - EXPECT_EQ(base::UTF8ToUTF16("Computer (00:00:00:00:00:00)"), + EXPECT_EQ(u"Computer (00:00:00:00:00:00)", GetBluetoothDeviceNameForDisplay(info)); } TEST(BluetoothUtilsTest, GetBluetoothAddressForDisplay) { - EXPECT_EQ( - base::UTF8ToUTF16("AA:BB:CC:00:11:22"), - GetBluetoothAddressForDisplay({0xAA, 0xBB, 0xCC, 0x00, 0x11, 0x22})); + EXPECT_EQ(u"AA:BB:CC:00:11:22", GetBluetoothAddressForDisplay( + {0xAA, 0xBB, 0xCC, 0x00, 0x11, 0x22})); } static std::u16string LabelFromTypeWithName( @@ -142,17 +140,17 @@ TEST(BluetoothUtilsTest, GetBluetoothDeviceLabelForAccessibility) { kUnicodeName)); EXPECT_EQ(l10n_util::GetStringFUTF16( IDS_BLUETOOTH_ACCESSIBILITY_DEVICE_TYPE_KEYBOARD, - base::UTF8ToUTF16("00:00:00:00:00:00")), + u"00:00:00:00:00:00"), LabelFromTypeWithName(BluetoothDeviceInfo::DeviceType::kKeyboard, kEmptyName)); EXPECT_EQ( l10n_util::GetStringFUTF16(IDS_BLUETOOTH_ACCESSIBILITY_DEVICE_TYPE_VIDEO, - base::UTF8ToUTF16("00:00:00:00:00:00")), + u"00:00:00:00:00:00"), LabelFromTypeWithName(BluetoothDeviceInfo::DeviceType::kVideo, kWhitespaceName)); EXPECT_EQ(l10n_util::GetStringFUTF16( IDS_BLUETOOTH_ACCESSIBILITY_DEVICE_TYPE_JOYSTICK, - base::UTF8ToUTF16("00:00:00:00:00:00")), + u"00:00:00:00:00:00"), LabelFromTypeWithName(BluetoothDeviceInfo::DeviceType::kJoystick, kUnicodeWhitespaceName)); } diff --git a/third_party/blink/common/messaging/web_message_port_unittest.cc b/third_party/blink/common/messaging/web_message_port_unittest.cc index 7a74ef6479e43e..dd2ceb50be94e1 100644 --- a/third_party/blink/common/messaging/web_message_port_unittest.cc +++ b/third_party/blink/common/messaging/web_message_port_unittest.cc @@ -86,7 +86,7 @@ TEST(WebMessagePortTest, EndToEnd) { EXPECT_TRUE(port1.CanPostMessage()); // Send a simple string-only message one way from port 0 to port 1. - std::u16string message(base::UTF8ToUTF16("foo")); + std::u16string message(u"foo"); { base::RunLoop run_loop; EXPECT_CALL(receiver1, OnMessage(_)) diff --git a/third_party/blink/common/page_state/page_state_serialization_unittest.cc b/third_party/blink/common/page_state/page_state_serialization_unittest.cc index 2f2ee7f3eab450..34bf729141fcdf 100644 --- a/third_party/blink/common/page_state/page_state_serialization_unittest.cc +++ b/third_party/blink/common/page_state/page_state_serialization_unittest.cc @@ -118,17 +118,15 @@ class PageStateSerializationTest : public testing::Test { public: void PopulateFrameState(ExplodedFrameState* frame_state) { // Invent some data for the various fields. - frame_state->url_string = base::UTF8ToUTF16("http://dev.chromium.org/"); - frame_state->referrer = - base::UTF8ToUTF16("https://www.google.com/search?q=dev.chromium.org"); + frame_state->url_string = u"http://dev.chromium.org/"; + frame_state->referrer = u"https://www.google.com/search?q=dev.chromium.org"; frame_state->referrer_policy = network::mojom::ReferrerPolicy::kAlways; - frame_state->target = base::UTF8ToUTF16("foo"); + frame_state->target = u"foo"; frame_state->state_object = base::nullopt; - frame_state->document_state.push_back(base::UTF8ToUTF16("1")); - frame_state->document_state.push_back(base::UTF8ToUTF16("q")); - frame_state->document_state.push_back(base::UTF8ToUTF16("text")); - frame_state->document_state.push_back( - base::UTF8ToUTF16("dev.chromium.org")); + frame_state->document_state.push_back(u"1"); + frame_state->document_state.push_back(u"q"); + frame_state->document_state.push_back(u"text"); + frame_state->document_state.push_back(u"dev.chromium.org"); frame_state->scroll_restoration_type = mojom::ScrollRestorationType::kManual; frame_state->visual_viewport_scroll_offset = gfx::PointF(10, 15); @@ -136,7 +134,7 @@ class PageStateSerializationTest : public testing::Test { frame_state->item_sequence_number = 1; frame_state->document_sequence_number = 2; frame_state->page_scale_factor = 2.0; - frame_state->scroll_anchor_selector = base::UTF8ToUTF16("#selector"); + frame_state->scroll_anchor_selector = u"#selector"; frame_state->scroll_anchor_offset = gfx::PointF(2.5, 3.5); frame_state->scroll_anchor_simhash = 12345; } @@ -147,7 +145,7 @@ class PageStateSerializationTest : public testing::Test { http_body->request_body = new network::ResourceRequestBody(); http_body->request_body->set_identifier(12345); http_body->contains_passwords = false; - http_body->http_content_type = base::UTF8ToUTF16("text/foo"); + http_body->http_content_type = u"text/foo"; std::string test_body("foo"); http_body->request_body->AppendBytes(test_body.data(), test_body.size()); @@ -183,11 +181,11 @@ class PageStateSerializationTest : public testing::Test { // with the |version| where the new field is being introduced (set the // |version|-dependent test value above - next to and similarly to how // |initiator_origin| is handled). - frame_state->url_string = base::UTF8ToUTF16("http://chromium.org/"); - frame_state->referrer = base::UTF8ToUTF16("http://google.com/"); + frame_state->url_string = u"http://chromium.org/"; + frame_state->referrer = u"http://google.com/"; frame_state->referrer_policy = network::mojom::ReferrerPolicy::kDefault; if (!is_child) - frame_state->target = base::UTF8ToUTF16("target"); + frame_state->target = u"target"; frame_state->scroll_restoration_type = mojom::ScrollRestorationType::kAuto; frame_state->visual_viewport_scroll_offset = gfx::PointF(-1, -1); frame_state->scroll_offset = gfx::Point(42, -42); @@ -197,16 +195,16 @@ class PageStateSerializationTest : public testing::Test { frame_state->document_state.push_back(base::UTF8ToUTF16( "\n\r?% WebKit serialized form state version 8 \n\r=&")); - frame_state->document_state.push_back(base::UTF8ToUTF16("form key")); - frame_state->document_state.push_back(base::UTF8ToUTF16("1")); - frame_state->document_state.push_back(base::UTF8ToUTF16("foo")); - frame_state->document_state.push_back(base::UTF8ToUTF16("file")); - frame_state->document_state.push_back(base::UTF8ToUTF16("2")); - frame_state->document_state.push_back(base::UTF8ToUTF16("file.txt")); - frame_state->document_state.push_back(base::UTF8ToUTF16("displayName")); + frame_state->document_state.push_back(u"form key"); + frame_state->document_state.push_back(u"1"); + frame_state->document_state.push_back(u"foo"); + frame_state->document_state.push_back(u"file"); + frame_state->document_state.push_back(u"2"); + frame_state->document_state.push_back(u"file.txt"); + frame_state->document_state.push_back(u"displayName"); if (!is_child) { - frame_state->http_body.http_content_type = base::UTF8ToUTF16("foo/bar"); + frame_state->http_body.http_content_type = u"foo/bar"; frame_state->http_body.request_body = new network::ResourceRequestBody(); frame_state->http_body.request_body->set_identifier(789); @@ -230,7 +228,7 @@ class PageStateSerializationTest : public testing::Test { void PopulatePageStateForBackwardsCompatTest(ExplodedPageState* page_state, int version) { - page_state->referenced_files.push_back(base::UTF8ToUTF16("file.txt")); + page_state->referenced_files.push_back(u"file.txt"); PopulateFrameStateForBackwardsCompatTest(&page_state->top, false, version); } @@ -592,7 +590,7 @@ TEST_F(PageStateSerializationTest, BackwardsCompat_v28) { TEST_F(PageStateSerializationTest, BackwardsCompat_ReferencedFiles) { ExplodedPageState state; - state.referenced_files.push_back(base::UTF8ToUTF16("file.txt")); + state.referenced_files.push_back(u"file.txt"); ExplodedPageState saved_state; ReadBackwardsCompatPageState("referenced_files", 26, &saved_state); @@ -689,7 +687,7 @@ TEST_F(PageStateSerializationTest, BackwardsCompat_HttpBody) { http_body.request_body = new network::ResourceRequestBody(); http_body.request_body->set_identifier(12345); http_body.contains_passwords = false; - http_body.http_content_type = base::UTF8ToUTF16("text/foo"); + http_body.http_content_type = u"text/foo"; std::string test_body("foo"); http_body.request_body->AppendBytes(test_body.data(), test_body.size()); diff --git a/third_party/blink/renderer/modules/manifest/manifest_type_converters_unittest.cc b/third_party/blink/renderer/modules/manifest/manifest_type_converters_unittest.cc index ed57e1c96b82dc..632e4caa4ab51d 100644 --- a/third_party/blink/renderer/modules/manifest/manifest_type_converters_unittest.cc +++ b/third_party/blink/renderer/modules/manifest/manifest_type_converters_unittest.cc @@ -66,7 +66,7 @@ TEST_F(ManifestTypeConvertersTest, BasicFileHandlerIsCorrectlyConverted) { EXPECT_TRUE(base::EqualsASCII(manifest.file_handlers[0].name, "name")); ASSERT_EQ(manifest.file_handlers[0].accept.size(), 1u); - std::u16string mime = base::UTF8ToUTF16("image/png"); + std::u16string mime = u"image/png"; ASSERT_EQ(manifest.file_handlers[0].accept.count(mime), 1u); EXPECT_EQ(manifest.file_handlers[0].accept[mime].size(), 1u); EXPECT_TRUE( diff --git a/ui/accessibility/ax_text_utils_unittest.cc b/ui/accessibility/ax_text_utils_unittest.cc index 1adc84f1c3246a..8fd8a3f7186350 100644 --- a/ui/accessibility/ax_text_utils_unittest.cc +++ b/ui/accessibility/ax_text_utils_unittest.cc @@ -266,7 +266,7 @@ TEST(AXTextUtils, FindAccessibleTextBoundaryCharacter) { } TEST(AXTextUtils, GetWordOffsetsEmptyTest) { - const std::u16string text = base::UTF8ToUTF16(""); + const std::u16string text = u""; std::vector word_starts = GetWordStartOffsets(text); std::vector word_ends = GetWordEndOffsets(text); EXPECT_EQ(0UL, word_starts.size()); @@ -274,18 +274,18 @@ TEST(AXTextUtils, GetWordOffsetsEmptyTest) { } TEST(AXTextUtils, GetWordStartOffsetsBasicTest) { - const std::u16string text = base::UTF8ToUTF16("This is very simple input"); + const std::u16string text = u"This is very simple input"; EXPECT_THAT(GetWordStartOffsets(text), testing::ElementsAre(0, 5, 8, 13, 20)); } TEST(AXTextUtils, GetWordEndOffsetsBasicTest) { - const std::u16string text = base::UTF8ToUTF16("This is very simple input"); + const std::u16string text = u"This is very simple input"; EXPECT_THAT(GetWordEndOffsets(text), testing::ElementsAre(4, 7, 12, 19, 25)); } TEST(AXTextUtils, GetWordStartOffsetsMalformedInputTest) { const std::u16string text = - base::UTF8ToUTF16("..we *## should parse $#@$ through bad ,, input"); + u"..we *## should parse $#@$ through bad ,, input"; EXPECT_THAT(GetWordStartOffsets(text), testing::ElementsAre(2, 9, 16, 27, 35, 43)); } @@ -303,12 +303,12 @@ TEST(AXTextUtils, GetSentenceEndOffsetsBasicTest) { } TEST(AXTextUtils, GetSentenceStartOffsetsMalformedInputTest) { - const std::u16string text = base::UTF8ToUTF16("is the first ... second."); + const std::u16string text = u"is the first ... second."; EXPECT_THAT(GetSentenceStartOffsets(text), testing::ElementsAre(0)); } TEST(AXTextUtils, GetSentenceEndOffsetsMalformedInputTest) { - const std::u16string text = base::UTF8ToUTF16("is the first ... second."); + const std::u16string text = u"is the first ... second."; EXPECT_THAT(GetSentenceEndOffsets(text), testing::ElementsAre(24)); } diff --git a/ui/accessibility/platform/ax_platform_node_base_unittest.cc b/ui/accessibility/platform/ax_platform_node_base_unittest.cc index a88b1036d0d770..37683517a0920e 100644 --- a/ui/accessibility/platform/ax_platform_node_base_unittest.cc +++ b/ui/accessibility/platform/ax_platform_node_base_unittest.cc @@ -71,19 +71,19 @@ TEST(AXPlatformNodeBaseTest, GetHypertext) { AXPlatformNodeBase* root = static_cast( TestAXNodeWrapper::GetOrCreate(&tree, tree.root())->ax_platform_node()); - EXPECT_EQ(root->GetHypertext(), base::UTF8ToUTF16("text1text2text3")); + EXPECT_EQ(root->GetHypertext(), u"text1text2text3"); AXPlatformNodeBase* text1 = static_cast( AXPlatformNode::FromNativeViewAccessible(root->ChildAtIndex(0))); - EXPECT_EQ(text1->GetHypertext(), base::UTF8ToUTF16("text1")); + EXPECT_EQ(text1->GetHypertext(), u"text1"); AXPlatformNodeBase* text2 = static_cast( AXPlatformNode::FromNativeViewAccessible(root->ChildAtIndex(1))); - EXPECT_EQ(text2->GetHypertext(), base::UTF8ToUTF16("text2")); + EXPECT_EQ(text2->GetHypertext(), u"text2"); AXPlatformNodeBase* text3 = static_cast( AXPlatformNode::FromNativeViewAccessible(root->ChildAtIndex(2))); - EXPECT_EQ(text3->GetHypertext(), base::UTF8ToUTF16("text3")); + EXPECT_EQ(text3->GetHypertext(), u"text3"); } TEST(AXPlatformNodeBaseTest, GetHypertextIgnoredContainerSiblings) { @@ -130,25 +130,22 @@ TEST(AXPlatformNodeBaseTest, GetHypertextIgnoredContainerSiblings) { AXPlatformNodeBase* root = static_cast( TestAXNodeWrapper::GetOrCreate(&tree, tree.root())->ax_platform_node()); - EXPECT_EQ(root->GetHypertext(), base::UTF8ToUTF16("text1text2text3")); + EXPECT_EQ(root->GetHypertext(), u"text1text2text3"); AXPlatformNodeBase* text1_ignored_container = static_cast( AXPlatformNode::FromNativeViewAccessible(root->ChildAtIndex(0))); - EXPECT_EQ(text1_ignored_container->GetHypertext(), - base::UTF8ToUTF16("text1")); + EXPECT_EQ(text1_ignored_container->GetHypertext(), u"text1"); AXPlatformNodeBase* text2_ignored_container = static_cast( AXPlatformNode::FromNativeViewAccessible(root->ChildAtIndex(1))); - EXPECT_EQ(text2_ignored_container->GetHypertext(), - base::UTF8ToUTF16("text2")); + EXPECT_EQ(text2_ignored_container->GetHypertext(), u"text2"); AXPlatformNodeBase* text3_ignored_container = static_cast( AXPlatformNode::FromNativeViewAccessible(root->ChildAtIndex(2))); - EXPECT_EQ(text3_ignored_container->GetHypertext(), - base::UTF8ToUTF16("text3")); + EXPECT_EQ(text3_ignored_container->GetHypertext(), u"text3"); } TEST(AXPlatformNodeBaseTest, InnerTextIgnoresInvisibleAndIgnored) { @@ -175,32 +172,32 @@ TEST(AXPlatformNodeBaseTest, InnerTextIgnoresInvisibleAndIgnored) { // determine if it should enable accessibility. AXPlatformNodeBase::NotifyAddAXModeFlags(kAXModeComplete); - EXPECT_EQ(root->GetInnerText(), base::UTF8ToUTF16("abde")); + EXPECT_EQ(root->GetInnerText(), u"abde"); // Setting invisible or ignored on a static text node causes it to be included // or excluded from the root node's inner text: { SetIsInvisible(&tree, 2, true); - EXPECT_EQ(root->GetInnerText(), base::UTF8ToUTF16("bde")); + EXPECT_EQ(root->GetInnerText(), u"bde"); SetIsInvisible(&tree, 2, false); - EXPECT_EQ(root->GetInnerText(), base::UTF8ToUTF16("abde")); + EXPECT_EQ(root->GetInnerText(), u"abde"); SetRole(&tree, 2, ax::mojom::Role::kIgnored); - EXPECT_EQ(root->GetInnerText(), base::UTF8ToUTF16("bde")); + EXPECT_EQ(root->GetInnerText(), u"bde"); SetRole(&tree, 2, ax::mojom::Role::kStaticText); - EXPECT_EQ(root->GetInnerText(), base::UTF8ToUTF16("abde")); + EXPECT_EQ(root->GetInnerText(), u"abde"); } // Setting invisible or ignored on a group node has no effect on the inner // text: { SetIsInvisible(&tree, 4, true); - EXPECT_EQ(root->GetInnerText(), base::UTF8ToUTF16("abde")); + EXPECT_EQ(root->GetInnerText(), u"abde"); SetRole(&tree, 4, ax::mojom::Role::kIgnored); - EXPECT_EQ(root->GetInnerText(), base::UTF8ToUTF16("abde")); + EXPECT_EQ(root->GetInnerText(), u"abde"); } } diff --git a/ui/base/clipboard/clipboard_test_template.h b/ui/base/clipboard/clipboard_test_template.h index ea6368ca3151de..9b61be93f13184 100644 --- a/ui/base/clipboard/clipboard_test_template.h +++ b/ui/base/clipboard/clipboard_test_template.h @@ -991,9 +991,9 @@ TYPED_TEST(ClipboardTest, HtmlTest) { TYPED_TEST(ClipboardTest, WriteEverything) { { ScopedClipboardWriter writer(ClipboardBuffer::kCopyPaste); - writer.WriteText(UTF8ToUTF16("foo")); - writer.WriteHTML(UTF8ToUTF16("foo"), "bar"); - writer.WriteBookmark(UTF8ToUTF16("foo"), "bar"); + writer.WriteText(u"foo"); + writer.WriteHTML(u"foo", "bar"); + writer.WriteBookmark(u"foo", "bar"); writer.WriteHyperlink(ASCIIToUTF16("foo"), "bar"); writer.WriteWebSmartPaste(); // Left out: WriteFile, WriteFiles, WriteBitmapFromPixels, WritePickledData. @@ -1016,7 +1016,7 @@ TYPED_TEST(ClipboardTest, GetSequenceNumber) { { ScopedClipboardWriter writer(ClipboardBuffer::kCopyPaste); - writer.WriteText(UTF8ToUTF16("World")); + writer.WriteText(u"World"); } // On some platforms, the sequence number is updated by a UI callback so pump @@ -1079,7 +1079,7 @@ TYPED_TEST(ClipboardTest, WriteImageEmptyParams) { // restrict the clipboard data. TYPED_TEST(ClipboardTest, PolicyAllowDataRead) { auto policy_controller = std::make_unique(); - const std::u16string kTestText(base::UTF8ToUTF16("World")); + const std::u16string kTestText(u"World"); { ScopedClipboardWriter writer( ClipboardBuffer::kCopyPaste, @@ -1099,7 +1099,7 @@ TYPED_TEST(ClipboardTest, PolicyAllowDataRead) { // restricted it. TYPED_TEST(ClipboardTest, PolicyDisallow_ReadText) { auto policy_controller = std::make_unique(); - const std::u16string kTestText(base::UTF8ToUTF16("World")); + const std::u16string kTestText(u"World"); { ScopedClipboardWriter writer( ClipboardBuffer::kCopyPaste, diff --git a/ui/base/ime/candidate_window_unittest.cc b/ui/base/ime/candidate_window_unittest.cc index fa1781f92df14f..8179cb8244cc6a 100644 --- a/ui/base/ime/candidate_window_unittest.cc +++ b/ui/base/ime/candidate_window_unittest.cc @@ -41,8 +41,8 @@ TEST(CandidateWindow, IsEqualTest) { CandidateWindow cw1; CandidateWindow cw2; - const std::u16string kSampleString1 = base::UTF8ToUTF16("Sample 1"); - const std::u16string kSampleString2 = base::UTF8ToUTF16("Sample 2"); + const std::u16string kSampleString1 = u"Sample 1"; + const std::u16string kSampleString2 = u"Sample 2"; EXPECT_TRUE(cw1.IsEqual(cw2)); EXPECT_TRUE(cw2.IsEqual(cw1)); @@ -138,7 +138,7 @@ TEST(CandidateWindow, CopyFromTest) { CandidateWindow cw1; CandidateWindow cw2; - const std::u16string kSampleString = base::UTF8ToUTF16("Sample"); + const std::u16string kSampleString = u"Sample"; cw1.set_page_size(1); cw1.set_cursor_position(2); diff --git a/ui/base/ime/chromeos/input_method_chromeos_unittest.cc b/ui/base/ime/chromeos/input_method_chromeos_unittest.cc index 25d9b26052ddb8..37af96430d6ce2 100644 --- a/ui/base/ime/chromeos/input_method_chromeos_unittest.cc +++ b/ui/base/ime/chromeos/input_method_chromeos_unittest.cc @@ -986,7 +986,7 @@ TEST_F(InputMethodChromeOSTest, ConfirmCompositionText_SetComposition) { ime_->OnTextInputTypeChanged(this); CompositionText composition_text; - composition_text.text = base::UTF8ToUTF16("hello"); + composition_text.text = u"hello"; SetCompositionText(composition_text); ime_->ConfirmCompositionText(/* reset_engine */ true, /* keep_selection */ false); @@ -1001,7 +1001,7 @@ TEST_F(InputMethodChromeOSTest, ConfirmCompositionText_SetCompositionRange) { ime_->OnTextInputTypeChanged(this); // Place some text. - surrounding_text_ = UTF8ToUTF16("abc"); + surrounding_text_ = u"abc"; text_range_ = gfx::Range(0, 3); // "abc" is in composition. Put the two characters in composition. diff --git a/ui/base/ime/chromeos/input_method_descriptor_unittest.cc b/ui/base/ime/chromeos/input_method_descriptor_unittest.cc index 7db28d031d45c1..23ac53f7e01ca9 100644 --- a/ui/base/ime/chromeos/input_method_descriptor_unittest.cc +++ b/ui/base/ime/chromeos/input_method_descriptor_unittest.cc @@ -71,12 +71,12 @@ TEST(InputMethodDescriptorTest, GetIndicatorTest) { { InputMethodDescriptor desc = CreateDesc("zh-t-i0-pinyin", "us", {"zh-CN"}, "拼", true); - EXPECT_EQ(base::UTF8ToUTF16("拼"), desc.GetIndicator()); + EXPECT_EQ(u"拼", desc.GetIndicator()); } { InputMethodDescriptor desc = CreateDesc("zh-hant-t-i0-und", "us", {"zh-TW"}, "注", true); - EXPECT_EQ(base::UTF8ToUTF16("注"), desc.GetIndicator()); + EXPECT_EQ(u"注", desc.GetIndicator()); } } diff --git a/ui/base/ime/composition_text_unittest.cc b/ui/base/ime/composition_text_unittest.cc index 53ef6ee45c5f42..95ccec47b6fc59 100644 --- a/ui/base/ime/composition_text_unittest.cc +++ b/ui/base/ime/composition_text_unittest.cc @@ -12,7 +12,7 @@ namespace ui { TEST(CompositionTextTest, CopyTest) { - const std::u16string kSampleText = base::UTF8ToUTF16("Sample Text"); + const std::u16string kSampleText = u"Sample Text"; const ImeTextSpan kSampleUnderline1( ImeTextSpan::Type::kComposition, 10, 20, ImeTextSpan::Thickness::kThin, ImeTextSpan::UnderlineStyle::kSolid, SK_ColorTRANSPARENT); diff --git a/ui/base/l10n/l10n_util_unittest.cc b/ui/base/l10n/l10n_util_unittest.cc index 91a6f5be64d721..2a0c7f16b53a88 100644 --- a/ui/base/l10n/l10n_util_unittest.cc +++ b/ui/base/l10n/l10n_util_unittest.cc @@ -59,16 +59,14 @@ TEST_F(L10nUtilTest, GetString) { std::string s = l10n_util::GetStringUTF8(IDS_SIMPLE); EXPECT_EQ(std::string("Hello World!"), s); - s = l10n_util::GetStringFUTF8(IDS_PLACEHOLDERS, - UTF8ToUTF16("chrome"), - UTF8ToUTF16("10")); + s = l10n_util::GetStringFUTF8(IDS_PLACEHOLDERS, u"chrome", u"10"); EXPECT_EQ(std::string("Hello, chrome. Your number is 10."), s); std::u16string s16 = l10n_util::GetStringFUTF16Int(IDS_PLACEHOLDERS_2, 20); // Consecutive '$' characters override any placeholder functionality. // See //base/strings/string_util.h ReplaceStringPlaceholders(). - EXPECT_EQ(UTF8ToUTF16("You owe me $$1."), s16); + EXPECT_EQ(u"You owe me $$1.", s16); } #if !defined(OS_APPLE) && !defined(OS_ANDROID) @@ -387,17 +385,17 @@ TEST_F(L10nUtilTest, GetAppLocale) { TEST_F(L10nUtilTest, SortStringsUsingFunction) { std::vector> strings; - strings.push_back(std::make_unique(UTF8ToUTF16("C"))); - strings.push_back(std::make_unique(UTF8ToUTF16("d"))); - strings.push_back(std::make_unique(UTF8ToUTF16("b"))); - strings.push_back(std::make_unique(UTF8ToUTF16("a"))); + strings.push_back(std::make_unique(u"C")); + strings.push_back(std::make_unique(u"d")); + strings.push_back(std::make_unique(u"b")); + strings.push_back(std::make_unique(u"a")); l10n_util::SortStringsUsingMethod("en-US", &strings, &StringWrapper::string); - ASSERT_TRUE(UTF8ToUTF16("a") == strings[0]->string()); - ASSERT_TRUE(UTF8ToUTF16("b") == strings[1]->string()); - ASSERT_TRUE(UTF8ToUTF16("C") == strings[2]->string()); - ASSERT_TRUE(UTF8ToUTF16("d") == strings[3]->string()); + ASSERT_TRUE(u"a" == strings[0]->string()); + ASSERT_TRUE(u"b" == strings[1]->string()); + ASSERT_TRUE(u"C" == strings[2]->string()); + ASSERT_TRUE(u"d" == strings[3]->string()); } /** diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index cc2615b8003a9c..bb1381fd20f963 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -492,11 +492,11 @@ std::u16string ResourceBundle::MaybeMangleLocalizedString( // For a string S, produce [[ --- S --- ]], where the number of dashes is 1/4 // of the number of characters in S. This makes S something around 50-75% // longer, except for extremely short strings, which get > 100% longer. - std::u16string start_marker = base::UTF8ToUTF16("[["); - std::u16string end_marker = base::UTF8ToUTF16("]]"); + std::u16string start_marker = u"[["; + std::u16string end_marker = u"]]"; std::u16string dashes = std::u16string(str.size() / 4, '-'); return base::JoinString({start_marker, dashes, str, dashes, end_marker}, - base::UTF8ToUTF16(" ")); + u" "); } std::string ResourceBundle::ReloadLocaleResources( diff --git a/ui/gfx/bidi_line_iterator_unittest.cc b/ui/gfx/bidi_line_iterator_unittest.cc index 7f8f58b03cf6db..d8dbc51cfd61d8 100644 --- a/ui/gfx/bidi_line_iterator_unittest.cc +++ b/ui/gfx/bidi_line_iterator_unittest.cc @@ -26,7 +26,7 @@ class BiDiLineIteratorTest }; TEST_P(BiDiLineIteratorTest, OnlyLTR) { - iterator()->Open(base::UTF8ToUTF16("abc 😁 测试"), GetParam()); + iterator()->Open(u"abc 😁 测试", GetParam()); ASSERT_EQ(1, iterator()->CountRuns()); int start, length; @@ -45,7 +45,7 @@ TEST_P(BiDiLineIteratorTest, OnlyLTR) { } TEST_P(BiDiLineIteratorTest, OnlyRTL) { - iterator()->Open(base::UTF8ToUTF16("מה השעה"), GetParam()); + iterator()->Open(u"מה השעה", GetParam()); ASSERT_EQ(1, iterator()->CountRuns()); int start, length; @@ -61,8 +61,7 @@ TEST_P(BiDiLineIteratorTest, OnlyRTL) { } TEST_P(BiDiLineIteratorTest, Mixed) { - iterator()->Open(base::UTF8ToUTF16("אני משתמש ב- Chrome כדפדפן האינטרנט שלי"), - GetParam()); + iterator()->Open(u"אני משתמש ב- Chrome כדפדפן האינטרנט שלי", GetParam()); ASSERT_EQ(3, iterator()->CountRuns()); // We'll get completely different results depending on the top-level paragraph diff --git a/ui/gfx/font_fallback_mac_unittest.cc b/ui/gfx/font_fallback_mac_unittest.cc index 9c4d7529dee087..94dadcac848ca9 100644 --- a/ui/gfx/font_fallback_mac_unittest.cc +++ b/ui/gfx/font_fallback_mac_unittest.cc @@ -32,7 +32,7 @@ TEST(FontFallbackMacTest, GetFallbackFont) { Font arial("Helvetica", 12); const std::u16string ascii = base::ASCIIToUTF16("abc"); const std::u16string hebrew = u"\x5d0\x5d1\x5d2"; - const std::u16string emoji = base::UTF8ToUTF16("😋"); + const std::u16string emoji = u"😋"; Font fallback; EXPECT_TRUE( diff --git a/ui/message_center/message_center_impl_unittest.cc b/ui/message_center/message_center_impl_unittest.cc index fa291c6c0126fe..f66cc60818b262 100644 --- a/ui/message_center/message_center_impl_unittest.cc +++ b/ui/message_center/message_center_impl_unittest.cc @@ -235,11 +235,11 @@ class MessageCenterImplTest : public testing::Test { NotificationType type, scoped_refptr delegate) { RichNotificationData optional_fields; - optional_fields.buttons.emplace_back(UTF8ToUTF16("foo")); - optional_fields.buttons.emplace_back(UTF8ToUTF16("foo")); + optional_fields.buttons.emplace_back(u"foo"); + optional_fields.buttons.emplace_back(u"foo"); return std::make_unique( - type, id, UTF8ToUTF16("title"), UTF8ToUTF16(id), - gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + type, id, u"title", UTF8ToUTF16(id), gfx::Image() /* icon */, + std::u16string() /* display_source */, GURL(), NotifierId(NotifierType::APPLICATION, notifier_id), optional_fields, delegate); } @@ -473,10 +473,9 @@ TEST_F(MessageCenterImplTest, PopupTimersControllerRestartOnUpdate) { NotifierId notifier_id(GURL("https://example.com")); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id, RichNotificationData(), nullptr)); std::unique_ptr popup_timers_controller = std::make_unique(message_center(), closure()); @@ -549,15 +548,13 @@ TEST_F(MessageCenterImplTest, NotificationBlocker) { ToggledNotificationBlocker blocker2(message_center()); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id, RichNotificationData(), nullptr)); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id2", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id, RichNotificationData(), nullptr)); EXPECT_EQ(2u, message_center()->GetPopupNotifications().size()); EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); @@ -602,10 +599,9 @@ TEST_F(MessageCenterImplTest, NotificationsDuringBlocked) { ToggledNotificationBlocker blocker(message_center()); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id, RichNotificationData(), nullptr)); EXPECT_EQ(1u, message_center()->GetPopupNotifications().size()); EXPECT_EQ(1u, message_center()->GetVisibleNotifications().size()); @@ -615,10 +611,9 @@ TEST_F(MessageCenterImplTest, NotificationsDuringBlocked) { // Create a notification during blocked. Still no popups. blocker.SetPopupNotificationsEnabled(false); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id2", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id, RichNotificationData(), nullptr)); EXPECT_TRUE(message_center()->GetPopupNotifications().empty()); EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); @@ -637,10 +632,9 @@ TEST_F(MessageCenterImplTest, GetNotifications) { // Create a notification without any blockers. message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id, RichNotificationData(), nullptr)); EXPECT_EQ(1u, message_center()->GetPopupNotifications().size()); EXPECT_EQ(1u, message_center()->GetVisibleNotifications().size()); EXPECT_EQ(1u, message_center()->GetNotifications().size()); @@ -648,10 +642,9 @@ TEST_F(MessageCenterImplTest, GetNotifications) { // Create a notification while blocking popup notifications. blocker.SetPopupNotificationsEnabled(false); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id2", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id, RichNotificationData(), nullptr)); EXPECT_EQ(0u, message_center()->GetPopupNotifications().size()); EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); EXPECT_EQ(2u, message_center()->GetNotifications().size()); @@ -659,10 +652,9 @@ TEST_F(MessageCenterImplTest, GetNotifications) { // Create a notification while any notification is blocked. blocker.SetNotificationsEnabled(false); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id3", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id3", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id, RichNotificationData(), nullptr)); EXPECT_EQ(0u, message_center()->GetPopupNotifications().size()); EXPECT_EQ(0u, message_center()->GetVisibleNotifications().size()); EXPECT_EQ(3u, message_center()->GetNotifications().size()); @@ -688,15 +680,13 @@ TEST_F(MessageCenterImplTest, NotificationBlockerAllowsPopups) { PopupNotificationBlocker blocker(message_center(), notifier_id2); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id1, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id1, RichNotificationData(), nullptr)); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id2, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id2", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id2, RichNotificationData(), nullptr)); // "id1" is displayed as a pop-up so that it will be closed when blocked. message_center()->DisplayedNotification("id1", DISPLAY_SOURCE_POPUP); @@ -710,15 +700,13 @@ TEST_F(MessageCenterImplTest, NotificationBlockerAllowsPopups) { EXPECT_EQ(2u, message_center()->GetVisibleNotifications().size()); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id3", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id1, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id3", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id1, RichNotificationData(), nullptr)); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id4", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id2, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id4", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id2, RichNotificationData(), nullptr)); popups = message_center()->GetPopupNotifications(); EXPECT_EQ(2u, popups.size()); EXPECT_TRUE(PopupNotificationsContain(popups, "id2")); @@ -743,15 +731,13 @@ TEST_F(MessageCenterImplTest, TotalNotificationBlocker) { TotalNotificationBlocker blocker(message_center(), notifier_id2); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id1, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id1, RichNotificationData(), nullptr)); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id2, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id2", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id2, RichNotificationData(), nullptr)); // "id1" becomes invisible while "id2" is still visible. blocker.SetPopupNotificationsEnabled(false); @@ -762,15 +748,13 @@ TEST_F(MessageCenterImplTest, TotalNotificationBlocker) { EXPECT_TRUE(NotificationsContain(notifications, "id2")); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id3", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id1, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id3", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id1, RichNotificationData(), nullptr)); message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id4", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id2, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id4", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id2, RichNotificationData(), nullptr)); EXPECT_EQ(2u, message_center()->NotificationCount()); notifications = message_center()->GetVisibleNotifications(); EXPECT_FALSE(NotificationsContain(notifications, "id1")); @@ -815,17 +799,15 @@ TEST_F(MessageCenterImplTest, RemoveAllNotifications) { // Notification 1: Visible, non-pinned message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id1, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id1, RichNotificationData(), nullptr)); // Notification 2: Invisible, non-pinned message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id2, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id2", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id2, RichNotificationData(), nullptr)); // Remove all the notifications which are visible and non-pinned. message_center()->RemoveAllNotifications( @@ -853,33 +835,29 @@ TEST_F(MessageCenterImplTest, RemoveAllNotificationsWithPinned) { // Notification 1: Visible, non-pinned message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id1, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id1, RichNotificationData(), nullptr)); // Notification 2: Invisible, non-pinned message_center()->AddNotification(std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id2, - RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id2", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id2, RichNotificationData(), nullptr)); // Notification 3: Visible, pinned auto notification3 = std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id3", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id1, - RichNotificationData(), nullptr); + NOTIFICATION_TYPE_SIMPLE, "id3", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id1, RichNotificationData(), nullptr); notification3->set_pinned(true); message_center()->AddNotification(std::move(notification3)); // Notification 4: Invisible, pinned auto notification4 = std::make_unique( - NOTIFICATION_TYPE_SIMPLE, "id4", UTF8ToUTF16("title"), - UTF8ToUTF16("message"), gfx::Image() /* icon */, - std::u16string() /* display_source */, GURL(), notifier_id2, - RichNotificationData(), nullptr); + NOTIFICATION_TYPE_SIMPLE, "id4", u"title", u"message", + gfx::Image() /* icon */, std::u16string() /* display_source */, GURL(), + notifier_id2, RichNotificationData(), nullptr); notification4->set_pinned(true); message_center()->AddNotification(std::move(notification4)); @@ -1223,8 +1201,7 @@ TEST_F(MessageCenterImplTest, ButtonClickWithReply) { std::unique_ptr notification = CreateSimpleNotification(id); message_center()->AddNotification(std::move(notification)); - message_center()->ClickOnNotificationButtonWithReply( - id, 1, base::UTF8ToUTF16("REPLYTEXT")); + message_center()->ClickOnNotificationButtonWithReply(id, 1, u"REPLYTEXT"); EXPECT_EQ("ReplyButtonClick_1_REPLYTEXT_", GetDelegate(id)->log()); } @@ -1328,8 +1305,7 @@ TEST_F(MessageCenterImplTest, ButtonClickWithReplyOnLockScreen) { std::unique_ptr notification = CreateSimpleNotification(id); message_center()->AddNotification(std::move(notification)); - message_center()->ClickOnNotificationButtonWithReply( - id, 1, base::UTF8ToUTF16("REPLYTEXT")); + message_center()->ClickOnNotificationButtonWithReply(id, 1, u"REPLYTEXT"); EXPECT_EQ("", GetDelegate(id)->log()); EXPECT_TRUE(lock_screen_controller()->HasPendingCallback()); diff --git a/ui/message_center/notification_list_unittest.cc b/ui/message_center/notification_list_unittest.cc index 49701d29673254..99ece034545a0b 100644 --- a/ui/message_center/notification_list_unittest.cc +++ b/ui/message_center/notification_list_unittest.cc @@ -173,8 +173,8 @@ TEST_F(NotificationListTest, UpdateNotification) { std::string replaced = id0 + "_replaced"; EXPECT_EQ(1u, notification_list_->NotificationCount(blockers_)); std::unique_ptr notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, replaced, UTF8ToUTF16("newtitle"), - UTF8ToUTF16("newbody"), gfx::Image(), UTF8ToUTF16(kDisplaySource), GURL(), + NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", u"newbody", gfx::Image(), + UTF8ToUTF16(kDisplaySource), GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), RichNotificationData(), nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); @@ -182,8 +182,8 @@ TEST_F(NotificationListTest, UpdateNotification) { const NotificationList::Notifications notifications = notification_list_->GetVisibleNotifications(blockers_); EXPECT_EQ(replaced, (*notifications.begin())->id()); - EXPECT_EQ(UTF8ToUTF16("newtitle"), (*notifications.begin())->title()); - EXPECT_EQ(UTF8ToUTF16("newbody"), (*notifications.begin())->message()); + EXPECT_EQ(u"newtitle", (*notifications.begin())->title()); + EXPECT_EQ(u"newbody", (*notifications.begin())->message()); } TEST_F(NotificationListTest, UpdateNotificationWithRenotifyAndQuietMode) { @@ -230,34 +230,28 @@ TEST_F(NotificationListTest, GetNotificationsByNotifierId) { NotifierId id2(GURL("http://example.com")); NotifierId id3(NotifierType::SYSTEM_COMPONENT, "system-notifier"); std::unique_ptr notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, "id0", UTF8ToUTF16("title0"), - UTF8ToUTF16("message0"), gfx::Image(), UTF8ToUTF16("source0"), GURL(), - id0, RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id0", u"title0", u"message0", gfx::Image(), + u"source0", GURL(), id0, RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); notification.reset(new Notification( - NOTIFICATION_TYPE_SIMPLE, "id1", UTF8ToUTF16("title1"), - UTF8ToUTF16("message1"), gfx::Image(), UTF8ToUTF16("source0"), GURL(), - id0, RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id1", u"title1", u"message1", gfx::Image(), + u"source0", GURL(), id0, RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); notification.reset(new Notification( - NOTIFICATION_TYPE_SIMPLE, "id2", UTF8ToUTF16("title1"), - UTF8ToUTF16("message1"), gfx::Image(), UTF8ToUTF16("source1"), GURL(), - id0, RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id2", u"title1", u"message1", gfx::Image(), + u"source1", GURL(), id0, RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); notification.reset(new Notification( - NOTIFICATION_TYPE_SIMPLE, "id3", UTF8ToUTF16("title1"), - UTF8ToUTF16("message1"), gfx::Image(), UTF8ToUTF16("source2"), GURL(), - id1, RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id3", u"title1", u"message1", gfx::Image(), + u"source2", GURL(), id1, RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); notification.reset(new Notification( - NOTIFICATION_TYPE_SIMPLE, "id4", UTF8ToUTF16("title1"), - UTF8ToUTF16("message1"), gfx::Image(), UTF8ToUTF16("source2"), GURL(), - id2, RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id4", u"title1", u"message1", gfx::Image(), + u"source2", GURL(), id2, RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); notification.reset(new Notification( - NOTIFICATION_TYPE_SIMPLE, "id5", UTF8ToUTF16("title1"), - UTF8ToUTF16("message1"), gfx::Image(), UTF8ToUTF16("source2"), GURL(), - id3, RichNotificationData(), nullptr)); + NOTIFICATION_TYPE_SIMPLE, "id5", u"title1", u"message1", gfx::Image(), + u"source2", GURL(), id3, RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); NotificationList::Notifications by_notifier_id = @@ -363,11 +357,10 @@ TEST_F(NotificationListTest, GetNotificationsByAppId) { // Add a notification for |app_id1|. const std::string app_id1("app_id1"); const std::string id1("id1"); - std::unique_ptr notification( - new Notification(NOTIFICATION_TYPE_PROGRESS, id1, UTF8ToUTF16("updated"), - UTF8ToUTF16("updated"), gfx::Image(), std::u16string(), - GURL(), NotifierId(NotifierType::APPLICATION, app_id1), - RichNotificationData(), nullptr)); + std::unique_ptr notification(new Notification( + NOTIFICATION_TYPE_PROGRESS, id1, u"updated", u"updated", gfx::Image(), + std::u16string(), GURL(), NotifierId(NotifierType::APPLICATION, app_id1), + RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); EXPECT_EQ(1u, notification_list_->GetNotificationsByAppId(app_id1).size()); @@ -384,29 +377,26 @@ TEST_F(NotificationListTest, GetNotificationsByAppId) { EXPECT_EQ(0u, notification_list_->GetNotificationsByAppId(app_id1).size()); // Add two notifications for |app_id1| and one for |app_id2|. - notification.reset( - new Notification(NOTIFICATION_TYPE_PROGRESS, id1, UTF8ToUTF16("updated"), - UTF8ToUTF16("updated"), gfx::Image(), std::u16string(), - GURL(), NotifierId(NotifierType::APPLICATION, app_id1), - RichNotificationData(), nullptr)); + notification.reset(new Notification( + NOTIFICATION_TYPE_PROGRESS, id1, u"updated", u"updated", gfx::Image(), + std::u16string(), GURL(), NotifierId(NotifierType::APPLICATION, app_id1), + RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); const std::string id2("id2"); - notification.reset( - new Notification(NOTIFICATION_TYPE_PROGRESS, id2, UTF8ToUTF16("updated"), - UTF8ToUTF16("updated"), gfx::Image(), std::u16string(), - GURL(), NotifierId(NotifierType::APPLICATION, app_id1), - RichNotificationData(), nullptr)); + notification.reset(new Notification( + NOTIFICATION_TYPE_PROGRESS, id2, u"updated", u"updated", gfx::Image(), + std::u16string(), GURL(), NotifierId(NotifierType::APPLICATION, app_id1), + RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); EXPECT_EQ(2u, notification_list_->GetNotificationsByAppId(app_id1).size()); const std::string id3("id3"); const std::string app_id2("app_id2"); - notification.reset( - new Notification(NOTIFICATION_TYPE_PROGRESS, id3, UTF8ToUTF16("updated"), - UTF8ToUTF16("updated"), gfx::Image(), std::u16string(), - GURL(), NotifierId(NotifierType::APPLICATION, app_id2), - RichNotificationData(), nullptr)); + notification.reset(new Notification( + NOTIFICATION_TYPE_PROGRESS, id3, u"updated", u"updated", gfx::Image(), + std::u16string(), GURL(), NotifierId(NotifierType::APPLICATION, app_id2), + RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(notification)); EXPECT_EQ(2u, notification_list_->GetNotificationsByAppId(app_id1).size()); EXPECT_EQ(1u, notification_list_->GetNotificationsByAppId(app_id2).size()); @@ -474,9 +464,9 @@ TEST_F(NotificationListTest, UpdateWithoutMessageCenterView) { RichNotificationData optional; std::unique_ptr notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, replaced, UTF8ToUTF16("newtitle"), - UTF8ToUTF16("newbody"), gfx::Image(), UTF8ToUTF16(kDisplaySource), - GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), optional, + NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", u"newbody", + gfx::Image(), UTF8ToUTF16(kDisplaySource), GURL(), + NotifierId(NotifierType::APPLICATION, kExtensionId), optional, nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(1u, notification_list_->NotificationCount(blockers_)); @@ -484,8 +474,8 @@ TEST_F(NotificationListTest, UpdateWithoutMessageCenterView) { const NotificationList::Notifications notifications = notification_list_->GetVisibleNotifications(blockers_); EXPECT_EQ(replaced, (*notifications.begin())->id()); - EXPECT_EQ(UTF8ToUTF16("newtitle"), (*notifications.begin())->title()); - EXPECT_EQ(UTF8ToUTF16("newbody"), (*notifications.begin())->message()); + EXPECT_EQ(u"newtitle", (*notifications.begin())->title()); + EXPECT_EQ(u"newbody", (*notifications.begin())->message()); notification_list_->RemoveNotification(replaced); EXPECT_EQ(0U, @@ -505,8 +495,8 @@ TEST_F(NotificationListTest, Renotify) { RichNotificationData optional; optional.renotify = true; std::unique_ptr notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, replaced, UTF8ToUTF16("newtitle"), - UTF8ToUTF16("newbody"), gfx::Image(), UTF8ToUTF16(kDisplaySource), GURL(), + NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", u"newbody", gfx::Image(), + UTF8ToUTF16(kDisplaySource), GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), optional, nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(1u, notification_list_->NotificationCount(blockers_)); @@ -514,8 +504,8 @@ TEST_F(NotificationListTest, Renotify) { const NotificationList::Notifications notifications = notification_list_->GetVisibleNotifications(blockers_); EXPECT_EQ(replaced, (*notifications.begin())->id()); - EXPECT_EQ(UTF8ToUTF16("newtitle"), (*notifications.begin())->title()); - EXPECT_EQ(UTF8ToUTF16("newbody"), (*notifications.begin())->message()); + EXPECT_EQ(u"newtitle", (*notifications.begin())->title()); + EXPECT_EQ(u"newbody", (*notifications.begin())->message()); } TEST_F(NotificationListTest, PriorityAndRenotify) { @@ -529,8 +519,8 @@ TEST_F(NotificationListTest, PriorityAndRenotify) { RichNotificationData priority; priority.priority = DEFAULT_PRIORITY; std::unique_ptr notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, id0, UTF8ToUTF16("newtitle"), - UTF8ToUTF16("newbody"), gfx::Image(), UTF8ToUTF16(kDisplaySource), GURL(), + NOTIFICATION_TYPE_SIMPLE, id0, u"newtitle", u"newbody", gfx::Image(), + UTF8ToUTF16(kDisplaySource), GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), priority, nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(1u, GetPopupCounts()); @@ -539,18 +529,17 @@ TEST_F(NotificationListTest, PriorityAndRenotify) { // update with no promotion change for id0, it won't appear as a toast. notification.reset(new Notification( - NOTIFICATION_TYPE_SIMPLE, id0, UTF8ToUTF16("newtitle2"), - UTF8ToUTF16("newbody2"), gfx::Image(), UTF8ToUTF16(kDisplaySource), - GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), priority, - nullptr)); + NOTIFICATION_TYPE_SIMPLE, id0, u"newtitle2", u"newbody2", gfx::Image(), + UTF8ToUTF16(kDisplaySource), GURL(), + NotifierId(NotifierType::APPLICATION, kExtensionId), priority, nullptr)); notification_list_->UpdateNotificationMessage(id0, std::move(notification)); EXPECT_EQ(0u, GetPopupCounts()); // id1 promoted to DEFAULT->HIGH, it won't reappear as a toast (popup). priority.priority = HIGH_PRIORITY; notification.reset(new Notification( - NOTIFICATION_TYPE_SIMPLE, id1, UTF8ToUTF16("newtitle"), - UTF8ToUTF16("newbody"), gfx::Image(), UTF8ToUTF16(kDisplaySource), GURL(), + NOTIFICATION_TYPE_SIMPLE, id1, u"newtitle", u"newbody", gfx::Image(), + UTF8ToUTF16(kDisplaySource), GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), priority, nullptr)); notification_list_->UpdateNotificationMessage(id1, std::move(notification)); EXPECT_EQ(0u, GetPopupCounts()); @@ -558,8 +547,8 @@ TEST_F(NotificationListTest, PriorityAndRenotify) { // |renotify| will make it reappear as a toast (popup). priority.renotify = true; notification.reset(new Notification( - NOTIFICATION_TYPE_SIMPLE, id1, UTF8ToUTF16("newtitle"), - UTF8ToUTF16("newbody"), gfx::Image(), UTF8ToUTF16(kDisplaySource), GURL(), + NOTIFICATION_TYPE_SIMPLE, id1, u"newtitle", u"newbody", gfx::Image(), + UTF8ToUTF16(kDisplaySource), GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), priority, nullptr)); notification_list_->UpdateNotificationMessage(id1, std::move(notification)); EXPECT_EQ(1u, GetPopupCounts()); @@ -658,8 +647,8 @@ TEST_F(NotificationListTest, UpdateAfterMarkedAsShown) { const std::string replaced("test-replaced-id"); std::unique_ptr notification(new Notification( - NOTIFICATION_TYPE_SIMPLE, replaced, UTF8ToUTF16("newtitle"), - UTF8ToUTF16("newbody"), gfx::Image(), UTF8ToUTF16(kDisplaySource), GURL(), + NOTIFICATION_TYPE_SIMPLE, replaced, u"newtitle", u"newbody", gfx::Image(), + UTF8ToUTF16(kDisplaySource), GURL(), NotifierId(NotifierType::APPLICATION, kExtensionId), RichNotificationData(), nullptr)); notification_list_->UpdateNotificationMessage(id1, std::move(notification)); @@ -694,10 +683,9 @@ TEST_F(NotificationListTest, TestHasNotificationOfType) { EXPECT_FALSE(notification_list_->HasNotificationOfType( id, NOTIFICATION_TYPE_PROGRESS)); - std::unique_ptr updated_notification( - new Notification(NOTIFICATION_TYPE_PROGRESS, id, UTF8ToUTF16("updated"), - UTF8ToUTF16("updated"), gfx::Image(), std::u16string(), - GURL(), NotifierId(), RichNotificationData(), nullptr)); + std::unique_ptr updated_notification(new Notification( + NOTIFICATION_TYPE_PROGRESS, id, u"updated", u"updated", gfx::Image(), + std::u16string(), GURL(), NotifierId(), RichNotificationData(), nullptr)); notification_list_->AddNotification(std::move(updated_notification)); EXPECT_FALSE( diff --git a/ui/message_center/views/message_popup_collection_unittest.cc b/ui/message_center/views/message_popup_collection_unittest.cc index 02b051689ea244..ad30d8743d0e75 100644 --- a/ui/message_center/views/message_popup_collection_unittest.cc +++ b/ui/message_center/views/message_popup_collection_unittest.cc @@ -240,9 +240,9 @@ class MessagePopupCollectionTest : public views::ViewsTestBase, const std::string& title) { return std::make_unique( NOTIFICATION_TYPE_BASE_FORMAT, id, base::UTF8ToUTF16(title), - base::UTF8ToUTF16("test message"), gfx::Image(), - std::u16string() /* display_source */, GURL(), NotifierId(), - RichNotificationData(), new NotificationDelegate()); + u"test message", gfx::Image(), std::u16string() /* display_source */, + GURL(), NotifierId(), RichNotificationData(), + new NotificationDelegate()); } std::string AddNotification() { diff --git a/ui/message_center/views/notification_control_buttons_unittest.cc b/ui/message_center/views/notification_control_buttons_unittest.cc index 62cf5b0ca37f22..376a846424300f 100644 --- a/ui/message_center/views/notification_control_buttons_unittest.cc +++ b/ui/message_center/views/notification_control_buttons_unittest.cc @@ -44,8 +44,8 @@ class NotificationControlButtonsTest : public testing::Test { void SetUp() override { Test::SetUp(); Notification notification( - NOTIFICATION_TYPE_SIMPLE, "id", base::UTF8ToUTF16("title"), - base::UTF8ToUTF16("id"), gfx::Image(), std::u16string(), GURL(), + NOTIFICATION_TYPE_SIMPLE, "id", u"title", u"id", gfx::Image(), + std::u16string(), GURL(), NotifierId(NotifierType::APPLICATION, "notifier_id"), RichNotificationData(), nullptr); message_view_ = std::make_unique(notification); diff --git a/ui/message_center/views/notification_view_md_unittest.cc b/ui/message_center/views/notification_view_md_unittest.cc index c67b0e28eb4b5e..070f17887a1dbd 100644 --- a/ui/message_center/views/notification_view_md_unittest.cc +++ b/ui/message_center/views/notification_view_md_unittest.cc @@ -197,8 +197,7 @@ std::unique_ptr NotificationViewMDTest::CreateSimpleNotification() std::unique_ptr notification = std::make_unique( NOTIFICATION_TYPE_BASE_FORMAT, std::string(kDefaultNotificationId), - base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), - CreateTestImage(80, 80), base::UTF8ToUTF16("display source"), GURL(), + u"title", u"message", CreateTestImage(80, 80), u"display source", GURL(), NotifierId(NotifierType::APPLICATION, "extension_id"), data, delegate_); notification->set_small_image(CreateTestImage(16, 16)); notification->set_image(CreateTestImage(320, 240)); @@ -432,7 +431,7 @@ TEST_F(NotificationViewMDTest, UpdateViewsOrderingTest) { EXPECT_EQ(0, notification_view()->left_content_->GetIndexOf( notification_view()->message_view_)); - notification->set_title(base::UTF8ToUTF16("title")); + notification->set_title(u"title"); notification_view()->CreateOrUpdateViews(*notification); @@ -930,8 +929,7 @@ TEST_F(NotificationViewMDTest, SnoozeButton) { rich_data.should_show_snooze_button = true; std::unique_ptr notification = std::make_unique( message_center::NOTIFICATION_TYPE_CUSTOM, kDefaultNotificationId, - base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), gfx::Image(), - base::UTF8ToUTF16("display source"), GURL(), + u"title", u"message", gfx::Image(), u"display source", GURL(), message_center::NotifierId(message_center::NotifierType::ARC_APPLICATION, "test_app_id"), rich_data, nullptr); @@ -1429,7 +1427,7 @@ TEST_F(NotificationViewMDTest, TestLongTitleAndMessage) { } TEST_F(NotificationViewMDTest, AppNameExtension) { - std::u16string app_name = base::UTF8ToUTF16("extension name"); + std::u16string app_name = u"extension name"; std::unique_ptr notification = CreateSimpleNotification(); notification->set_context_message(app_name); @@ -1439,14 +1437,13 @@ TEST_F(NotificationViewMDTest, AppNameExtension) { } TEST_F(NotificationViewMDTest, AppNameSystemNotification) { - std::u16string app_name = base::UTF8ToUTF16("system notification"); + std::u16string app_name = u"system notification"; message_center::MessageCenter::Get()->SetSystemNotificationAppName(app_name); RichNotificationData data; data.settings_button_handler = SettingsButtonHandler::INLINE; auto notification = std::make_unique( NOTIFICATION_TYPE_BASE_FORMAT, std::string(kDefaultNotificationId), - base::UTF8ToUTF16("title"), base::UTF8ToUTF16("message"), gfx::Image(), - std::u16string(), GURL(), + u"title", u"message", gfx::Image(), std::u16string(), GURL(), NotifierId(NotifierType::SYSTEM_COMPONENT, "system"), data, nullptr); UpdateNotificationViews(*notification); @@ -1460,7 +1457,7 @@ TEST_F(NotificationViewMDTest, AppNameWebNotification) { UpdateNotificationViews(*notification); - EXPECT_EQ(base::UTF8ToUTF16("example.com"), + EXPECT_EQ(u"example.com", notification_view()->header_row_->app_name_for_testing()); } diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc index c526d4371f4b27..47ff204eb1ae43 100644 --- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc @@ -2409,7 +2409,7 @@ TEST_P(WaylandWindowTest, RemovesReattachesBackgroundOnHideShow) { // size constraints remain the same. TEST_P(WaylandWindowTest, SetsPropertiesOnShow) { constexpr char kAppId[] = "wayland_test"; - const std::u16string kTitle(base::UTF8ToUTF16("WaylandWindowTest")); + const std::u16string kTitle(u"WaylandWindowTest"); PlatformWindowInitProperties properties; properties.bounds = gfx::Rect(0, 0, 100, 100); diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc index 4251ecf0281f71..b84926287ae3ec 100644 --- a/ui/views/controls/textfield/textfield_unittest.cc +++ b/ui/views/controls/textfield/textfield_unittest.cc @@ -2234,7 +2234,7 @@ TEST_F(TextfieldTest, TextInputClientTest) { EXPECT_STR_EQ("0456789", textfield_->GetText()); ui::CompositionText composition; - composition.text = UTF8ToUTF16("321"); + composition.text = u"321"; // Set composition through input method. input_method_->Clear(); input_method_->SetCompositionTextForNextKey(composition); @@ -2252,7 +2252,7 @@ TEST_F(TextfieldTest, TextInputClientTest) { EXPECT_EQ(1, on_before_user_action_); EXPECT_EQ(1, on_after_user_action_); - input_method_->SetResultTextForNextKey(UTF8ToUTF16("123")); + input_method_->SetResultTextForNextKey(u"123"); on_before_user_action_ = on_after_user_action_ = 0; textfield_->clear(); DispatchMockInputMethodKeyEvent(); @@ -2969,7 +2969,7 @@ TEST_F(TextfieldTest, OverflowInRTLTest) { TEST_F(TextfieldTest, CommitComposingTextTest) { InitTextfield(); ui::CompositionText composition; - composition.text = UTF8ToUTF16("abc123"); + composition.text = u"abc123"; textfield_->SetCompositionText(composition); uint32_t composed_text_length = textfield_->ConfirmCompositionText(/* keep_selection */ false); @@ -2980,7 +2980,7 @@ TEST_F(TextfieldTest, CommitComposingTextTest) { TEST_F(TextfieldTest, CommitEmptyComposingTextTest) { InitTextfield(); ui::CompositionText composition; - composition.text = UTF8ToUTF16(""); + composition.text = u""; textfield_->SetCompositionText(composition); uint32_t composed_text_length = textfield_->ConfirmCompositionText(/* keep_selection */ false); @@ -3006,7 +3006,7 @@ TEST_F(TextfieldTest, SetCompositionFromExistingTextTest) { TEST_F(TextfieldTest, GetCompositionCharacterBoundsTest) { InitTextfield(); ui::CompositionText composition; - composition.text = UTF8ToUTF16("abc123"); + composition.text = u"abc123"; const uint32_t char_count = static_cast(composition.text.length()); // Compare the composition character bounds with surrounding cursor bounds. @@ -3107,7 +3107,7 @@ TEST_F(TextfieldTest, GetAutocorrectCharacterBoundsTest) { InitTextfield(); textfield_->InsertText( - UTF8ToUTF16("hello placeholder text"), + u"hello placeholder text", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); textfield_->SetAutocorrectRange(gfx::Range(3, 10)); @@ -3119,7 +3119,7 @@ TEST_F(TextfieldTest, GetAutocorrectCharacterBoundsTest) { textfield_->DeleteRange(gfx::Range(0, 99)); textfield_->InsertText( - UTF8ToUTF16("hello placeholder text"), + u"hello placeholder text", ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorAfterText); textfield_->SetAutocorrectRange(gfx::Range(3, 8)); @@ -3376,7 +3376,7 @@ TEST_F(TextfieldTest, TestLongPressInitiatesDragDrop) { TEST_F(TextfieldTest, GetTextfieldBaseline_FontFallbackTest) { InitTextfield(); - textfield_->SetText(UTF8ToUTF16("abc")); + textfield_->SetText(u"abc"); const int old_baseline = textfield_->GetBaseline(); // Set text which may fall back to a font which has taller baseline than @@ -3621,8 +3621,8 @@ TEST_F(TextfieldTest, AccessiblePasswordTest) { ui::AXNodeData node_data_protected; textfield_->GetAccessibleNodeData(&node_data_protected); EXPECT_EQ(ax::mojom::Role::kTextField, node_data_protected.role); - EXPECT_EQ(UTF8ToUTF16("••••••••"), node_data_protected.GetString16Attribute( - ax::mojom::StringAttribute::kValue)); + EXPECT_EQ(u"••••••••", node_data_protected.GetString16Attribute( + ax::mojom::StringAttribute::kValue)); EXPECT_TRUE(node_data_protected.HasState(ax::mojom::State::kProtected)); } diff --git a/ui/web_dialogs/test/test_web_dialog_delegate.cc b/ui/web_dialogs/test/test_web_dialog_delegate.cc index 54f410ec3d8ad6..2cce51ac0b2736 100644 --- a/ui/web_dialogs/test/test_web_dialog_delegate.cc +++ b/ui/web_dialogs/test/test_web_dialog_delegate.cc @@ -41,7 +41,7 @@ ModalType TestWebDialogDelegate::GetDialogModalType() const { } std::u16string TestWebDialogDelegate::GetDialogTitle() const { - return base::UTF8ToUTF16("Test"); + return u"Test"; } GURL TestWebDialogDelegate::GetDialogContentURL() const { diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc index e845dc838832ac..6d23d6534a7ecd 100644 --- a/url/gurl_unittest.cc +++ b/url/gurl_unittest.cc @@ -68,11 +68,11 @@ TEST(GURLTest, Types) { // the parser is already tested and works, so we are mostly interested if the // object does the right thing with the results. TEST(GURLTest, Components) { - GURL empty_url(base::UTF8ToUTF16("")); + GURL empty_url(u""); EXPECT_TRUE(empty_url.is_empty()); EXPECT_FALSE(empty_url.is_valid()); - GURL url(base::UTF8ToUTF16("http://user:pass@google.com:99/foo;bar?q=a#ref")); + GURL url(u"http://user:pass@google.com:99/foo;bar?q=a#ref"); EXPECT_FALSE(url.is_empty()); EXPECT_TRUE(url.is_valid()); EXPECT_TRUE(url.SchemeIs("http")); diff --git a/url/url_canon_unittest.cc b/url/url_canon_unittest.cc index fa4c7d48e530ea..fb27fe7b020f76 100644 --- a/url/url_canon_unittest.cc +++ b/url/url_canon_unittest.cc @@ -2168,12 +2168,12 @@ TEST(URLCanonTest, _itow_s) { const char16_t fill_char = 0xffff; memset(buf, fill_mem, sizeof(buf)); EXPECT_EQ(0, _itow_s(12, buf, sizeof(buf) / 2 - 1, 10)); - EXPECT_EQ(base::UTF8ToUTF16("12"), std::u16string(buf)); + EXPECT_EQ(u"12", std::u16string(buf)); EXPECT_EQ(fill_char, buf[3]); // Test the edge cases - exactly the buffer size and one over EXPECT_EQ(0, _itow_s(1234, buf, sizeof(buf) / 2 - 1, 10)); - EXPECT_EQ(base::UTF8ToUTF16("1234"), std::u16string(buf)); + EXPECT_EQ(u"1234", std::u16string(buf)); EXPECT_EQ(fill_char, buf[5]); memset(buf, fill_mem, sizeof(buf)); @@ -2183,12 +2183,12 @@ TEST(URLCanonTest, _itow_s) { // Test the template overload (note that this will see the full buffer) memset(buf, fill_mem, sizeof(buf)); EXPECT_EQ(0, _itow_s(12, buf, 10)); - EXPECT_EQ(base::UTF8ToUTF16("12"), std::u16string(buf)); + EXPECT_EQ(u"12", std::u16string(buf)); EXPECT_EQ(fill_char, buf[3]); memset(buf, fill_mem, sizeof(buf)); EXPECT_EQ(0, _itow_s(12345, buf, 10)); - EXPECT_EQ(base::UTF8ToUTF16("12345"), std::u16string(buf)); + EXPECT_EQ(u"12345", std::u16string(buf)); EXPECT_EQ(EINVAL, _itow_s(123456, buf, 10)); } @@ -2474,41 +2474,41 @@ TEST(URLCanonTest, IDNToASCII) { RawCanonOutputW<1024> output; // Basic ASCII test. - std::u16string str = base::UTF8ToUTF16("hello"); + std::u16string str = u"hello"; EXPECT_TRUE(IDNToASCII(str.data(), str.length(), &output)); - EXPECT_EQ(base::UTF8ToUTF16("hello"), std::u16string(output.data())); + EXPECT_EQ(u"hello", std::u16string(output.data())); output.set_length(0); // Mixed ASCII/non-ASCII. - str = base::UTF8ToUTF16("hellö"); + str = u"hellö"; EXPECT_TRUE(IDNToASCII(str.data(), str.length(), &output)); - EXPECT_EQ(base::UTF8ToUTF16("xn--hell-8qa"), std::u16string(output.data())); + EXPECT_EQ(u"xn--hell-8qa", std::u16string(output.data())); output.set_length(0); // All non-ASCII. - str = base::UTF8ToUTF16("你好"); + str = u"你好"; EXPECT_TRUE(IDNToASCII(str.data(), str.length(), &output)); - EXPECT_EQ(base::UTF8ToUTF16("xn--6qq79v"), std::u16string(output.data())); + EXPECT_EQ(u"xn--6qq79v", std::u16string(output.data())); output.set_length(0); // Characters that need mapping (the resulting Punycode is the encoding for // "1⁄4"). - str = base::UTF8ToUTF16("¼"); + str = u"¼"; EXPECT_TRUE(IDNToASCII(str.data(), str.length(), &output)); - EXPECT_EQ(base::UTF8ToUTF16("xn--14-c6t"), std::u16string(output.data())); + EXPECT_EQ(u"xn--14-c6t", std::u16string(output.data())); output.set_length(0); // String to encode already starts with "xn--", and all ASCII. Should not // modify the string. - str = base::UTF8ToUTF16("xn--hell-8qa"); + str = u"xn--hell-8qa"; EXPECT_TRUE(IDNToASCII(str.data(), str.length(), &output)); - EXPECT_EQ(base::UTF8ToUTF16("xn--hell-8qa"), std::u16string(output.data())); + EXPECT_EQ(u"xn--hell-8qa", std::u16string(output.data())); output.set_length(0); // String to encode already starts with "xn--", and mixed ASCII/non-ASCII. // Should fail, due to a special case: if the label starts with "xn--", it // should be parsed as Punycode, which must be all ASCII. - str = base::UTF8ToUTF16("xn--hellö"); + str = u"xn--hellö"; EXPECT_FALSE(IDNToASCII(str.data(), str.length(), &output)); output.set_length(0); @@ -2516,7 +2516,7 @@ TEST(URLCanonTest, IDNToASCII) { // This tests that there is still an error for the character '⁄' (U+2044), // which would be a valid ASCII character, U+0044, if the high byte were // ignored. - str = base::UTF8ToUTF16("xn--1⁄4"); + str = u"xn--1⁄4"; EXPECT_FALSE(IDNToASCII(str.data(), str.length(), &output)); output.set_length(0); }