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

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

Issue 10291002: Fix crash in touch layout code. Without this can end up indexing into (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 " at " << i; 316 " at " << i;
317 } 317 }
318 } 318 }
319 319
320 // Assertions for SetWidth(). 320 // Assertions for SetWidth().
321 TEST_F(TouchTabStripLayoutTest, SetWidth) { 321 TEST_F(TouchTabStripLayoutTest, SetWidth) {
322 struct TestData { 322 struct TestData {
323 CommonTestData common_data; 323 CommonTestData common_data;
324 int new_width; 324 int new_width;
325 } test_data[] = { 325 } test_data[] = {
326 // Verifies a bug in AdjustTrailingStackedTabs().
327 { { 0, 103, 100, -10, 2, 0, 0, "", "0 2"}, 102 },
328
326 { { 8, 250, 100, -10, 2, 2, 2, "0 4 8 98 148 150", "0 4 8 98 160 250"}, 329 { { 8, 250, 100, -10, 2, 2, 2, "0 4 8 98 148 150", "0 4 8 98 160 250"},
327 350 }, 330 350 },
328 { { 8, 250, 100, -10, 2, 2, 2, "0 4 8 98 148 150", "0 4 8 96 98 100"}, 331 { { 8, 250, 100, -10, 2, 2, 2, "0 4 8 98 148 150", "0 4 8 96 98 100"},
329 200 }, 332 200 },
330 333
331 { { 0, 250, 100, -10, 2, 0, 2, "0 40 90 120 150", "0 40 90 98 100"}, 200 }, 334 { { 0, 250, 100, -10, 2, 0, 2, "0 40 90 120 150", "0 40 90 98 100"}, 200 },
332 { { 0, 250, 100, -10, 2, 0, 2, "0 2 60 150", "0 2 60 100"}, 200 }, 335 { { 0, 250, 100, -10, 2, 0, 2, "0 2 60 150", "0 2 60 100"}, 200 },
333 { { 0, 250, 100, -10, 2, 0, 2, "0 40 120 150", "0 40 98 100"}, 200 }, 336 { { 0, 250, 100, -10, 2, 0, 2, "0 40 120 150", "0 40 98 100"}, 200 },
334 337
335 { { 0, 200, 100, -10, 2, 0, 2, "0 2 10 100", "0 2 60 150"}, 250 }, 338 { { 0, 200, 100, -10, 2, 0, 2, "0 2 10 100", "0 2 60 150"}, 250 },
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // Makes sure don't crash when resized and only one tab. 370 // Makes sure don't crash when resized and only one tab.
368 TEST_F(TouchTabStripLayoutTest, EmptyTest) { 371 TEST_F(TouchTabStripLayoutTest, EmptyTest) {
369 TouchTabStripLayout layout(gfx::Size(160, 10), -27, 6, 4, &view_model_); 372 TouchTabStripLayout layout(gfx::Size(160, 10), -27, 6, 4, &view_model_);
370 PrepareChildViews(1); 373 PrepareChildViews(1);
371 layout.AddTab(0, TouchTabStripLayout::kAddTypeActive, 0); 374 layout.AddTab(0, TouchTabStripLayout::kAddTypeActive, 0);
372 layout.SetWidth(100); 375 layout.SetWidth(100);
373 layout.SetWidth(50); 376 layout.SetWidth(50);
374 layout.SetWidth(0); 377 layout.SetWidth(0);
375 layout.SetWidth(500); 378 layout.SetWidth(500);
376 } 379 }
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