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

Side by Side Diff: chrome/browser/views/tabs/tab_dragging_test.cc

Issue 113722: Make automation proxy objects to ref_counted. That allows to process async no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/views/find_bar_win_uitest.cc ('k') | chrome/common/logging_chrome_uitest.cc » ('j') | 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) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "chrome/app/chrome_dll_resource.h" 7 #include "chrome/app/chrome_dll_resource.h"
8 #include "chrome/browser/view_ids.h" 8 #include "chrome/browser/view_ids.h"
9 #include "chrome/common/chrome_paths.h" 9 #include "chrome/common/chrome_paths.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 11 matching lines...) Expand all
22 protected: 22 protected:
23 TabDraggingTest() { 23 TabDraggingTest() {
24 show_window_ = true; 24 show_window_ = true;
25 } 25 }
26 }; 26 };
27 27
28 // Automated UI test to open three tabs in a new window, and drag Tab_1 into 28 // Automated UI test to open three tabs in a new window, and drag Tab_1 into
29 // the position of Tab_2. 29 // the position of Tab_2.
30 // Disabled as per http://crbug.com/10941 30 // Disabled as per http://crbug.com/10941
31 TEST_F(TabDraggingTest, DISABLED_Tab1Tab2) { 31 TEST_F(TabDraggingTest, DISABLED_Tab1Tab2) {
32 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 32 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
33 ASSERT_TRUE(browser.get()); 33 ASSERT_TRUE(browser.get());
34 scoped_ptr<WindowProxy> window(browser->GetWindow()); 34 scoped_refptr<WindowProxy> window(browser->GetWindow());
35 ASSERT_TRUE(window.get()); 35 ASSERT_TRUE(window.get());
36 36
37 // Get initial tab count. 37 // Get initial tab count.
38 int initial_tab_count = 0; 38 int initial_tab_count = 0;
39 ASSERT_TRUE(browser->GetTabCount(&initial_tab_count)); 39 ASSERT_TRUE(browser->GetTabCount(&initial_tab_count));
40 ASSERT_TRUE(1 == initial_tab_count); 40 ASSERT_TRUE(1 == initial_tab_count);
41 41
42 // Get Tab_1 which comes with the browser window. 42 // Get Tab_1 which comes with the browser window.
43 scoped_ptr<TabProxy> tab1(browser->GetTab(0)); 43 scoped_refptr<TabProxy> tab1(browser->GetTab(0));
44 ASSERT_TRUE(tab1.get()); 44 ASSERT_TRUE(tab1.get());
45 GURL tab1_url; 45 GURL tab1_url;
46 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url)); 46 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
47 47
48 // Add Tab_2. 48 // Add Tab_2.
49 GURL tab2_url("about:"); 49 GURL tab2_url("about:");
50 ASSERT_TRUE(browser->AppendTab(tab2_url)); 50 ASSERT_TRUE(browser->AppendTab(tab2_url));
51 scoped_ptr<TabProxy> tab2(browser->GetTab(1)); 51 scoped_refptr<TabProxy> tab2(browser->GetTab(1));
52 ASSERT_TRUE(tab2.get()); 52 ASSERT_TRUE(tab2.get());
53 53
54 // Add Tab_3. 54 // Add Tab_3.
55 GURL tab3_url("about:plugins"); 55 GURL tab3_url("about:plugins");
56 ASSERT_TRUE(browser->AppendTab(tab3_url)); 56 ASSERT_TRUE(browser->AppendTab(tab3_url));
57 scoped_ptr<TabProxy> tab3(browser->GetTab(2)); 57 scoped_refptr<TabProxy> tab3(browser->GetTab(2));
58 ASSERT_TRUE(tab3.get()); 58 ASSERT_TRUE(tab3.get());
59 59
60 // Make sure 3 tabs are open. 60 // Make sure 3 tabs are open.
61 ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2, 61 ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2,
62 10000)); 62 10000));
63 63
64 // Get bounds for the tabs. 64 // Get bounds for the tabs.
65 gfx::Rect bounds1; 65 gfx::Rect bounds1;
66 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_0, &bounds1, false)); 66 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_0, &bounds1, false));
67 EXPECT_LT(0, bounds1.x()); 67 EXPECT_LT(0, bounds1.x());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 POINT end; 106 POINT end;
107 start.x = bounds1.x() + bounds1.width()/2; 107 start.x = bounds1.x() + bounds1.width()/2;
108 start.y = bounds1.y() + bounds1.height()/2; 108 start.y = bounds1.y() + bounds1.height()/2;
109 end.x = start.x + 2*bounds1.width()/3; 109 end.x = start.x + 2*bounds1.width()/3;
110 end.y = start.y; 110 end.y = start.y;
111 ASSERT_TRUE(browser->SimulateDrag(start, end, 111 ASSERT_TRUE(browser->SimulateDrag(start, end,
112 views::Event::EF_LEFT_BUTTON_DOWN, 112 views::Event::EF_LEFT_BUTTON_DOWN,
113 false)); 113 false));
114 114
115 // Now check for expected results. 115 // Now check for expected results.
116 tab1.reset(browser->GetTab(0)); 116 tab1 = browser->GetTab(0);
117 ASSERT_TRUE(tab1.get()); 117 ASSERT_TRUE(tab1.get());
118 GURL tab1_new_url; 118 GURL tab1_new_url;
119 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url)); 119 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
120 120
121 tab2.reset(browser->GetTab(1)); 121 tab2 = browser->GetTab(1);
122 ASSERT_TRUE(tab2.get()); 122 ASSERT_TRUE(tab2.get());
123 GURL tab2_new_url; 123 GURL tab2_new_url;
124 ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url)); 124 ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
125 125
126 EXPECT_EQ(tab1_url.spec(), tab2_new_url.spec()); 126 EXPECT_EQ(tab1_url.spec(), tab2_new_url.spec());
127 EXPECT_EQ(tab2_url.spec(), tab1_new_url.spec()); 127 EXPECT_EQ(tab2_url.spec(), tab1_new_url.spec());
128 } 128 }
129 129
130 // Drag Tab_1 into the position of Tab_3. 130 // Drag Tab_1 into the position of Tab_3.
131 // Disabled as per http://crbug.com/10941 131 // Disabled as per http://crbug.com/10941
132 TEST_F(TabDraggingTest, DISABLED_Tab1Tab3) { 132 TEST_F(TabDraggingTest, DISABLED_Tab1Tab3) {
133 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 133 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
134 ASSERT_TRUE(browser.get()); 134 ASSERT_TRUE(browser.get());
135 scoped_ptr<WindowProxy> window(browser->GetWindow()); 135 scoped_refptr<WindowProxy> window(browser->GetWindow());
136 ASSERT_TRUE(window.get()); 136 ASSERT_TRUE(window.get());
137 137
138 // Get initial tab count. 138 // Get initial tab count.
139 int initial_tab_count = 0; 139 int initial_tab_count = 0;
140 ASSERT_TRUE(browser->GetTabCount(&initial_tab_count)); 140 ASSERT_TRUE(browser->GetTabCount(&initial_tab_count));
141 ASSERT_TRUE(1 == initial_tab_count); 141 ASSERT_TRUE(1 == initial_tab_count);
142 142
143 // Get Tab_1 which comes with the browser window. 143 // Get Tab_1 which comes with the browser window.
144 scoped_ptr<TabProxy> tab1(browser->GetTab(0)); 144 scoped_refptr<TabProxy> tab1(browser->GetTab(0));
145 ASSERT_TRUE(tab1.get()); 145 ASSERT_TRUE(tab1.get());
146 GURL tab1_url; 146 GURL tab1_url;
147 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url)); 147 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
148 148
149 // Add Tab_2. 149 // Add Tab_2.
150 GURL tab2_url("about:"); 150 GURL tab2_url("about:");
151 ASSERT_TRUE(browser->AppendTab(tab2_url)); 151 ASSERT_TRUE(browser->AppendTab(tab2_url));
152 scoped_ptr<TabProxy> tab2(browser->GetTab(1)); 152 scoped_refptr<TabProxy> tab2(browser->GetTab(1));
153 ASSERT_TRUE(tab2.get()); 153 ASSERT_TRUE(tab2.get());
154 154
155 // Add Tab_3. 155 // Add Tab_3.
156 GURL tab3_url("about:plugins"); 156 GURL tab3_url("about:plugins");
157 ASSERT_TRUE(browser->AppendTab(tab3_url)); 157 ASSERT_TRUE(browser->AppendTab(tab3_url));
158 scoped_ptr<TabProxy> tab3(browser->GetTab(2)); 158 scoped_refptr<TabProxy> tab3(browser->GetTab(2));
159 ASSERT_TRUE(tab3.get()); 159 ASSERT_TRUE(tab3.get());
160 160
161 // Make sure 3 tabs are open. 161 // Make sure 3 tabs are open.
162 ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2, 162 ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2,
163 10000)); 163 10000));
164 164
165 // Get bounds for the tabs. 165 // Get bounds for the tabs.
166 gfx::Rect bounds1; 166 gfx::Rect bounds1;
167 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_0, &bounds1, false)); 167 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_0, &bounds1, false));
168 EXPECT_LT(0, bounds1.x()); 168 EXPECT_LT(0, bounds1.x());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 POINT end; 207 POINT end;
208 start.x = bounds1.x() + bounds1.width()/2; 208 start.x = bounds1.x() + bounds1.width()/2;
209 start.y = bounds1.y() + bounds1.height()/2; 209 start.y = bounds1.y() + bounds1.height()/2;
210 end.x = start.x + bounds1.width()/2 + bounds2.width() + bounds3.width()/2; 210 end.x = start.x + bounds1.width()/2 + bounds2.width() + bounds3.width()/2;
211 end.y = start.y; 211 end.y = start.y;
212 ASSERT_TRUE(browser->SimulateDrag(start, end, 212 ASSERT_TRUE(browser->SimulateDrag(start, end,
213 views::Event::EF_LEFT_BUTTON_DOWN, 213 views::Event::EF_LEFT_BUTTON_DOWN,
214 false)); 214 false));
215 215
216 // Now check for expected results. 216 // Now check for expected results.
217 tab1.reset(browser->GetTab(0)); 217 tab1 = browser->GetTab(0);
218 ASSERT_TRUE(tab1.get()); 218 ASSERT_TRUE(tab1.get());
219 GURL tab1_new_url; 219 GURL tab1_new_url;
220 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url)); 220 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
221 221
222 tab2.reset(browser->GetTab(1)); 222 tab2 = browser->GetTab(1);
223 ASSERT_TRUE(tab2.get()); 223 ASSERT_TRUE(tab2.get());
224 GURL tab2_new_url; 224 GURL tab2_new_url;
225 ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url)); 225 ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
226 226
227 tab3.reset(browser->GetTab(2)); 227 tab3 = browser->GetTab(2);
228 ASSERT_TRUE(tab3.get()); 228 ASSERT_TRUE(tab3.get());
229 GURL tab3_new_url; 229 GURL tab3_new_url;
230 ASSERT_TRUE(tab3->GetCurrentURL(&tab3_new_url)); 230 ASSERT_TRUE(tab3->GetCurrentURL(&tab3_new_url));
231 231
232 EXPECT_EQ(tab1_new_url.spec(), tab2_url.spec()); 232 EXPECT_EQ(tab1_new_url.spec(), tab2_url.spec());
233 EXPECT_EQ(tab2_new_url.spec(), tab3_url.spec()); 233 EXPECT_EQ(tab2_new_url.spec(), tab3_url.spec());
234 EXPECT_EQ(tab3_new_url.spec(), tab1_url.spec()); 234 EXPECT_EQ(tab3_new_url.spec(), tab1_url.spec());
235 } 235 }
236 236
237 // Drag Tab_1 into the position of Tab_3, and press ESCAPE before releasing the 237 // Drag Tab_1 into the position of Tab_3, and press ESCAPE before releasing the
238 // left mouse button. 238 // left mouse button.
239 TEST_F(TabDraggingTest, Tab1Tab3Escape) { 239 TEST_F(TabDraggingTest, Tab1Tab3Escape) {
240 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 240 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
241 ASSERT_TRUE(browser.get()); 241 ASSERT_TRUE(browser.get());
242 scoped_ptr<WindowProxy> window(browser->GetWindow()); 242 scoped_refptr<WindowProxy> window(browser->GetWindow());
243 ASSERT_TRUE(window.get()); 243 ASSERT_TRUE(window.get());
244 244
245 // Get initial tab count. 245 // Get initial tab count.
246 int initial_tab_count = 0; 246 int initial_tab_count = 0;
247 ASSERT_TRUE(browser->GetTabCount(&initial_tab_count)); 247 ASSERT_TRUE(browser->GetTabCount(&initial_tab_count));
248 ASSERT_TRUE(1 == initial_tab_count); 248 ASSERT_TRUE(1 == initial_tab_count);
249 249
250 // Get Tab_1 which comes with the browser window. 250 // Get Tab_1 which comes with the browser window.
251 scoped_ptr<TabProxy> tab1(browser->GetTab(0)); 251 scoped_refptr<TabProxy> tab1(browser->GetTab(0));
252 ASSERT_TRUE(tab1.get()); 252 ASSERT_TRUE(tab1.get());
253 GURL tab1_url; 253 GURL tab1_url;
254 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url)); 254 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
255 255
256 // Add Tab_2. 256 // Add Tab_2.
257 GURL tab2_url("about:"); 257 GURL tab2_url("about:");
258 ASSERT_TRUE(browser->AppendTab(tab2_url)); 258 ASSERT_TRUE(browser->AppendTab(tab2_url));
259 scoped_ptr<TabProxy> tab2(browser->GetTab(1)); 259 scoped_refptr<TabProxy> tab2(browser->GetTab(1));
260 ASSERT_TRUE(tab2.get()); 260 ASSERT_TRUE(tab2.get());
261 261
262 // Add Tab_3. 262 // Add Tab_3.
263 GURL tab3_url("about:plugins"); 263 GURL tab3_url("about:plugins");
264 ASSERT_TRUE(browser->AppendTab(tab3_url)); 264 ASSERT_TRUE(browser->AppendTab(tab3_url));
265 scoped_ptr<TabProxy> tab3(browser->GetTab(2)); 265 scoped_refptr<TabProxy> tab3(browser->GetTab(2));
266 ASSERT_TRUE(tab3.get()); 266 ASSERT_TRUE(tab3.get());
267 267
268 // Make sure 3 tabs are open. 268 // Make sure 3 tabs are open.
269 ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2, 269 ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2,
270 10000)); 270 10000));
271 271
272 // Get bounds for the tabs. 272 // Get bounds for the tabs.
273 gfx::Rect bounds1; 273 gfx::Rect bounds1;
274 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_0, &bounds1, false)); 274 ASSERT_TRUE(window->GetViewBounds(VIEW_ID_TAB_0, &bounds1, false));
275 EXPECT_LT(0, bounds1.x()); 275 EXPECT_LT(0, bounds1.x());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 end.x = start.x + bounds1.width()/2 + bounds2.width() + bounds3.width()/2; 317 end.x = start.x + bounds1.width()/2 + bounds2.width() + bounds3.width()/2;
318 end.y = start.y; 318 end.y = start.y;
319 319
320 // Simulate drag with 'true' as the last parameter. This will interrupt 320 // Simulate drag with 'true' as the last parameter. This will interrupt
321 // in-flight with Escape. 321 // in-flight with Escape.
322 ASSERT_TRUE(browser->SimulateDrag(start, end, 322 ASSERT_TRUE(browser->SimulateDrag(start, end,
323 views::Event::EF_LEFT_BUTTON_DOWN, 323 views::Event::EF_LEFT_BUTTON_DOWN,
324 true)); 324 true));
325 325
326 // Now check for expected results. 326 // Now check for expected results.
327 tab1.reset(browser->GetTab(0)); 327 tab1 = browser->GetTab(0);
328 ASSERT_TRUE(tab1.get()); 328 ASSERT_TRUE(tab1.get());
329 GURL tab1_new_url; 329 GURL tab1_new_url;
330 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url)); 330 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
331 331
332 tab2.reset(browser->GetTab(1)); 332 tab2 = browser->GetTab(1);
333 ASSERT_TRUE(tab2.get()); 333 ASSERT_TRUE(tab2.get());
334 GURL tab2_new_url; 334 GURL tab2_new_url;
335 ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url)); 335 ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
336 336
337 tab3.reset(browser->GetTab(2)); 337 tab3 = browser->GetTab(2);
338 ASSERT_TRUE(tab3.get()); 338 ASSERT_TRUE(tab3.get());
339 GURL tab3_new_url; 339 GURL tab3_new_url;
340 ASSERT_TRUE(tab3->GetCurrentURL(&tab3_new_url)); 340 ASSERT_TRUE(tab3->GetCurrentURL(&tab3_new_url));
341 341
342 // The tabs should be in their original positions. 342 // The tabs should be in their original positions.
343 EXPECT_EQ(tab1_new_url.spec(), tab1_url.spec()); 343 EXPECT_EQ(tab1_new_url.spec(), tab1_url.spec());
344 EXPECT_EQ(tab2_new_url.spec(), tab2_url.spec()); 344 EXPECT_EQ(tab2_new_url.spec(), tab2_url.spec());
345 EXPECT_EQ(tab3_new_url.spec(), tab3_url.spec()); 345 EXPECT_EQ(tab3_new_url.spec(), tab3_url.spec());
346 } 346 }
347 347
348 // Drag Tab_2 out of the Tab strip. A new window should open with this tab. 348 // Drag Tab_2 out of the Tab strip. A new window should open with this tab.
349 TEST_F(TabDraggingTest, Tab2OutOfTabStrip) { 349 TEST_F(TabDraggingTest, Tab2OutOfTabStrip) {
350 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 350 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
351 ASSERT_TRUE(browser.get()); 351 ASSERT_TRUE(browser.get());
352 scoped_ptr<WindowProxy> window(browser->GetWindow()); 352 scoped_refptr<WindowProxy> window(browser->GetWindow());
353 ASSERT_TRUE(window.get()); 353 ASSERT_TRUE(window.get());
354 354
355 // Get initial tab count. 355 // Get initial tab count.
356 int initial_tab_count = 0; 356 int initial_tab_count = 0;
357 ASSERT_TRUE(browser->GetTabCount(&initial_tab_count)); 357 ASSERT_TRUE(browser->GetTabCount(&initial_tab_count));
358 ASSERT_TRUE(1 == initial_tab_count); 358 ASSERT_TRUE(1 == initial_tab_count);
359 359
360 // Get Tab_1 which comes with the browser window. 360 // Get Tab_1 which comes with the browser window.
361 scoped_ptr<TabProxy> tab1(browser->GetTab(0)); 361 scoped_refptr<TabProxy> tab1(browser->GetTab(0));
362 ASSERT_TRUE(tab1.get()); 362 ASSERT_TRUE(tab1.get());
363 GURL tab1_url; 363 GURL tab1_url;
364 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url)); 364 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_url));
365 365
366 // Add Tab_2. 366 // Add Tab_2.
367 GURL tab2_url("about:version"); 367 GURL tab2_url("about:version");
368 ASSERT_TRUE(browser->AppendTab(tab2_url)); 368 ASSERT_TRUE(browser->AppendTab(tab2_url));
369 scoped_ptr<TabProxy> tab2(browser->GetTab(1)); 369 scoped_refptr<TabProxy> tab2(browser->GetTab(1));
370 ASSERT_TRUE(tab2.get()); 370 ASSERT_TRUE(tab2.get());
371 371
372 // Add Tab_3. 372 // Add Tab_3.
373 GURL tab3_url("about:plugins"); 373 GURL tab3_url("about:plugins");
374 ASSERT_TRUE(browser->AppendTab(tab3_url)); 374 ASSERT_TRUE(browser->AppendTab(tab3_url));
375 scoped_ptr<TabProxy> tab3(browser->GetTab(2)); 375 scoped_refptr<TabProxy> tab3(browser->GetTab(2));
376 ASSERT_TRUE(tab3.get()); 376 ASSERT_TRUE(tab3.get());
377 377
378 // Make sure 3 tabs are opened. 378 // Make sure 3 tabs are opened.
379 ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2, 379 ASSERT_TRUE(browser->WaitForTabCountToBecome(initial_tab_count + 2,
380 10000)); 380 10000));
381 381
382 // Make sure all the tab URL specs are different. 382 // Make sure all the tab URL specs are different.
383 ASSERT_TRUE(tab1_url != tab2_url); 383 ASSERT_TRUE(tab1_url != tab2_url);
384 ASSERT_TRUE(tab1_url != tab3_url); 384 ASSERT_TRUE(tab1_url != tab3_url);
385 ASSERT_TRUE(tab2_url != tab3_url); 385 ASSERT_TRUE(tab2_url != tab3_url);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 ASSERT_TRUE(browser->SimulateDrag(start, end, 444 ASSERT_TRUE(browser->SimulateDrag(start, end,
445 views::Event::EF_LEFT_BUTTON_DOWN, 445 views::Event::EF_LEFT_BUTTON_DOWN,
446 false)); 446 false));
447 447
448 // Now, first make sure that the old window has only two tabs remaining. 448 // Now, first make sure that the old window has only two tabs remaining.
449 int new_tab_count = 0; 449 int new_tab_count = 0;
450 ASSERT_TRUE(browser->GetTabCount(&new_tab_count)); 450 ASSERT_TRUE(browser->GetTabCount(&new_tab_count));
451 ASSERT_EQ(2, new_tab_count); 451 ASSERT_EQ(2, new_tab_count);
452 452
453 // Get the two tabs - they are called Tab_1 and Tab_2 in the old window. 453 // Get the two tabs - they are called Tab_1 and Tab_2 in the old window.
454 tab1.reset(browser->GetTab(0)); 454 tab1 = browser->GetTab(0);
455 ASSERT_TRUE(tab1.get()); 455 ASSERT_TRUE(tab1.get());
456 GURL tab1_new_url; 456 GURL tab1_new_url;
457 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url)); 457 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
458 458
459 tab2.reset(browser->GetTab(1)); 459 tab2 = browser->GetTab(1);
460 ASSERT_TRUE(tab2.get()); 460 ASSERT_TRUE(tab2.get());
461 GURL tab2_new_url; 461 GURL tab2_new_url;
462 ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url)); 462 ASSERT_TRUE(tab2->GetCurrentURL(&tab2_new_url));
463 463
464 // Now check for proper shifting of tabs; i.e., Tab_3 in window 1 should 464 // Now check for proper shifting of tabs; i.e., Tab_3 in window 1 should
465 // shift left to the position of Tab_2; Tab_1 should stay where it was. 465 // shift left to the position of Tab_2; Tab_1 should stay where it was.
466 EXPECT_EQ(tab1_new_url.spec(), tab1_url.spec()); 466 EXPECT_EQ(tab1_new_url.spec(), tab1_url.spec());
467 EXPECT_EQ(tab2_new_url.spec(), tab3_url.spec()); 467 EXPECT_EQ(tab2_new_url.spec(), tab3_url.spec());
468 468
469 // Now check to make sure a new window has opened. 469 // Now check to make sure a new window has opened.
470 scoped_ptr<BrowserProxy> browser2(automation()->GetBrowserWindow(1)); 470 scoped_refptr<BrowserProxy> browser2(automation()->GetBrowserWindow(1));
471 ASSERT_TRUE(browser2.get()); 471 ASSERT_TRUE(browser2.get());
472 scoped_ptr<WindowProxy> window2(browser2->GetWindow()); 472 scoped_refptr<WindowProxy> window2(browser2->GetWindow());
473 ASSERT_TRUE(window2.get()); 473 ASSERT_TRUE(window2.get());
474 474
475 // Make sure that the new window has only one tab. 475 // Make sure that the new window has only one tab.
476 int tab_count_window_2 = 0; 476 int tab_count_window_2 = 0;
477 ASSERT_TRUE(browser2->GetTabCount(&tab_count_window_2)); 477 ASSERT_TRUE(browser2->GetTabCount(&tab_count_window_2));
478 ASSERT_EQ(1, tab_count_window_2); 478 ASSERT_EQ(1, tab_count_window_2);
479 479
480 // Get Tab_1_2 which should be Tab_1 in Window 2. 480 // Get Tab_1_2 which should be Tab_1 in Window 2.
481 scoped_ptr<TabProxy> tab1_2(browser2->GetTab(0)); 481 scoped_refptr<TabProxy> tab1_2(browser2->GetTab(0));
482 ASSERT_TRUE(tab1_2.get()); 482 ASSERT_TRUE(tab1_2.get());
483 GURL tab1_2_url; 483 GURL tab1_2_url;
484 ASSERT_TRUE(tab1_2->GetCurrentURL(&tab1_2_url)); 484 ASSERT_TRUE(tab1_2->GetCurrentURL(&tab1_2_url));
485 485
486 // Tab_1_2 of Window 2 should essentially be Tab_2 of Window 1. 486 // Tab_1_2 of Window 2 should essentially be Tab_2 of Window 1.
487 EXPECT_EQ(tab1_2_url.spec(), tab2_url.spec()); 487 EXPECT_EQ(tab1_2_url.spec(), tab2_url.spec());
488 EXPECT_NE(tab1_2_url.spec(), tab1_url.spec()); 488 EXPECT_NE(tab1_2_url.spec(), tab1_url.spec());
489 EXPECT_NE(tab1_2_url.spec(), tab3_url.spec()); 489 EXPECT_NE(tab1_2_url.spec(), tab3_url.spec());
490 } 490 }
OLDNEW
« no previous file with comments | « chrome/browser/views/find_bar_win_uitest.cc ('k') | chrome/common/logging_chrome_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698