| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->base_url()); | 306 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->base_url()); |
| 307 EXPECT_TRUE(content::WaitForRenderFrameReady( | 307 EXPECT_TRUE(content::WaitForRenderFrameReady( |
| 308 GetActiveWebContents()->GetMainFrame())); | 308 GetActiveWebContents()->GetMainFrame())); |
| 309 } | 309 } |
| 310 | 310 |
| 311 // Returns the background WebContents. | 311 // Returns the background WebContents. |
| 312 content::WebContents* LoadHTMLInBackgroundTab(const std::string& html) { | 312 content::WebContents* LoadHTMLInBackgroundTab(const std::string& html) { |
| 313 embedded_test_server()->RegisterRequestHandler( | 313 embedded_test_server()->RegisterRequestHandler( |
| 314 base::Bind(&RespondWithHTML, html)); | 314 base::Bind(&RespondWithHTML, html)); |
| 315 ui_test_utils::NavigateToURLWithDisposition( | 315 ui_test_utils::NavigateToURLWithDisposition( |
| 316 browser(), embedded_test_server()->base_url(), NEW_BACKGROUND_TAB, | 316 browser(), embedded_test_server()->base_url(), |
| 317 WindowOpenDisposition::NEW_BACKGROUND_TAB, |
| 317 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 318 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 318 | 319 |
| 319 int index = browser()->tab_strip_model()->GetIndexOfLastWebContentsOpenedBy( | 320 int index = browser()->tab_strip_model()->GetIndexOfLastWebContentsOpenedBy( |
| 320 GetActiveWebContents(), 0 /* start_index */); | 321 GetActiveWebContents(), 0 /* start_index */); |
| 321 content::WebContents* contents = | 322 content::WebContents* contents = |
| 322 browser()->tab_strip_model()->GetWebContentsAt(index); | 323 browser()->tab_strip_model()->GetWebContentsAt(index); |
| 323 EXPECT_TRUE(content::WaitForRenderFrameReady(contents->GetMainFrame())); | 324 EXPECT_TRUE(content::WaitForRenderFrameReady(contents->GetMainFrame())); |
| 324 return contents; | 325 return contents; |
| 325 } | 326 } |
| 326 | 327 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 std::string script = | 729 std::string script = |
| 729 "window.document.getElementById('expand_to_peripheral').height = 200;" | 730 "window.document.getElementById('expand_to_peripheral').height = 200;" |
| 730 "window.document.getElementById('expand_to_peripheral').width = 200;" | 731 "window.document.getElementById('expand_to_peripheral').width = 200;" |
| 731 "window.document.getElementById('expand_to_essential').height = 400;" | 732 "window.document.getElementById('expand_to_essential').height = 400;" |
| 732 "window.document.getElementById('expand_to_essential').width = 400;"; | 733 "window.document.getElementById('expand_to_essential').width = 400;"; |
| 733 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), script)); | 734 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), script)); |
| 734 | 735 |
| 735 VerifyPluginIsThrottled(GetActiveWebContents(), "expand_to_peripheral"); | 736 VerifyPluginIsThrottled(GetActiveWebContents(), "expand_to_peripheral"); |
| 736 VerifyPluginMarkedEssential(GetActiveWebContents(), "expand_to_essential"); | 737 VerifyPluginMarkedEssential(GetActiveWebContents(), "expand_to_essential"); |
| 737 } | 738 } |
| OLD | NEW |