summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-09 22:26:59 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-09 22:26:59 +0000
commitbc2edd7dd1d13484134970054b4d86e9d6aa7e59 (patch)
treed9ca2c7189a80a769954187d6c4b1137c2c57beb /chrome/test
parent44281e0f80ec95ac224bdafff41eee8902804760 (diff)
downloadchromium_src-bc2edd7dd1d13484134970054b4d86e9d6aa7e59.zip
chromium_src-bc2edd7dd1d13484134970054b4d86e9d6aa7e59.tar.gz
chromium_src-bc2edd7dd1d13484134970054b4d86e9d6aa7e59.tar.bz2
Revert 109316 - Revert 109254 - Change WebGL conformance tests from UI tests to InProcessBrowserTests.
InProcessBrowserTest is enough for our purpose. This change is to get ready to use a GPU BrowserTest framework where we could have more specific test expectations (like per RENDERER), and InProcessBrowserTest seems like the way to go. Also, we simplify the test mechanism on how to report back results: from three states to a simple message. BUG=none TEST=gpu bots: gpu_tests Review URL: http://codereview.chromium.org/8477048 TBR=zmo@google.com Review URL: http://codereview.chromium.org/8506030 TBR=zmo@google.com Review URL: http://codereview.chromium.org/8497051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/data/gpu/webgl_conformance.html50
-rw-r--r--chrome/test/gpu/webgl_conformance_tests.cc75
2 files changed, 55 insertions, 70 deletions
diff --git a/chrome/test/data/gpu/webgl_conformance.html b/chrome/test/data/gpu/webgl_conformance.html
index ca067e7..a173db8 100644
--- a/chrome/test/data/gpu/webgl_conformance.html
+++ b/chrome/test/data/gpu/webgl_conformance.html
@@ -5,15 +5,10 @@
</script>
<script>
var BASE_URL = "../../../../third_party/webgl_conformance/";
-var running;
-var result;
+var gl = null;
var message;
function start(start_url) {
- running = true;
- result = true;
- message = "";
-
// Report function called by each conformance test.
function report(type, msg, success) {
var reportType = WebGLTestHarnessModule.TestHarness.reportType;
@@ -22,21 +17,26 @@ function start(start_url) {
// Accept every page loaded.
return true;
case reportType.TEST_RESULT:
- if (!success) {
- // If any test fails, the result is false.
- result = false;
- message += msg + "\n";
- }
+ if (!success)
+ message = "FAILURE: " + msg;
+ else
+ message = "SUCCESS";
break;
case reportType.FINISH_PAGE:
- if (!success) {
- // Result is false if a timeout occurs.
- result = false;
- message += "Timeout (" + window.webglTestHarness.timeoutDelay +
- " ms)\n";
- }
+ if (!success)
+ message = "TIMEOUT (" + window.webglTestHarness.timeoutDelay + " ms)";
case reportType.FINISHED_ALL_TESTS:
- running = false;
+ if (message.substr(0, 7) != "SUCCESS") {
+ var ext = gl.getExtension("WEBGL_debug_renderer_info");
+ if (ext) {
+ message += "\nGL_VENDOR: " +
+ gl.getParameter(ext.UNMASKED_VENDOR_WEBGL) + "\n";
+ message += "GL_RENDERER: " +
+ gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
+ }
+ }
+ domAutomationController.setAutomationId(1);
+ domAutomationController.send(message);
break;
}
}
@@ -57,16 +57,16 @@ function start(start_url) {
return context;
}
+ message = "";
+
// Assert the WebGL context exists.
- var context = create3DContext();
- if (!context) {
- message += "Unable to fetch WebGL rendering context for Canvas.\n";
- running = false;
- result = false;
+ gl = create3DContext();
+ if (!gl) {
+ message = "FAILURE: unable to fetch WebGL context";
+ domAutomationController.setAutomationId(1);
+ domAutomationController.send(message);
return;
}
- message += "WebGL VENDOR: " + context.getParameter(context.VENDOR) + "\n";
- message += "WebGL RENDERER: " + context.getParameter(context.RENDERER) + "\n";
var iframe = document.getElementById("testframe");
var testHarness = new WebGLTestHarnessModule.TestHarness(
diff --git a/chrome/test/gpu/webgl_conformance_tests.cc b/chrome/test/gpu/webgl_conformance_tests.cc
index 2c171cb..b8ca609 100644
--- a/chrome/test/gpu/webgl_conformance_tests.cc
+++ b/chrome/test/gpu/webgl_conformance_tests.cc
@@ -2,33 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/test/test_timeouts.h"
-#include "base/utf_string_conversions.h"
+#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/test/automation/tab_proxy.h"
-#include "chrome/test/ui/javascript_test_util.h"
-#include "chrome/test/ui/ui_test.h"
+#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
#include "content/public/common/content_switches.h"
#include "net/base/net_util.h"
namespace {
-class WebGLConformanceTests : public UITest {
+class WebGLConformanceTests : public InProcessBrowserTest {
public:
- WebGLConformanceTests() {
- show_window_ = true;
- dom_automation_enabled_ = true;
- }
+ WebGLConformanceTests() {}
+
+ virtual void SetUpCommandLine(CommandLine* command_line) {
+ // This enables DOM automation for tab contents.
+ EnableDOMAutomation();
- void SetUp() {
- // Ensure that a GPU bot is never blacklisted.
- launch_arguments_.AppendSwitch(switches::kIgnoreGpuBlacklist);
- UITest::SetUp();
+ // Allow privileged WebGL extensions.
+ command_line->AppendSwitch(switches::kEnablePrivilegedWebGLExtensions);
}
- void RunTest(const std::string& url) {
+ virtual void SetUpInProcessBrowserTestFixture() {
FilePath webgl_conformance_path;
PathService::Get(base::DIR_SOURCE_ROOT, &webgl_conformance_path);
webgl_conformance_path = webgl_conformance_path.Append(
@@ -38,42 +36,29 @@ class WebGLConformanceTests : public UITest {
ASSERT_TRUE(file_util::DirectoryExists(webgl_conformance_path))
<< "Missing conformance tests: " << webgl_conformance_path.value();
- FilePath test_path;
- PathService::Get(chrome::DIR_TEST_DATA, &test_path);
- test_path = test_path.Append(FILE_PATH_LITERAL("gpu"));
- test_path = test_path.Append(FILE_PATH_LITERAL("webgl_conformance.html"));
-
- scoped_refptr<TabProxy> tab(GetActiveTab());
- ASSERT_TRUE(tab.get());
-
- ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
- tab->NavigateToURL(net::FilePathToFileURL(test_path)));
-
- ASSERT_TRUE(tab->NavigateToURLAsync(
- GURL("javascript:start('" + url + "');")));
-
- // Block until the test completes.
- ASSERT_TRUE(WaitUntilJavaScriptCondition(
- tab, L"", L"window.domAutomationController.send(!running);",
- TestTimeouts::large_test_timeout_ms()));
+ PathService::Get(chrome::DIR_TEST_DATA, &test_path_);
+ test_path_ = test_path_.Append(FILE_PATH_LITERAL("gpu"));
+ test_path_ = test_path_.Append(FILE_PATH_LITERAL("webgl_conformance.html"));
+ }
- // Read out the test result.
- std::wstring result, message;
- ASSERT_TRUE(tab->ExecuteAndExtractString(
- L"",
- L"window.domAutomationController.send(JSON.stringify(result));",
- &result));
- ASSERT_TRUE(tab->ExecuteAndExtractString(
- L"",
- L"window.domAutomationController.send(message);",
- &message));
+ void RunTest(const std::string& url) {
+ ui_test_utils::DOMMessageQueue message_queue;
+ ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_path_));
+ ui_test_utils::NavigateToURL(
+ browser(), GURL("javascript:start('" + url + "');"));
- EXPECT_EQ(WideToUTF8(result),"true") << WideToUTF8(message);
+ std::string message;
+ // Wait for message indicating the test has finished running.
+ ASSERT_TRUE(message_queue.WaitForMessage(&message));
+ EXPECT_STREQ("\"SUCCESS\"", message.c_str()) << message;
}
+
+ private:
+ FilePath test_path_;
};
#define CONFORMANCE_TEST(name, url) \
-TEST_F(WebGLConformanceTests, name) { \
+IN_PROC_BROWSER_TEST_F(WebGLConformanceTests, name) { \
RunTest(url); \
}