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

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

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. Created 7 years, 11 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/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/devtools/devtools_window.h" 8 #include "chrome/browser/devtools/devtools_window.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/net/url_request_mock_util.h" 10 #include "chrome/browser/net/url_request_mock_util.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // Ensure panel has auto resized to original web content size. 418 // Ensure panel has auto resized to original web content size.
419 // The resize will update the docked panel collection. 419 // The resize will update the docked panel collection.
420 WaitForStableInitialSize initial_resize(panel); 420 WaitForStableInitialSize initial_resize(panel);
421 initial_resize.Wait(); 421 initial_resize.Wait();
422 gfx::Rect initial_bounds = panel->GetBounds(); 422 gfx::Rect initial_bounds = panel->GetBounds();
423 423
424 // Expand the test page. The resize will update the docked panel collection. 424 // Expand the test page. The resize will update the docked panel collection.
425 WaitForAutoResizeWider enlarge(panel); 425 WaitForAutoResizeWider enlarge(panel);
426 EXPECT_TRUE(content::ExecuteJavaScript( 426 EXPECT_TRUE(content::ExecuteJavaScript(
427 panel->GetWebContents()->GetRenderViewHost(), 427 panel->GetWebContents()->GetRenderViewHost(),
428 std::wstring(), 428 "",
429 L"changeSize(50);")); 429 "changeSize(50);"));
430 enlarge.Wait(); 430 enlarge.Wait();
431 gfx::Rect bounds_on_grow = panel->GetBounds(); 431 gfx::Rect bounds_on_grow = panel->GetBounds();
432 EXPECT_GT(bounds_on_grow.width(), initial_bounds.width()); 432 EXPECT_GT(bounds_on_grow.width(), initial_bounds.width());
433 EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height()); 433 EXPECT_EQ(bounds_on_grow.height(), initial_bounds.height());
434 434
435 // Shrink the test page. The resize will update the docked panel collection. 435 // Shrink the test page. The resize will update the docked panel collection.
436 WaitForAutoResizeNarrower shrink(panel); 436 WaitForAutoResizeNarrower shrink(panel);
437 EXPECT_TRUE(content::ExecuteJavaScript( 437 EXPECT_TRUE(content::ExecuteJavaScript(
438 panel->GetWebContents()->GetRenderViewHost(), 438 panel->GetWebContents()->GetRenderViewHost(),
439 std::wstring(), 439 "",
440 L"changeSize(-30);")); 440 "changeSize(-30);"));
441 shrink.Wait(); 441 shrink.Wait();
442 gfx::Rect bounds_on_shrink = panel->GetBounds(); 442 gfx::Rect bounds_on_shrink = panel->GetBounds();
443 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width()); 443 EXPECT_LT(bounds_on_shrink.width(), bounds_on_grow.width());
444 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width()); 444 EXPECT_GT(bounds_on_shrink.width(), initial_bounds.width());
445 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height()); 445 EXPECT_EQ(bounds_on_shrink.height(), initial_bounds.height());
446 446
447 // Verify resizing turns off auto-resizing and panel no longer auto-resizes. 447 // Verify resizing turns off auto-resizing and panel no longer auto-resizes.
448 gfx::Rect previous_bounds = panel->GetBounds(); 448 gfx::Rect previous_bounds = panel->GetBounds();
449 // These should be identical because the panel is expanded. 449 // These should be identical because the panel is expanded.
450 EXPECT_EQ(previous_bounds.size(), panel->GetRestoredBounds().size()); 450 EXPECT_EQ(previous_bounds.size(), panel->GetRestoredBounds().size());
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 WaitForStableInitialSize initial_resize(panel); 1559 WaitForStableInitialSize initial_resize(panel);
1560 initial_resize.Wait(); 1560 initial_resize.Wait();
1561 1561
1562 int initial_width = panel->GetBounds().width(); 1562 int initial_width = panel->GetBounds().width();
1563 int initial_height = panel->GetBounds().height(); 1563 int initial_height = panel->GetBounds().height();
1564 1564
1565 // Inject some HTML content into the panel. 1565 // Inject some HTML content into the panel.
1566 WaitForAutoResizeWider enlarge(panel); 1566 WaitForAutoResizeWider enlarge(panel);
1567 EXPECT_TRUE(content::ExecuteJavaScript( 1567 EXPECT_TRUE(content::ExecuteJavaScript(
1568 panel->GetWebContents()->GetRenderViewHost(), 1568 panel->GetWebContents()->GetRenderViewHost(),
1569 std::wstring(), 1569 "",
1570 L"document.body.innerHTML =" 1570 "document.body.innerHTML ="
1571 L"'<nobr>line of text and a <button>Button</button>';")); 1571 " '<nobr>line of text and a <button>Button</button>';"));
1572 enlarge.Wait(); 1572 enlarge.Wait();
1573 1573
1574 // The panel should have become larger in both dimensions (the minimums 1574 // The panel should have become larger in both dimensions (the minimums
1575 // has to be set to be smaller then a simple 1-line content, so the autosize 1575 // has to be set to be smaller then a simple 1-line content, so the autosize
1576 // can work correctly. 1576 // can work correctly.
1577 EXPECT_GT(panel->GetBounds().width(), initial_width); 1577 EXPECT_GT(panel->GetBounds().width(), initial_width);
1578 EXPECT_GT(panel->GetBounds().height(), initial_height); 1578 EXPECT_GT(panel->GetBounds().height(), initial_height);
1579 1579
1580 panel->Close(); 1580 panel->Close();
1581 } 1581 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 #else 1758 #else
1759 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize 1759 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize
1760 #endif 1760 #endif
1761 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, 1761 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest,
1762 MAYBE_FocusChangeEventOnMinimize) { 1762 MAYBE_FocusChangeEventOnMinimize) {
1763 // This is needed so the subsequently created panels can be activated. 1763 // This is needed so the subsequently created panels can be activated.
1764 // On a Mac, it transforms background-only test process into foreground one. 1764 // On a Mac, it transforms background-only test process into foreground one.
1765 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 1765 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
1766 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; 1766 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_;
1767 } 1767 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_host_browsertest.cc ('k') | chrome/browser/ui/webui/bookmarks_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698