| Index: chrome/browser/autocomplete/autocomplete_edit_unittest.cc
|
| ===================================================================
|
| --- chrome/browser/autocomplete/autocomplete_edit_unittest.cc (revision 72382)
|
| +++ chrome/browser/autocomplete/autocomplete_edit_unittest.cc (working copy)
|
| @@ -2,7 +2,6 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/utf_string_conversions.h"
|
| #include "chrome/browser/autocomplete/autocomplete_edit.h"
|
| #include "chrome/browser/autocomplete/autocomplete_edit_view.h"
|
| #include "chrome/test/testing_profile.h"
|
| @@ -24,30 +23,30 @@
|
| PageTransition::Type transition,
|
| const GURL& alternate_nav_url,
|
| size_t selected_line,
|
| - const string16& keyword) {}
|
| - virtual string16 GetText() const { return string16(); }
|
| + const std::wstring& keyword) {}
|
| + virtual std::wstring GetText() const { return std::wstring(); }
|
| virtual bool IsEditingOrEmpty() const { return true; }
|
| virtual int GetIcon() const { return 0; }
|
| - virtual void SetUserText(const string16& text) {}
|
| - virtual void SetUserText(const string16& text,
|
| - const string16& display_text,
|
| + virtual void SetUserText(const std::wstring& text) {}
|
| + virtual void SetUserText(const std::wstring& text,
|
| + const std::wstring& display_text,
|
| bool update_popup) {}
|
| - virtual void SetWindowTextAndCaretPos(const string16& text,
|
| + virtual void SetWindowTextAndCaretPos(const std::wstring& text,
|
| size_t caret_pos) {}
|
| virtual void SetForcedQuery() {}
|
| virtual bool IsSelectAll() { return false; }
|
| virtual bool DeleteAtEndPressed() { return false; }
|
| - virtual void GetSelectionBounds(string16::size_type* start,
|
| - string16::size_type* end) {}
|
| + virtual void GetSelectionBounds(std::wstring::size_type* start,
|
| + std::wstring::size_type* end) {}
|
| virtual void SelectAll(bool reversed) {}
|
| virtual void RevertAll() {}
|
| virtual void UpdatePopup() {}
|
| virtual void ClosePopup() {}
|
| virtual void SetFocus() {}
|
| - virtual void OnTemporaryTextMaybeChanged(const string16& display_text,
|
| + virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text,
|
| bool save_original_selection) {}
|
| virtual bool OnInlineAutocompleteTextMaybeChanged(
|
| - const string16& display_text, size_t user_text_length) {
|
| + const std::wstring& display_text, size_t user_text_length) {
|
| return false;
|
| }
|
| virtual void OnRevertTemporaryText() {}
|
| @@ -62,8 +61,8 @@
|
| #if defined(TOOLKIT_VIEWS)
|
| virtual views::View* AddToView(views::View* parent) { return NULL; }
|
| virtual bool CommitInstantSuggestion(
|
| - const string16& typed_text,
|
| - const string16& suggested_text) { return false; }
|
| + const std::wstring& typed_text,
|
| + const std::wstring& suggested_text) { return false;}
|
| #endif
|
|
|
| private:
|
| @@ -76,7 +75,7 @@
|
| virtual void OnAutocompleteWillClosePopup() {}
|
| virtual void OnAutocompleteLosingFocus(gfx::NativeView view_gaining_focus) {}
|
| virtual void OnAutocompleteWillAccept() {}
|
| - virtual bool OnCommitSuggestedText(const string16& typed_text) {
|
| + virtual bool OnCommitSuggestedText(const std::wstring& typed_text) {
|
| return false;
|
| }
|
| virtual bool AcceptCurrentInstantPreview() {
|
| @@ -93,7 +92,7 @@
|
| virtual void OnKillFocus() {}
|
| virtual void OnSetFocus() {}
|
| virtual SkBitmap GetFavIcon() const { return SkBitmap(); }
|
| - virtual string16 GetTitle() const { return string16(); }
|
| + virtual std::wstring GetTitle() const { return std::wstring(); }
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(TestingAutocompleteEditController);
|
| @@ -106,41 +105,41 @@
|
| // Tests various permutations of AutocompleteModel::AdjustTextForCopy.
|
| TEST(AutocompleteEditTest, AdjustTextForCopy) {
|
| struct Data {
|
| - const char* perm_text;
|
| + const wchar_t* perm_text;
|
| const int sel_start;
|
| const bool is_all_selected;
|
| - const char* input;
|
| - const char* expected_output;
|
| + const wchar_t* input;
|
| + const wchar_t* expected_output;
|
| const bool write_url;
|
| const char* expected_url;
|
| } input[] = {
|
| // Test that http:// is inserted if all text is selected.
|
| - { "a.b/c", 0, true, "a.b/c", "http://a.b/c", true, "http://a.b/c" },
|
| + { L"a.b/c", 0, true, L"a.b/c", L"http://a.b/c", true, "http://a.b/c" },
|
|
|
| // Test that http:// is inserted if the host is selected.
|
| - { "a.b/c", 0, false, "a.b/", "http://a.b/", true, "http://a.b/" },
|
| + { L"a.b/c", 0, false, L"a.b/", L"http://a.b/", true, "http://a.b/" },
|
|
|
| // Tests that http:// is inserted if the path is modified.
|
| - { "a.b/c", 0, false, "a.b/d", "http://a.b/d", true, "http://a.b/d" },
|
| + { L"a.b/c", 0, false, L"a.b/d", L"http://a.b/d", true, "http://a.b/d" },
|
|
|
| // Tests that http:// isn't inserted if the host is modified.
|
| - { "a.b/c", 0, false, "a.c/", "a.c/", false, "" },
|
| + { L"a.b/c", 0, false, L"a.c/", L"a.c/", false, "" },
|
|
|
| // Tests that http:// isn't inserted if the start of the selection is 1.
|
| - { "a.b/c", 1, false, "a.b/", "a.b/", false, "" },
|
| + { L"a.b/c", 1, false, L"a.b/", L"a.b/", false, "" },
|
|
|
| // Tests that http:// isn't inserted if a portion of the host is selected.
|
| - { "a.com/", 0, false, "a.co", "a.co", false, "" },
|
| + { L"a.com/", 0, false, L"a.co", L"a.co", false, "" },
|
|
|
| // Tests that http:// isn't inserted for an https url after the user nukes
|
| // https.
|
| - { "https://a.com/", 0, false, "a.com/", "a.com/", false, "" },
|
| + { L"https://a.com/", 0, false, L"a.com/", L"a.com/", false, "" },
|
|
|
| // Tests that http:// isn't inserted if the user adds to the host.
|
| - { "a.b/", 0, false, "a.bc/", "a.bc/", false, "" },
|
| + { L"a.b/", 0, false, L"a.bc/", L"a.bc/", false, "" },
|
|
|
| // Tests that we don't get double http if the user manually inserts http.
|
| - { "a.b/", 0, false, "http://a.b/", "http://a.b/", true, "http://a.b/" },
|
| + { L"a.b/", 0, false, L"http://a.b/", L"http://a.b/", true, "http://a.b/" },
|
| };
|
| TestingAutocompleteEditView view;
|
| TestingAutocompleteEditController controller;
|
| @@ -148,14 +147,14 @@
|
| AutocompleteEditModel model(&view, &controller, &profile);
|
|
|
| for (size_t i = 0; i < ARRAYSIZE_UNSAFE(input); ++i) {
|
| - model.UpdatePermanentText(ASCIIToUTF16(input[i].perm_text));
|
| + model.UpdatePermanentText(input[i].perm_text);
|
|
|
| - string16 result = ASCIIToUTF16(input[i].input);
|
| + std::wstring result(input[i].input);
|
| GURL url;
|
| bool write_url;
|
| model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected,
|
| &result, &url, &write_url);
|
| - EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i;
|
| + EXPECT_EQ(input[i].expected_output, result) << "@: " << i;
|
| EXPECT_EQ(input[i].write_url, write_url) << " @" << i;
|
| if (write_url)
|
| EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i;
|
|
|