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

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac_browsertest.mm

Issue 2395233005: [Mac] Preserve original selection when suggesting completions with diacritics (Closed)
Patch Set: Wrap retained object in scoped_nsobject Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
6 6
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 GetOmnibox()->CopyToPasteboard(pasteboard->get()); 87 GetOmnibox()->CopyToPasteboard(pasteboard->get());
88 88
89 // Check that the custom Pboard type is no longer present. 89 // Check that the custom Pboard type is no longer present.
90 EXPECT_FALSE([pasteboard->get() 90 EXPECT_FALSE([pasteboard->get()
91 stringForType:ui::ClipboardUtil::UTIForPasteboardType(pboard_type)]); 91 stringForType:ui::ClipboardUtil::UTIForPasteboardType(pboard_type)]);
92 92
93 // Check that the contents of the omnibox were copied to the clipboard. 93 // Check that the contents of the omnibox were copied to the clipboard.
94 pasteboard_string = [pasteboard->get() stringForType:NSPasteboardTypeString]; 94 pasteboard_string = [pasteboard->get() stringForType:NSPasteboardTypeString];
95 EXPECT_EQ(text, pasteboard_string.UTF8String); 95 EXPECT_EQ(text, pasteboard_string.UTF8String);
96 } 96 }
97
98 // Verify that copying text from the omnibox into the pasteboard works with
99 // a selection that begins on a combining character.
100 IN_PROC_BROWSER_TEST_F(OmniboxViewMacBrowserTest, CopyToPasteboardDiacritic) {
101 base::string16 text = base::UTF8ToUTF16("สวัสดี");
102
103 scoped_refptr<ui::UniquePasteboard> pasteboard = new ui::UniquePasteboard;
104 [[GetOmnibox()->field() currentEditor]
105 setString:base::SysUTF16ToNSString(text)];
106 [[GetOmnibox()->field() currentEditor]
107 setSelectedRange:NSMakeRange(2, text.size() - 2)];
108
109 GetOmnibox()->model()->SetUserText(text);
110 GetOmnibox()->CopyToPasteboard(pasteboard->get());
111
112 NSString* pasteboard_string =
113 [pasteboard->get() stringForType:NSPasteboardTypeString];
114 EXPECT_EQ(text.substr(2, 4), base::SysNSStringToUTF16(pasteboard_string));
115 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698