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

Side by Side Diff: ios/chrome/browser/ui/tab_switcher/tab_switcher_utils_unittest.mm

Issue 2608253003: [ios] Moves tab_switcher code out of the ios_internal namespace. (Closed)
Patch Set: Review. Created 3 years, 11 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 | « ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.h" 5 #include "ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.h"
6 6
7 #include "testing/platform_test.h" 7 #include "testing/platform_test.h"
8 8
9 class TabSwitcherUtilsTest : public PlatformTest { 9 class TabSwitcherUtilsTest : public PlatformTest {
10 protected: 10 protected:
11 // Checks that the computed updates/deletions/insertions to go from |initial| 11 // Checks that the computed updates/deletions/insertions to go from |initial|
12 // to |final| correctly match the expected updates/deletions/insertions. 12 // to |final| correctly match the expected updates/deletions/insertions.
13 void TestLevenshtein(std::vector<size_t> const& initial, 13 void TestLevenshtein(std::vector<size_t> const& initial,
14 std::vector<size_t> const& final, 14 std::vector<size_t> const& final,
15 std::vector<size_t> const& expectedSubstitutions, 15 std::vector<size_t> const& expectedSubstitutions,
16 std::vector<size_t> const& expectedDeletions, 16 std::vector<size_t> const& expectedDeletions,
17 std::vector<size_t> const& expectedInsertions) { 17 std::vector<size_t> const& expectedInsertions) {
18 std::vector<size_t> substitutions; 18 std::vector<size_t> substitutions;
19 std::vector<size_t> deletions; 19 std::vector<size_t> deletions;
20 std::vector<size_t> insertions; 20 std::vector<size_t> insertions;
21 ios_internal::MinimalReplacementOperations(initial, final, &substitutions, 21 TabSwitcherMinimalReplacementOperations(initial, final, &substitutions,
22 &deletions, &insertions); 22 &deletions, &insertions);
23 EXPECT_EQ(substitutions, expectedSubstitutions); 23 EXPECT_EQ(substitutions, expectedSubstitutions);
24 EXPECT_EQ(deletions, expectedDeletions); 24 EXPECT_EQ(deletions, expectedDeletions);
25 EXPECT_EQ(insertions, expectedInsertions); 25 EXPECT_EQ(insertions, expectedInsertions);
26 } 26 }
27 }; 27 };
28 28
29 TEST_F(TabSwitcherUtilsTest, TestLevenshteinEmptyVectors) { 29 TEST_F(TabSwitcherUtilsTest, TestLevenshteinEmptyVectors) {
30 std::vector<size_t> initial = {}; 30 std::vector<size_t> initial = {};
31 std::vector<size_t> final = {}; 31 std::vector<size_t> final = {};
32 std::vector<size_t> expectedSubstitutions = {}; 32 std::vector<size_t> expectedSubstitutions = {};
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 TEST_F(TabSwitcherUtilsTest, 117 TEST_F(TabSwitcherUtilsTest,
118 TestLevenshteinPreferInsertionsAndDeletionsOverSubstitutions) { 118 TestLevenshteinPreferInsertionsAndDeletionsOverSubstitutions) {
119 std::vector<size_t> initial = {0, 1}; 119 std::vector<size_t> initial = {0, 1};
120 std::vector<size_t> final = {1, 2}; 120 std::vector<size_t> final = {1, 2};
121 std::vector<size_t> expectedSubstitutions = {}; 121 std::vector<size_t> expectedSubstitutions = {};
122 std::vector<size_t> expectedDeletions = {0}; 122 std::vector<size_t> expectedDeletions = {0};
123 std::vector<size_t> expectedInsertions = {1}; 123 std::vector<size_t> expectedInsertions = {1};
124 TestLevenshtein(initial, final, expectedSubstitutions, expectedDeletions, 124 TestLevenshtein(initial, final, expectedSubstitutions, expectedDeletions,
125 expectedInsertions); 125 expectedInsertions);
126 } 126 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/tab_switcher/tab_switcher_utils.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698