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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura_browsertest.cc

Issue 286943005: Reducing CPU cycles of hidden/minimized browser windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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
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 "content/browser/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 aura::test::EventGenerator generator(content->GetRootWindow(), content); 587 aura::test::EventGenerator generator(content->GetRootWindow(), content);
588 generator.GestureScrollSequence( 588 generator.GestureScrollSequence(
589 gfx::Point(bounds.x() + 2, bounds.y() + 10), 589 gfx::Point(bounds.x() + 2, bounds.y() + 10),
590 gfx::Point(bounds.right() - 10, bounds.y() + 10), 590 gfx::Point(bounds.right() - 10, bounds.y() + 10),
591 base::TimeDelta::FromMilliseconds(20), 591 base::TimeDelta::FromMilliseconds(20),
592 1); 592 1);
593 593
594 window->AddChild(shell()->web_contents()->GetContentNativeView()); 594 window->AddChild(shell()->web_contents()->GetContentNativeView());
595 } 595 }
596 596
597 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, 597 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ContentWindowClose) {
598 ContentWindowClose) {
599 ASSERT_NO_FATAL_FAILURE( 598 ASSERT_NO_FATAL_FAILURE(
600 StartTestWithPage("files/overscroll_navigation.html")); 599 StartTestWithPage("files/overscroll_navigation.html"));
601 600
602 WebContentsImpl* web_contents = 601 WebContentsImpl* web_contents =
603 static_cast<WebContentsImpl*>(shell()->web_contents()); 602 static_cast<WebContentsImpl*>(shell()->web_contents());
604 ExecuteSyncJSFunction(web_contents->GetMainFrame(), "navigate_next()"); 603 ExecuteSyncJSFunction(web_contents->GetMainFrame(), "navigate_next()");
605 EXPECT_EQ(1, GetCurrentIndex()); 604 EXPECT_EQ(1, GetCurrentIndex());
606 605
607 aura::Window* content = web_contents->GetContentNativeView(); 606 aura::Window* content = web_contents->GetContentNativeView();
608 gfx::Rect bounds = content->GetBoundsInRootWindow(); 607 gfx::Rect bounds = content->GetBoundsInRootWindow();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 base::TimeDelta::FromMilliseconds(2000), 676 base::TimeDelta::FromMilliseconds(2000),
678 10); 677 10);
679 base::string16 actual_title = title_watcher.WaitAndGetTitle(); 678 base::string16 actual_title = title_watcher.WaitAndGetTitle();
680 EXPECT_EQ(expected_title, actual_title); 679 EXPECT_EQ(expected_title, actual_title);
681 680
682 EXPECT_EQ(2, GetCurrentIndex()); 681 EXPECT_EQ(2, GetCurrentIndex());
683 EXPECT_TRUE(controller.CanGoBack()); 682 EXPECT_TRUE(controller.CanGoBack());
684 EXPECT_FALSE(controller.CanGoForward()); 683 EXPECT_FALSE(controller.CanGoForward());
685 } 684 }
686 685
686 // Verify that hiding a parent of the renderer will hide the content too.
687 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, HideContentOnParenHide) {
688 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/title1.html"));
689 WebContentsImpl* web_contents =
690 static_cast<WebContentsImpl*>(shell()->web_contents());
691 aura::Window* content = web_contents->GetContentNativeView();
sky 2014/05/20 23:33:51 I'm surprised this works. web_contents->GetContent
Mr4D (OOO till 08-26) 2014/05/21 14:25:03 I am not using this window - I am using it's paren
692 aura::Window* parent = content->parent();
693 EXPECT_TRUE(web_contents->should_normally_be_visible());
694 parent->Hide();
ncarter (slow) 2014/05/20 21:42:26 Does this actually minimize the parent? Wasn't the
Mr4D (OOO till 08-26) 2014/05/20 21:48:56 Well - If I understand sky's request correctly, we
sky 2014/05/20 23:33:51 Exactly.
695 EXPECT_FALSE(web_contents->should_normally_be_visible());
696 parent->Show();
697 EXPECT_TRUE(web_contents->should_normally_be_visible());
698 }
699
687 } // namespace content 700 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698