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

Side by Side Diff: chrome/browser/ui/views/tabs/stacked_tab_strip_layout_unittest.cc

Issue 2963023002: [stacked tabs] Fix stacking logic with 'open link in new tab' (Closed)
Patch Set: Created 3 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/views/tabs/stacked_tab_strip_layout.h" 5 #include "chrome/browser/ui/views/tabs/stacked_tab_strip_layout.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 316
317 // Assertions for AddTab(). 317 // Assertions for AddTab().
318 TEST_F(StackedTabStripLayoutTest, AddTab) { 318 TEST_F(StackedTabStripLayoutTest, AddTab) {
319 struct TestData { 319 struct TestData {
320 CommonTestData common_data; 320 CommonTestData common_data;
321 int add_index; 321 int add_index;
322 bool add_active; 322 bool add_active;
323 bool add_pinned; 323 bool add_pinned;
324 } test_data[] = { 324 } test_data[] = {
325 // Adding a background tab test cases.
326 { { 0, 300, 100, 10, 2, 0, 1, "0 90 180 198 200", "0 16 106 196 198 200"}, 325 { { 0, 300, 100, 10, 2, 0, 1, "0 90 180 198 200", "0 16 106 196 198 200"},
327 3, false, false }, 326 3, false, false },
327
328 // If the active tab is in its leftmost position and it is not possible
329 // for all of the tabs between the active tab and the newly-added tab
330 // (inclusive) to be shown, then a stack should form to the right of
331 // the active tab.
332 { { 0, 284, 100, 10, 2, 0, 2, "0 2 4 94 184", "0 2 4 6 94 184"},
333 5, false, false },
328 { { 0, 300, 100, 10, 2, 0, 1, "0 90 180 198 200", "0 2 4 20 110 200"}, 334 { { 0, 300, 100, 10, 2, 0, 1, "0 90 180 198 200", "0 2 4 20 110 200"},
329 5, false, false }, 335 5, false, false },
336
330 { { 0, 300, 100, 10, 2, 0, 1, "0 90 180 198 200", "0 90 180 196 198 200"}, 337 { { 0, 300, 100, 10, 2, 0, 1, "0 90 180 198 200", "0 90 180 196 198 200"},
331 2, false, false }, 338 2, false, false },
332 { { 0, 300, 100, 10, 2, 0, 1, "0 90 180 198 200", "0 2 4 94 184 200"}, 339
333 0, false, false }, 340 // Add to the end of the tab strip. All tabs between the active tab and the
341 // newly-added tab (inclusive) should be fully visible (indices 3-5 in the
342 // resulting tab strip) and tabs to the left of the active tab should be
343 // stacked at the left side of the tab strip rather than immediately to the
344 // left of the active tab.
345 { { 0, 300, 100, 10, 2, 0, 3, "0 90 180 198 200", "0 2 4 20 110 200"},
346 5, false, false },
347
348 // If it is possible for all of the tabs between the active tab and the
349 // newly-added tab (inclusive) to be fully visible without changing the
350 // position of the active tab, then do not do so.
351 { { 0, 378, 100, 10, 2, 0, 2, "0 2 4 94 184 274 276 278",
352 "0 2 4 94 184 272 274 276 278"},
353 3, false, false },
354 { { 0, 378, 100, 10, 2, 0, 2, "0 2 4 94 184 274 276 278",
355 "0 2 4 94 184 272 274 276 278"},
356 4, false, false },
334 357
335 { { 4, 200, 100, 10, 2, 1, 2, "0 4 10 100", "0 0 8 10 100"}, 358 { { 4, 200, 100, 10, 2, 1, 2, "0 4 10 100", "0 0 8 10 100"},
336 1, false, true }, 359 1, false, true },
337 { { 4, 200, 100, 10, 2, 1, 2, "0 4 10 100", "0 0 8 98 100"}, 360 { { 4, 200, 100, 10, 2, 1, 2, "0 4 10 100", "0 0 8 98 100"},
338 1, true, true }, 361 1, true, true },
339 { { 4, 200, 100, 10, 2, 1, 2, "0 4 10 100", "0 0 8 98 100"}, 362 { { 4, 200, 100, 10, 2, 1, 2, "0 4 10 100", "0 0 8 98 100"},
340 0, true, true }, 363 0, true, true },
341 { { 0, 200, 100, 10, 2, 0, 2, "0 2 10 100", "0 4 94 98 100"}, 364 { { 0, 200, 100, 10, 2, 0, 2, "0 2 10 100", "0 4 94 98 100"},
342 0, true, true }, 365 0, true, true },
343 366
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // Location can be honored. 662 // Location can be honored.
640 { { 0, 300, 100, 10, 2, 0, 3, "", "0 2 4 40 130 198 200" }, 40 }, 663 { { 0, 300, 100, 10, 2, 0, 3, "", "0 2 4 40 130 198 200" }, 40 },
641 }; 664 };
642 for (size_t i = 0; i < arraysize(test_data); ++i) { 665 for (size_t i = 0; i < arraysize(test_data); ++i) {
643 CreateLayout(test_data[i].common_data); 666 CreateLayout(test_data[i].common_data);
644 layout_->SetActiveTabLocation(test_data[i].location); 667 layout_->SetActiveTabLocation(test_data[i].location);
645 EXPECT_EQ(test_data[i].common_data.expected_bounds, BoundsString()) << 668 EXPECT_EQ(test_data[i].common_data.expected_bounds, BoundsString()) <<
646 " at " << i; 669 " at " << i;
647 } 670 }
648 } 671 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698