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

Side by Side Diff: chrome/browser/ui/tabs/tab_strip_model_unittest.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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 #include "chrome/browser/ui/tabs/tab_strip_model.h" 5 #include "chrome/browser/ui/tabs/tab_strip_model.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 void PrepareTabstripForSelectionTest(TabStripModel* model, 239 void PrepareTabstripForSelectionTest(TabStripModel* model,
240 int tab_count, 240 int tab_count,
241 int pinned_count, 241 int pinned_count,
242 const std::string& selected_tabs) { 242 const std::string& selected_tabs) {
243 for (int i = 0; i < tab_count; ++i) 243 for (int i = 0; i < tab_count; ++i)
244 model->AppendWebContents(CreateWebContentsWithID(i), true); 244 model->AppendWebContents(CreateWebContentsWithID(i), true);
245 for (int i = 0; i < pinned_count; ++i) 245 for (int i = 0; i < pinned_count; ++i)
246 model->SetTabPinned(i, true); 246 model->SetTabPinned(i, true);
247 247
248 ui::ListSelectionModel selection_model; 248 ui::ListSelectionModel selection_model;
249 std::vector<std::string> selection; 249 for (const base::StringPiece& sel : base::SplitStringPiece(
250 base::SplitStringAlongWhitespace(selected_tabs, &selection); 250 selected_tabs, base::kWhitespaceASCII,
251 for (size_t i = 0; i < selection.size(); ++i) { 251 base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
252 int value; 252 int value;
253 ASSERT_TRUE(base::StringToInt(selection[i], &value)); 253 ASSERT_TRUE(base::StringToInt(sel, &value));
254 selection_model.AddIndexToSelection(value); 254 selection_model.AddIndexToSelection(value);
255 } 255 }
256 selection_model.set_active(selection_model.selected_indices()[0]); 256 selection_model.set_active(selection_model.selected_indices()[0]);
257 model->SetSelectionFromModel(selection_model); 257 model->SetSelectionFromModel(selection_model);
258 } 258 }
259 }; 259 };
260 260
261 class MockTabStripModelObserver : public TabStripModelObserver { 261 class MockTabStripModelObserver : public TabStripModelObserver {
262 public: 262 public:
263 explicit MockTabStripModelObserver(TabStripModel* model) 263 explicit MockTabStripModelObserver(TabStripModel* model)
(...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 WebContents* page_d_contents = CreateWebContents(); 2579 WebContents* page_d_contents = CreateWebContents();
2580 strip.AddWebContents(page_c_contents, -1, ui::PAGE_TRANSITION_LINK, 2580 strip.AddWebContents(page_c_contents, -1, ui::PAGE_TRANSITION_LINK,
2581 TabStripModel::ADD_NONE); 2581 TabStripModel::ADD_NONE);
2582 strip.AddWebContents(page_d_contents, -1, ui::PAGE_TRANSITION_LINK, 2582 strip.AddWebContents(page_d_contents, -1, ui::PAGE_TRANSITION_LINK,
2583 TabStripModel::ADD_NONE); 2583 TabStripModel::ADD_NONE);
2584 2584
2585 EXPECT_EQ(2, strip.GetIndexOfWebContents(page_c_contents)); 2585 EXPECT_EQ(2, strip.GetIndexOfWebContents(page_c_contents));
2586 EXPECT_EQ(3, strip.GetIndexOfWebContents(page_d_contents)); 2586 EXPECT_EQ(3, strip.GetIndexOfWebContents(page_d_contents));
2587 strip.CloseAllTabs(); 2587 strip.CloseAllTabs();
2588 } 2588 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.cc ('k') | chrome/browser/ui/views/autofill/expanding_textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698