| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 // a status message indicating that it is essential. The test plugin sends a | 338 // a status message indicating that it is essential. The test plugin sends a |
| 339 // status message during: | 339 // status message during: |
| 340 // - Plugin creation, to handle a plugin freshly created from a poster. | 340 // - Plugin creation, to handle a plugin freshly created from a poster. |
| 341 // - Peripheral status change. | 341 // - Peripheral status change. |
| 342 // - In response to the explicit 'getPowerSaverStatus' request, in case the | 342 // - In response to the explicit 'getPowerSaverStatus' request, in case the |
| 343 // test has missed the above two events. | 343 // test has missed the above two events. |
| 344 void SimulateClickAndAwaitMarkedEssential(const std::string& element_id, | 344 void SimulateClickAndAwaitMarkedEssential(const std::string& element_id, |
| 345 const gfx::Point& point) { | 345 const gfx::Point& point) { |
| 346 WaitForPlaceholderReady(GetActiveWebContents(), element_id); | 346 WaitForPlaceholderReady(GetActiveWebContents(), element_id); |
| 347 content::SimulateMouseClickAt(GetActiveWebContents(), 0 /* modifiers */, | 347 content::SimulateMouseClickAt(GetActiveWebContents(), 0 /* modifiers */, |
| 348 blink::WebMouseEvent::ButtonLeft, point); | 348 blink::WebMouseEvent::Button::Left, point); |
| 349 | 349 |
| 350 VerifyPluginMarkedEssential(GetActiveWebContents(), element_id); | 350 VerifyPluginMarkedEssential(GetActiveWebContents(), element_id); |
| 351 } | 351 } |
| 352 | 352 |
| 353 // |element_id| must be an element on the foreground tab. | 353 // |element_id| must be an element on the foreground tab. |
| 354 void VerifyPluginIsPlaceholderOnly(const std::string& element_id) { | 354 void VerifyPluginIsPlaceholderOnly(const std::string& element_id) { |
| 355 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), element_id)); | 355 EXPECT_FALSE(PluginLoaded(GetActiveWebContents(), element_id)); |
| 356 WaitForPlaceholderReady(GetActiveWebContents(), element_id); | 356 WaitForPlaceholderReady(GetActiveWebContents(), element_id); |
| 357 } | 357 } |
| 358 | 358 |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 std::string script = | 728 std::string script = |
| 729 "window.document.getElementById('expand_to_peripheral').height = 200;" | 729 "window.document.getElementById('expand_to_peripheral').height = 200;" |
| 730 "window.document.getElementById('expand_to_peripheral').width = 200;" | 730 "window.document.getElementById('expand_to_peripheral').width = 200;" |
| 731 "window.document.getElementById('expand_to_essential').height = 400;" | 731 "window.document.getElementById('expand_to_essential').height = 400;" |
| 732 "window.document.getElementById('expand_to_essential').width = 400;"; | 732 "window.document.getElementById('expand_to_essential').width = 400;"; |
| 733 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), script)); | 733 ASSERT_TRUE(content::ExecuteScript(GetActiveWebContents(), script)); |
| 734 | 734 |
| 735 VerifyPluginIsThrottled(GetActiveWebContents(), "expand_to_peripheral"); | 735 VerifyPluginIsThrottled(GetActiveWebContents(), "expand_to_peripheral"); |
| 736 VerifyPluginMarkedEssential(GetActiveWebContents(), "expand_to_essential"); | 736 VerifyPluginMarkedEssential(GetActiveWebContents(), "expand_to_essential"); |
| 737 } | 737 } |
| OLD | NEW |