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

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

Issue 10910005: Makes the tabstrip center the active tab when transitioning from (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc ('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 #include "chrome/browser/ui/views/tabs/touch_tab_strip_layout.h" 5 #include "chrome/browser/ui/views/tabs/touch_tab_strip_layout.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 464
465 // Assertions around SetXAndMiniCount. 465 // Assertions around SetXAndMiniCount.
466 TEST_F(TouchTabStripLayoutTest, SetXAndMiniCount) { 466 TEST_F(TouchTabStripLayoutTest, SetXAndMiniCount) {
467 // Verifies we don't crash when transitioning to all mini-tabs. 467 // Verifies we don't crash when transitioning to all mini-tabs.
468 PrepareChildViews(1); 468 PrepareChildViews(1);
469 layout_.reset(new TouchTabStripLayout( 469 layout_.reset(new TouchTabStripLayout(
470 gfx::Size(100, 10), -10, 2, 4, &view_model_)); 470 gfx::Size(100, 10), -10, 2, 4, &view_model_));
471 Reset(layout_.get(), 0, 400, 0, 0); 471 Reset(layout_.get(), 0, 400, 0, 0);
472 layout_->SetXAndMiniCount(0, 1); 472 layout_->SetXAndMiniCount(0, 1);
473 } 473 }
474
475 // Assertions around SetXAndMiniCount.
476 TEST_F(TouchTabStripLayoutTest, SetActiveTabLocation) {
477 struct TestData {
478 struct CommonTestData common_data;
479 const int location;
480 } test_data[] = {
481 // Active tab is the first tab, can't be moved.
482 { { 0, 300, 100, -10, 2, 0, 0, "", "0 90 180 194 196 198 200" }, 50 },
483
484 // Active tab is pinned; should result in nothing.
485 { { 0, 300, 100, -10, 2, 2, 1, "", "0 0 0 90 180 198 200" }, 199 },
486
487 // Location is too far to the right, ends up being pushed in.
488 { { 0, 300, 100, -10, 2, 0, 3, "", "0 14 104 194 196 198 200" }, 199 },
489
490 // Location can be honored.
491 { { 0, 300, 100, -10, 2, 0, 3, "", "0 2 4 40 130 198 200" }, 40 },
492 };
493 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) {
494 CreateLayout(test_data[i].common_data);
495 layout_->SetActiveTabLocation(test_data[i].location);
496 EXPECT_EQ(test_data[i].common_data.expected_bounds, BoundsString()) <<
497 " at " << i;
498 }
499 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698