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

Side by Side Diff: views/controls/table/table_view_unittest.cc

Issue 7189019: Fix even more crashes. To help identify remaining crashes now and in the future, I have made the ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // For WinDDK ATL compatibility, these ATL headers must come first. 5 // For WinDDK ATL compatibility, these ATL headers must come first.
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <atlbase.h> // NOLINT 8 #include <atlbase.h> // NOLINT
9 #include <atlwin.h> // NOLINT 9 #include <atlwin.h> // NOLINT
10 #endif 10 #endif
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 int TestTableModel::CompareValues(int row1, int row2, int column_id) { 134 int TestTableModel::CompareValues(int row1, int row2, int column_id) {
135 return rows_[row1][column_id] - rows_[row2][column_id]; 135 return rows_[row1][column_id] - rows_[row2][column_id];
136 } 136 }
137 137
138 #if defined(OS_WIN) 138 #if defined(OS_WIN)
139 139
140 // TableViewTest --------------------------------------------------------------- 140 // TableViewTest ---------------------------------------------------------------
141 141
142 class TableViewTest : public testing::Test, views::WidgetDelegate { 142 class TableViewTest : public testing::Test, views::WidgetDelegate {
143 public: 143 public:
144 virtual void SetUp(); 144 virtual void SetUp() OVERRIDE;
145 virtual void TearDown(); 145 virtual void TearDown() OVERRIDE;
146 146
147 virtual views::View* GetContentsView() { 147 virtual views::View* GetContentsView() OVERRIDE {
148 return table_; 148 return table_;
149 } 149 }
150 virtual views::Widget* GetWidget() OVERRIDE {
151 return table_->GetWidget();
152 }
153 virtual const views::Widget* GetWidget() const OVERRIDE {
154 return table_->GetWidget();
155 }
150 156
151 protected: 157 protected:
152 // Creates the model. 158 // Creates the model.
153 virtual TestTableModel* CreateModel(); 159 virtual TestTableModel* CreateModel();
154 160
155 // Verifies the view order matches that of the supplied arguments. The 161 // Verifies the view order matches that of the supplied arguments. The
156 // arguments are in terms of the model. For example, values of '1, 0' indicate 162 // arguments are in terms of the model. For example, values of '1, 0' indicate
157 // the model index at row 0 is 1 and the model index at row 1 is 0. 163 // the model index at row 0 is 1 and the model index at row 1 is 0.
158 void VerifyViewOrder(int first, ...); 164 void VerifyViewOrder(int first, ...);
159 165
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 #endif // OS_WIN 470 #endif // OS_WIN
465 471
466 //////////////////////////////////////////////////////////////////////////////// 472 ////////////////////////////////////////////////////////////////////////////////
467 // TableView2 Tests 473 // TableView2 Tests
468 474
469 class TableView2Test : public testing::Test, views::WidgetDelegate { 475 class TableView2Test : public testing::Test, views::WidgetDelegate {
470 public: 476 public:
471 virtual void SetUp(); 477 virtual void SetUp();
472 virtual void TearDown(); 478 virtual void TearDown();
473 479
474 virtual views::View* GetContentsView() { 480 virtual views::View* GetContentsView() OVERRIDE {
475 return table_; 481 return table_;
476 } 482 }
483 virtual views::Widget* GetWidget() OVERRIDE {
484 return table_->GetWidget();
485 }
486 virtual const views::Widget* GetWidget() const OVERRIDE {
487 return table_->GetWidget();
488 }
477 489
478 // Returns the contents of a cell in the table. 490 // Returns the contents of a cell in the table.
479 std::wstring GetCellValue(int row, int column); 491 std::wstring GetCellValue(int row, int column);
480 492
481 protected: 493 protected:
482 // Creates the model. 494 // Creates the model.
483 TestTableModel* CreateModel(); 495 TestTableModel* CreateModel();
484 496
485 virtual views::TableTypes GetTableType() { 497 virtual views::TableTypes GetTableType() {
486 return views::TEXT_ONLY; 498 return views::TEXT_ONLY;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 639
628 table_->FocusRow(2); 640 table_->FocusRow(2);
629 EXPECT_EQ(2, table_->GetFirstFocusedRow()); 641 EXPECT_EQ(2, table_->GetFirstFocusedRow());
630 642
631 table_->ClearRowFocus(); 643 table_->ClearRowFocus();
632 EXPECT_EQ(-1, table_->GetFirstSelectedRow()); 644 EXPECT_EQ(-1, table_->GetFirstSelectedRow());
633 } 645 }
634 #endif 646 #endif
635 647
636 } // namespace views 648 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698