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

Side by Side Diff: chrome/browser/ui/panels/old_panel_browsertest.cc

Issue 10795090: Move ExecuteJavaScript functions from ui_test_utils.h to browser_test_utils.h so they can be reused… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/download/download_service.h" 7 #include "chrome/browser/download/download_service.h"
8 #include "chrome/browser/download/download_service_factory.h" 8 #include "chrome/browser/download/download_service_factory.h"
9 #include "chrome/browser/net/url_request_mock_util.h" 9 #include "chrome/browser/net/url_request_mock_util.h"
10 #include "chrome/browser/prefs/browser_prefs.h" 10 #include "chrome/browser/prefs/browser_prefs.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 FilePath(kTestDir), 364 FilePath(kTestDir),
365 FilePath(FILE_PATH_LITERAL("update-preferred-size.html")))); 365 FilePath(FILE_PATH_LITERAL("update-preferred-size.html"))));
366 params.url = url; 366 params.url = url;
367 Panel* panel = CreatePanelWithParams(params); 367 Panel* panel = CreatePanelWithParams(params);
368 368
369 // Expand the test page. 369 // Expand the test page.
370 gfx::Rect initial_bounds = panel->GetBounds(); 370 gfx::Rect initial_bounds = panel->GetBounds();
371 content::WindowedNotificationObserver enlarge( 371 content::WindowedNotificationObserver enlarge(
372 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 372 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
373 content::Source<Panel>(panel)); 373 content::Source<Panel>(panel));
374 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( 374 EXPECT_TRUE(content::ExecuteJavaScript(
375 panel->GetWebContents()->GetRenderViewHost(), 375 panel->GetWebContents()->GetRenderViewHost(),
376 std::wstring(), 376 std::wstring(),
377 L"changeSize(50);")); 377 L"changeSize(50);"));
378 enlarge.Wait(); 378 enlarge.Wait();
379 gfx::Rect bounds_on_grow = panel->GetBounds(); 379 gfx::Rect bounds_on_grow = panel->GetBounds();
380 EXPECT_GT(bounds_on_grow.width(), initial_bounds.width()); 380 EXPECT_GT(bounds_on_grow.width(), initial_bounds.width());
381 EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height()); 381 EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height());
382 382
383 // Shrink the test page. 383 // Shrink the test page.
384 content::WindowedNotificationObserver shrink( 384 content::WindowedNotificationObserver shrink(
385 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 385 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
386 content::Source<Panel>(panel)); 386 content::Source<Panel>(panel));
387 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( 387 EXPECT_TRUE(content::ExecuteJavaScript(
388 panel->GetWebContents()->GetRenderViewHost(), 388 panel->GetWebContents()->GetRenderViewHost(),
389 std::wstring(), 389 std::wstring(),
390 L"changeSize(-30);")); 390 L"changeSize(-30);"));
391 shrink.Wait(); 391 shrink.Wait();
392 gfx::Rect bounds_on_shrink = panel->GetBounds(); 392 gfx::Rect bounds_on_shrink = panel->GetBounds();
393 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width()); 393 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width());
394 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width()); 394 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width());
395 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height()); 395 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height());
396 396
397 // Verify resizing turns off auto-resizing and that it works. 397 // Verify resizing turns off auto-resizing and that it works.
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 params.url = GURL("data:text/html;charset=utf-8,<!doctype html><body>"); 1450 params.url = GURL("data:text/html;charset=utf-8,<!doctype html><body>");
1451 Panel* panel = CreatePanelWithParams(params); 1451 Panel* panel = CreatePanelWithParams(params);
1452 1452
1453 int initial_width = panel->GetBounds().width(); 1453 int initial_width = panel->GetBounds().width();
1454 int initial_height = panel->GetBounds().height(); 1454 int initial_height = panel->GetBounds().height();
1455 1455
1456 // Inject some HTML content into the panel. 1456 // Inject some HTML content into the panel.
1457 content::WindowedNotificationObserver enlarge( 1457 content::WindowedNotificationObserver enlarge(
1458 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 1458 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
1459 content::Source<Panel>(panel)); 1459 content::Source<Panel>(panel));
1460 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript( 1460 EXPECT_TRUE(content::ExecuteJavaScript(
1461 panel->GetWebContents()->GetRenderViewHost(), 1461 panel->GetWebContents()->GetRenderViewHost(),
1462 std::wstring(), 1462 std::wstring(),
1463 L"document.body.innerHTML =" 1463 L"document.body.innerHTML ="
1464 L"'<nobr>line of text and a <button>Button</button>';")); 1464 L"'<nobr>line of text and a <button>Button</button>';"));
1465 enlarge.Wait(); 1465 enlarge.Wait();
1466 1466
1467 // The panel should have become larger in both dimensions (the minimums 1467 // The panel should have become larger in both dimensions (the minimums
1468 // has to be set to be smaller then a simple 1-line content, so the autosize 1468 // has to be set to be smaller then a simple 1-line content, so the autosize
1469 // can work correctly. 1469 // can work correctly.
1470 EXPECT_GT(panel->GetBounds().width(), initial_width); 1470 EXPECT_GT(panel->GetBounds().width(), initial_width);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 EXPECT_GE(smaller_work_area_size.width(), panel->max_size().width()); 1526 EXPECT_GE(smaller_work_area_size.width(), panel->max_size().width());
1527 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height()); 1527 EXPECT_EQ(smaller_work_area_size.height(), panel->max_size().height());
1528 EXPECT_GT(old_full_size.width(), panel->full_size().width()); 1528 EXPECT_GT(old_full_size.width(), panel->full_size().width());
1529 EXPECT_GT(old_full_size.height(), panel->full_size().height()); 1529 EXPECT_GT(old_full_size.height(), panel->full_size().height());
1530 EXPECT_GE(panel->max_size().width(), panel->full_size().width()); 1530 EXPECT_GE(panel->max_size().width(), panel->full_size().width());
1531 EXPECT_GE(panel->max_size().height(), panel->full_size().height()); 1531 EXPECT_GE(panel->max_size().height(), panel->full_size().height());
1532 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height()); 1532 EXPECT_EQ(smaller_work_area_size.height(), panel->full_size().height());
1533 1533
1534 panel->Close(); 1534 panel->Close();
1535 } 1535 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_host_browsertest.cc ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698