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

Side by Side Diff: chrome/views/table_view_unittest.cc

Issue 5009: Fix some issues found looking at the code.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <vector> 5 #include <vector>
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/views/table_view.h" 8 #include "chrome/views/table_view.h"
9 #include "chrome/views/window.h" 9 #include "chrome/views/window.h"
10 #include "chrome/views/window_delegate.h" 10 #include "chrome/views/window_delegate.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 // The table. This is owned by the window. 131 // The table. This is owned by the window.
132 TableView* table_; 132 TableView* table_;
133 133
134 private: 134 private:
135 MessageLoopForUI message_loop_; 135 MessageLoopForUI message_loop_;
136 ChromeViews::Window* window_; 136 ChromeViews::Window* window_;
137 }; 137 };
138 138
139 void TableViewTest::SetUp() { 139 void TableViewTest::SetUp() {
140 OleInitialize(NULL);
140 model_.reset(CreateModel()); 141 model_.reset(CreateModel());
141 std::vector<ChromeViews::TableColumn> columns; 142 std::vector<ChromeViews::TableColumn> columns;
142 columns.resize(2); 143 columns.resize(2);
143 columns[0].id = 0; 144 columns[0].id = 0;
144 columns[1].id = 1; 145 columns[1].id = 1;
145 table_ = new TableView(model_.get(), columns, ChromeViews::ICON_AND_TEXT, 146 table_ = new TableView(model_.get(), columns, ChromeViews::ICON_AND_TEXT,
146 false, false, false); 147 false, false, false);
147 window_ = 148 window_ =
148 ChromeViews::Window::CreateChromeWindow(NULL, 149 ChromeViews::Window::CreateChromeWindow(NULL,
149 gfx::Rect(100, 100, 512, 512), 150 gfx::Rect(100, 100, 512, 512),
150 this); 151 this);
151 } 152 }
152 153
153 void TableViewTest::TearDown() { 154 void TableViewTest::TearDown() {
154 window_->CloseNow(); 155 window_->CloseNow();
155 // Temporary workaround to avoid leak of RootView::pending_paint_task_. 156 // Temporary workaround to avoid leak of RootView::pending_paint_task_.
156 message_loop_.RunAllPending(); 157 message_loop_.RunAllPending();
158 OleUninitialize();
157 } 159 }
158 160
159 void TableViewTest::VeriyViewOrder(int first, ...) { 161 void TableViewTest::VeriyViewOrder(int first, ...) {
160 va_list marker; 162 va_list marker;
161 va_start(marker, first); 163 va_start(marker, first);
162 int value = first; 164 int value = first;
163 int index = 0; 165 int index = 0;
164 for (int value = first, index = 0; value != -1; index++) { 166 for (int value = first, index = 0; value != -1; index++) {
165 ASSERT_EQ(value, table_->view_to_model(index)); 167 ASSERT_EQ(value, table_->view_to_model(index));
166 value = va_arg(marker, int); 168 value = va_arg(marker, int);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // Tests selection persists after a add with iterator. 356 // Tests selection persists after a add with iterator.
355 TEST_F(TableViewTest, PersistMultiSelectionOnAdd) { 357 TEST_F(TableViewTest, PersistMultiSelectionOnAdd) {
356 SetUpMultiSelectTestState(false); 358 SetUpMultiSelectTestState(false);
357 if (HasFatalFailure()) 359 if (HasFatalFailure())
358 return; 360 return;
359 361
360 model_->AddRow(3, 4, 4); 362 model_->AddRow(3, 4, 4);
361 363
362 VerifySelectedRows(1, 0, -1); 364 VerifySelectedRows(1, 0, -1);
363 } 365 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698