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

Side by Side Diff: content/renderer/render_view_impl_unittest.cc

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget.h » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "content/public/common/context_menu_params.h" 6 #include "content/public/common/context_menu_params.h"
7 #include "content/renderer/render_view_impl.h" 7 #include "content/renderer/render_view_impl.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/base/range/range.h" 9 #include "ui/gfx/range/range.h"
10 10
11 namespace content { 11 namespace content {
12 12
13 TEST(RenderViewImplTest, ShouldUpdateSelectionTextFromContextMenuParams) { 13 TEST(RenderViewImplTest, ShouldUpdateSelectionTextFromContextMenuParams) {
14 struct { 14 struct {
15 const char* selection_text; 15 const char* selection_text;
16 size_t selection_text_offset; 16 size_t selection_text_offset;
17 ui::Range selection_range; 17 gfx::Range selection_range;
18 const char* params_selection_text; 18 const char* params_selection_text;
19 bool expected_result; 19 bool expected_result;
20 } cases[] = { 20 } cases[] = {
21 { "test", 0, ui::Range(0, 4), "test", false }, 21 { "test", 0, gfx::Range(0, 4), "test", false },
22 { "zebestest", 0, ui::Range(2, 6), "best", false }, 22 { "zebestest", 0, gfx::Range(2, 6), "best", false },
23 { "zebestest", 2, ui::Range(2, 6), "best", true }, 23 { "zebestest", 2, gfx::Range(2, 6), "best", true },
24 { "test", 0, ui::Range(0, 4), "hello", true }, 24 { "test", 0, gfx::Range(0, 4), "hello", true },
25 { "best test", 0, ui::Range(0, 4), "best ", false }, 25 { "best test", 0, gfx::Range(0, 4), "best ", false },
26 { "best test", 0, ui::Range(0, 5), "best", false }, 26 { "best test", 0, gfx::Range(0, 5), "best", false },
27 }; 27 };
28 28
29 ContextMenuParams params; 29 ContextMenuParams params;
30 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { 30 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
31 params.selection_text = UTF8ToUTF16(cases[i].params_selection_text); 31 params.selection_text = UTF8ToUTF16(cases[i].params_selection_text);
32 EXPECT_EQ(cases[i].expected_result, 32 EXPECT_EQ(cases[i].expected_result,
33 RenderViewImpl::ShouldUpdateSelectionTextFromContextMenuParams( 33 RenderViewImpl::ShouldUpdateSelectionTextFromContextMenuParams(
34 UTF8ToUTF16(cases[i].selection_text), 34 UTF8ToUTF16(cases[i].selection_text),
35 cases[i].selection_text_offset, 35 cases[i].selection_text_offset,
36 cases[i].selection_range, 36 cases[i].selection_range,
37 params)); 37 params));
38 } 38 }
39 } 39 }
40 40
41 } // namespace content 41 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698