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

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

Issue 211033: Automated ui test porting + cleanup:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: all green\! Created 11 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
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 "base/gfx/rect.h" 7 #include "base/gfx/rect.h"
8 #include "chrome/app/chrome_dll_resource.h" 8 #include "chrome/app/chrome_dll_resource.h"
9 #include "chrome/browser/view_ids.h" 9 #include "chrome/browser/view_ids.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // ____________ ____________ ____________ 96 // ____________ ____________ ____________
97 // / \ / \ / \ 97 // / \ / \ / \
98 // | Tab_1 | Tab_2 | Tab_3 | 98 // | Tab_1 | Tab_2 | Tab_3 |
99 // ---- ---- ---- ---- ---- ---- ---- ---- ---- 99 // ---- ---- ---- ---- ---- ---- ---- ---- ----
100 // x---- ----> 100 // x---- ---->
101 // ____________ 101 // ____________
102 // / X \ 102 // / X \
103 // | Tab_1 | 103 // | Tab_1 |
104 // ---- ---- ---- 104 // ---- ---- ----
105 105
106 POINT start; 106 gfx::Point start(bounds1.x() + bounds1.width() / 2,
107 POINT end; 107 bounds1.y() + bounds1.height() / 2);
108 start.x = bounds1.x() + bounds1.width()/2; 108 gfx::Point end(start.x() + 2 * bounds1.width() / 3, start.y());
109 start.y = bounds1.y() + bounds1.height()/2;
110 end.x = start.x + 2*bounds1.width()/3;
111 end.y = start.y;
112 ASSERT_TRUE(browser->SimulateDrag(start, end, 109 ASSERT_TRUE(browser->SimulateDrag(start, end,
113 views::Event::EF_LEFT_BUTTON_DOWN, 110 views::Event::EF_LEFT_BUTTON_DOWN,
114 false)); 111 false));
115 112
116 // Now check for expected results. 113 // Now check for expected results.
117 tab1 = browser->GetTab(0); 114 tab1 = browser->GetTab(0);
118 ASSERT_TRUE(tab1.get()); 115 ASSERT_TRUE(tab1.get());
119 GURL tab1_new_url; 116 GURL tab1_new_url;
120 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url)); 117 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
121 118
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // ____________ ____________ ____________ 194 // ____________ ____________ ____________
198 // / \ / \ / \ 195 // / \ / \ / \
199 // | Tab_1 | Tab_2 | Tab_3 | 196 // | Tab_1 | Tab_2 | Tab_3 |
200 // ---- ---- ---- ---- ---- ---- ---- ---- ---- 197 // ---- ---- ---- ---- ---- ---- ---- ---- ----
201 // x---- ---- ---- ---- ---- ----> 198 // x---- ---- ---- ---- ---- ---->
202 // ____________ 199 // ____________
203 // / X \ 200 // / X \
204 // | Tab_1 | 201 // | Tab_1 |
205 // ---- ---- ---- 202 // ---- ---- ----
206 203
207 POINT start; 204 gfx::Point start(bounds1.x() + bounds1.width() / 2,
208 POINT end; 205 bounds1.y() + bounds1.height() / 2);
209 start.x = bounds1.x() + bounds1.width()/2; 206 gfx::Point end(start.x() + bounds1.width() / 2 + bounds2.width() +
210 start.y = bounds1.y() + bounds1.height()/2; 207 bounds3.width() / 2,
211 end.x = start.x + bounds1.width()/2 + bounds2.width() + bounds3.width()/2; 208 start.y());
212 end.y = start.y;
213 ASSERT_TRUE(browser->SimulateDrag(start, end, 209 ASSERT_TRUE(browser->SimulateDrag(start, end,
214 views::Event::EF_LEFT_BUTTON_DOWN, 210 views::Event::EF_LEFT_BUTTON_DOWN,
215 false)); 211 false));
216 212
217 // Now check for expected results. 213 // Now check for expected results.
218 tab1 = browser->GetTab(0); 214 tab1 = browser->GetTab(0);
219 ASSERT_TRUE(tab1.get()); 215 ASSERT_TRUE(tab1.get());
220 GURL tab1_new_url; 216 GURL tab1_new_url;
221 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url)); 217 ASSERT_TRUE(tab1->GetCurrentURL(&tab1_new_url));
222 218
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // ____________ ____________ ____________ 301 // ____________ ____________ ____________
306 // / \ / \ / \ 302 // / \ / \ / \
307 // | Tab_1 | Tab_2 | Tab_3 | 303 // | Tab_1 | Tab_2 | Tab_3 |
308 // ---- ---- ---- ---- ---- ---- ---- ---- ---- 304 // ---- ---- ---- ---- ---- ---- ---- ---- ----
309 // x---- ---- ---- ---- ---- ----> + ESCAPE 305 // x---- ---- ---- ---- ---- ----> + ESCAPE
310 // ____________ 306 // ____________
311 // / X \ 307 // / X \
312 // | Tab_1 | 308 // | Tab_1 |
313 // ---- ---- ---- 309 // ---- ---- ----
314 310
315 POINT start; 311 gfx::Point start(bounds1.x() + bounds1.width() / 2,
316 POINT end; 312 bounds1.y() + bounds1.height() / 2);
317 start.x = bounds1.x() + bounds1.width()/2; 313 gfx::Point end(start.x() + bounds1.width() / 2 + bounds2.width() +
318 start.y = bounds1.y() + bounds1.height()/2; 314 bounds3.width() / 2,
319 end.x = start.x + bounds1.width()/2 + bounds2.width() + bounds3.width()/2; 315 start.y());
320 end.y = start.y;
321 316
322 // Simulate drag with 'true' as the last parameter. This will interrupt 317 // Simulate drag with 'true' as the last parameter. This will interrupt
323 // in-flight with Escape. 318 // in-flight with Escape.
324 ASSERT_TRUE(browser->SimulateDrag(start, end, 319 ASSERT_TRUE(browser->SimulateDrag(start, end,
325 views::Event::EF_LEFT_BUTTON_DOWN, 320 views::Event::EF_LEFT_BUTTON_DOWN,
326 true)); 321 true));
327 322
328 // Now check for expected results. 323 // Now check for expected results.
329 tab1 = browser->GetTab(0); 324 tab1 = browser->GetTab(0);
330 ASSERT_TRUE(tab1.get()); 325 ASSERT_TRUE(tab1.get());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 // ---- ---- ---- ---- ---- ---- ---- ---- ---- 423 // ---- ---- ---- ---- ---- ---- ---- ---- ----
429 // x 424 // x
430 // | 425 // |
431 // | (Drag this below, out of tab strip) 426 // | (Drag this below, out of tab strip)
432 // V 427 // V
433 // ____________ 428 // ____________
434 // / X \ 429 // / X \
435 // | Tab_2 | (New Window) 430 // | Tab_2 | (New Window)
436 // ---- ---- ---- ---- ---- ---- ---- 431 // ---- ---- ---- ---- ---- ---- ----
437 432
438 POINT start; 433 gfx::Point start(bounds2.x() + bounds2.width() / 2,
439 POINT end; 434 bounds2.y() + bounds2.height() / 2);
440 start.x = bounds2.x() + bounds2.width()/2; 435 gfx::Point end(start.x(),
441 start.y = bounds2.y() + bounds2.height()/2; 436 start.y() + 3 * urlbar_bounds.height());
442 end.x = start.x;
443 end.y = start.y + 3*urlbar_bounds.height();
444 437
445 // Simulate tab drag. 438 // Simulate tab drag.
446 ASSERT_TRUE(browser->SimulateDrag(start, end, 439 ASSERT_TRUE(browser->SimulateDrag(start, end,
447 views::Event::EF_LEFT_BUTTON_DOWN, 440 views::Event::EF_LEFT_BUTTON_DOWN,
448 false)); 441 false));
449 442
450 // Now, first make sure that the old window has only two tabs remaining. 443 // Now, first make sure that the old window has only two tabs remaining.
451 int new_tab_count = 0; 444 int new_tab_count = 0;
452 ASSERT_TRUE(browser->GetTabCount(&new_tab_count)); 445 ASSERT_TRUE(browser->GetTabCount(&new_tab_count));
453 ASSERT_EQ(2, new_tab_count); 446 ASSERT_EQ(2, new_tab_count);
(...skipping 29 matching lines...) Expand all
483 scoped_refptr<TabProxy> tab1_2(browser2->GetTab(0)); 476 scoped_refptr<TabProxy> tab1_2(browser2->GetTab(0));
484 ASSERT_TRUE(tab1_2.get()); 477 ASSERT_TRUE(tab1_2.get());
485 GURL tab1_2_url; 478 GURL tab1_2_url;
486 ASSERT_TRUE(tab1_2->GetCurrentURL(&tab1_2_url)); 479 ASSERT_TRUE(tab1_2->GetCurrentURL(&tab1_2_url));
487 480
488 // Tab_1_2 of Window 2 should essentially be Tab_2 of Window 1. 481 // Tab_1_2 of Window 2 should essentially be Tab_2 of Window 1.
489 EXPECT_EQ(tab1_2_url.spec(), tab2_url.spec()); 482 EXPECT_EQ(tab1_2_url.spec(), tab2_url.spec());
490 EXPECT_NE(tab1_2_url.spec(), tab1_url.spec()); 483 EXPECT_NE(tab1_2_url.spec(), tab1_url.spec());
491 EXPECT_NE(tab1_2_url.spec(), tab3_url.spec()); 484 EXPECT_NE(tab1_2_url.spec(), tab3_url.spec());
492 } 485 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698