| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/string_piece.h" | 6 #include "base/strings/string_piece.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace | 94 } // namespace |
| 95 | 95 |
| 96 class PluginPowerSaverBrowserTest : virtual public InProcessBrowserTest { | 96 class PluginPowerSaverBrowserTest : virtual public InProcessBrowserTest { |
| 97 public: | 97 public: |
| 98 void SetUpCommandLine(base::CommandLine* command_line) override { | 98 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 99 command_line->AppendSwitch(switches::kEnablePluginPowerSaver); | 99 command_line->AppendSwitch(switches::kEnablePluginPowerSaver); |
| 100 command_line->AppendSwitch(switches::kEnablePepperTesting); | 100 command_line->AppendSwitch(switches::kEnablePepperTesting); |
| 101 command_line->AppendSwitch(switches::kEnablePluginPlaceholderTesting); | 101 command_line->AppendSwitch(switches::kEnablePluginPlaceholderTesting); |
| 102 command_line->AppendSwitchASCII( |
| 103 switches::kOverridePluginPowerSaverForTesting, "ignore-list"); |
| 102 | 104 |
| 103 ASSERT_TRUE(ppapi::RegisterPowerSaverTestPlugin(command_line)); | 105 ASSERT_TRUE(ppapi::RegisterPowerSaverTestPlugin(command_line)); |
| 104 } | 106 } |
| 105 | 107 |
| 106 protected: | 108 protected: |
| 107 void LoadHTML(const char* html) { | 109 void LoadHTML(const char* html) { |
| 108 std::string url_str = "data:text/html;charset=utf-8,"; | 110 std::string url_str = "data:text/html;charset=utf-8,"; |
| 109 url_str.append(html); | 111 url_str.append(html); |
| 110 ui_test_utils::NavigateToURL(browser(), GURL(url_str)); | 112 ui_test_utils::NavigateToURL(browser(), GURL(url_str)); |
| 111 EXPECT_TRUE(content::WaitForRenderFrameReady( | 113 EXPECT_TRUE(content::WaitForRenderFrameReady( |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 250 |
| 249 EXPECT_FALSE(PluginLoaded(background_contents, "same_origin")); | 251 EXPECT_FALSE(PluginLoaded(background_contents, "same_origin")); |
| 250 EXPECT_FALSE(PluginLoaded(background_contents, "small_cross_origin")); | 252 EXPECT_FALSE(PluginLoaded(background_contents, "small_cross_origin")); |
| 251 | 253 |
| 252 browser()->tab_strip_model()->SelectNextTab(); | 254 browser()->tab_strip_model()->SelectNextTab(); |
| 253 EXPECT_EQ(background_contents, GetActiveWebContents()); | 255 EXPECT_EQ(background_contents, GetActiveWebContents()); |
| 254 | 256 |
| 255 VerifyPluginMarkedEssential(background_contents, "same_origin"); | 257 VerifyPluginMarkedEssential(background_contents, "same_origin"); |
| 256 VerifyPluginIsThrottled(background_contents, "small_cross_origin"); | 258 VerifyPluginIsThrottled(background_contents, "small_cross_origin"); |
| 257 } | 259 } |
| OLD | NEW |