OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" | 10 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" |
11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
12 #include "content/public/test/content_browser_test_utils.h" | 12 #include "content/public/test/content_browser_test_utils.h" |
13 #include "media/base/media_switches.h" | 13 #include "media/base/media_switches.h" |
14 #include "net/test/embedded_test_server/embedded_test_server.h" | 14 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 15 #include "ui/gl/gl_switches.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 static const char kGetDepthStreamAndCallCreateImageBitmap[] = | 19 static const char kGetDepthStreamAndCallCreateImageBitmap[] = |
19 "getDepthStreamAndCallCreateImageBitmap"; | 20 "getDepthStreamAndCallCreateImageBitmap"; |
| 21 static const char kDepthStreamToRGBAUint8Texture[] = |
| 22 "depthStreamToRGBAUint8Texture"; |
| 23 static const char kDepthStreamToRGBAFloatTexture[] = |
| 24 "depthStreamToRGBAFloatTexture"; |
20 | 25 |
21 void RemoveSwitchFromCommandLine(base::CommandLine* command_line, | 26 void RemoveSwitchFromCommandLine(base::CommandLine* command_line, |
22 const std::string& switch_value) { | 27 const std::string& switch_value) { |
23 base::CommandLine::StringVector argv = command_line->argv(); | 28 base::CommandLine::StringVector argv = command_line->argv(); |
24 const base::CommandLine::StringType switch_string = | 29 const base::CommandLine::StringType switch_string = |
25 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
26 base::ASCIIToUTF16(switch_value); | 31 base::ASCIIToUTF16(switch_value); |
27 #else | 32 #else |
28 switch_value; | 33 switch_value; |
29 #endif | 34 #endif |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 ASSERT_TRUE(embedded_test_server()->Start()); | 72 ASSERT_TRUE(embedded_test_server()->Start()); |
68 | 73 |
69 GURL url( | 74 GURL url( |
70 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); | 75 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); |
71 NavigateToURL(shell(), url); | 76 NavigateToURL(shell(), url); |
72 | 77 |
73 ExecuteJavascriptAndWaitForOk(base::StringPrintf( | 78 ExecuteJavascriptAndWaitForOk(base::StringPrintf( |
74 "%s({video: true});", kGetDepthStreamAndCallCreateImageBitmap)); | 79 "%s({video: true});", kGetDepthStreamAndCallCreateImageBitmap)); |
75 } | 80 } |
76 | 81 |
| 82 class WebRtcDepthCaptureWebGLBrowserTest |
| 83 : public WebRtcDepthCaptureBrowserTest { |
| 84 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 85 WebRtcDepthCaptureBrowserTest::SetUpCommandLine(command_line); |
| 86 // WebGL tests require hardware GPU. |
| 87 command_line->AppendSwitch(switches::kUseGpuInTests); |
| 88 } |
| 89 }; |
| 90 |
| 91 // TODO(aleksandar.stojiljkovic): Enable the test on all the platforms when GPU |
| 92 // process initialization crashes gets resolved. |
| 93 // See https://crbug.com/662336 and https://crbug.com/510291 |
| 94 #if defined(USE_OZONE) || defined(OS_WIN) || defined(MEMORY_SANITIZER) |
| 95 #define MAYBE_DepthStreamToRGBAUint8Texture \ |
| 96 DISABLED_DepthStreamToRGBAUint8Texture |
| 97 #else |
| 98 #define MAYBE_DepthStreamToRGBAUint8Texture DepthStreamToRGBAUint8Texture |
| 99 #endif |
| 100 IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureWebGLBrowserTest, |
| 101 MAYBE_DepthStreamToRGBAUint8Texture) { |
| 102 ASSERT_TRUE(embedded_test_server()->Start()); |
| 103 GURL url( |
| 104 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); |
| 105 NavigateToURL(shell(), url); |
| 106 ExecuteJavascriptAndWaitForOk( |
| 107 base::StringPrintf("%s({video: true});", kDepthStreamToRGBAUint8Texture)); |
| 108 } |
| 109 |
| 110 // TODO(aleksandar.stojiljkovic): Enable the test on all the platforms when GPU |
| 111 // process initialization crashes gets resolved. |
| 112 // See https://crbug.com/662336 and https://crbug.com/510291 |
| 113 #if defined(USE_OZONE) || defined(OS_WIN) || defined(MEMORY_SANITIZER) |
| 114 #define MAYBE_DepthStreamToRGBAFloatTexture \ |
| 115 DISABLED_DepthStreamToRGBAFloatTexture |
| 116 #else |
| 117 #define MAYBE_DepthStreamToRGBAFloatTexture DepthStreamToRGBAFloatTexture |
| 118 #endif |
| 119 IN_PROC_BROWSER_TEST_F(WebRtcDepthCaptureWebGLBrowserTest, |
| 120 MAYBE_DepthStreamToRGBAFloatTexture) { |
| 121 ASSERT_TRUE(embedded_test_server()->Start()); |
| 122 GURL url( |
| 123 embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); |
| 124 NavigateToURL(shell(), url); |
| 125 ExecuteJavascriptAndWaitForOk( |
| 126 base::StringPrintf("%s({video: true});", kDepthStreamToRGBAFloatTexture)); |
| 127 } |
| 128 |
77 } // namespace content | 129 } // namespace content |
OLD | NEW |