| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/test/trace_event_analyzer.h" | 8 #include "base/test/trace_event_analyzer.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 : public ExtensionApiTest, | 55 : public ExtensionApiTest, |
| 56 public testing::WithParamInterface<int> { | 56 public testing::WithParamInterface<int> { |
| 57 public: | 57 public: |
| 58 TabCapturePerformanceTest() {} | 58 TabCapturePerformanceTest() {} |
| 59 | 59 |
| 60 bool HasFlag(TestFlags flag) const { | 60 bool HasFlag(TestFlags flag) const { |
| 61 return (GetParam() & flag) == flag; | 61 return (GetParam() & flag) == flag; |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool IsGpuAvailable() const { | 64 bool IsGpuAvailable() const { |
| 65 return CommandLine::ForCurrentProcess()->HasSwitch("enable-gpu"); | 65 return base::CommandLine::ForCurrentProcess()->HasSwitch("enable-gpu"); |
| 66 } | 66 } |
| 67 | 67 |
| 68 std::string ScalingMethod() const { | 68 std::string ScalingMethod() const { |
| 69 switch (GetParam() & kScaleQualityMask) { | 69 switch (GetParam() & kScaleQualityMask) { |
| 70 case kScaleQualityFast: | 70 case kScaleQualityFast: |
| 71 return "fast"; | 71 return "fast"; |
| 72 case kScaleQualityGood: | 72 case kScaleQualityGood: |
| 73 return "good"; | 73 return "good"; |
| 74 case kScaleQualityBest: | 74 case kScaleQualityBest: |
| 75 return "best"; | 75 return "best"; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 93 if (HasFlag(kSmallWindow)) | 93 if (HasFlag(kSmallWindow)) |
| 94 suffix += "_small"; | 94 suffix += "_small"; |
| 95 return suffix; | 95 return suffix; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void SetUp() override { | 98 void SetUp() override { |
| 99 EnablePixelOutput(); | 99 EnablePixelOutput(); |
| 100 ExtensionApiTest::SetUp(); | 100 ExtensionApiTest::SetUp(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void SetUpCommandLine(CommandLine* command_line) override { | 103 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 104 if (!ScalingMethod().empty()) { | 104 if (!ScalingMethod().empty()) { |
| 105 command_line->AppendSwitchASCII(switches::kTabCaptureUpscaleQuality, | 105 command_line->AppendSwitchASCII(switches::kTabCaptureUpscaleQuality, |
| 106 ScalingMethod()); | 106 ScalingMethod()); |
| 107 command_line->AppendSwitchASCII(switches::kTabCaptureDownscaleQuality, | 107 command_line->AppendSwitchASCII(switches::kTabCaptureDownscaleQuality, |
| 108 ScalingMethod()); | 108 ScalingMethod()); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Some of the tests may launch http requests through JSON or AJAX | 111 // Some of the tests may launch http requests through JSON or AJAX |
| 112 // which causes a security error (cross domain request) when the page | 112 // which causes a security error (cross domain request) when the page |
| 113 // is loaded from the local file system ( file:// ). The following switch | 113 // is loaded from the local file system ( file:// ). The following switch |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 TabCapturePerformanceTest, | 247 TabCapturePerformanceTest, |
| 248 testing::Values( | 248 testing::Values( |
| 249 kScalingTestBase | kScaleQualityFast, | 249 kScalingTestBase | kScaleQualityFast, |
| 250 kScalingTestBase | kScaleQualityGood, | 250 kScalingTestBase | kScaleQualityGood, |
| 251 kScalingTestBase | kScaleQualityBest, | 251 kScalingTestBase | kScaleQualityBest, |
| 252 kScalingTestBase | kScaleQualityFast | kSmallWindow, | 252 kScalingTestBase | kScaleQualityFast | kSmallWindow, |
| 253 kScalingTestBase | kScaleQualityGood | kSmallWindow, | 253 kScalingTestBase | kScaleQualityGood | kSmallWindow, |
| 254 kScalingTestBase | kScaleQualityBest | kSmallWindow)); | 254 kScalingTestBase | kScaleQualityBest | kSmallWindow)); |
| 255 | 255 |
| 256 #endif // USE_AURA | 256 #endif // USE_AURA |
| OLD | NEW |