diff options
author | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 22:13:30 +0000 |
---|---|---|
committer | zmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-09 22:13:30 +0000 |
commit | 8be5bd63f15549b1fb009c69bfaacbfa0e36c359 (patch) | |
tree | c04cce419c09a891c2628847e6f6c295da7f52f2 /chrome/test/gpu/webgl_conformance_tests.cc | |
parent | 500b3bcb9472ff9e067e952b4fb7c58c1d6fce34 (diff) | |
download | chromium_src-8be5bd63f15549b1fb009c69bfaacbfa0e36c359.zip chromium_src-8be5bd63f15549b1fb009c69bfaacbfa0e36c359.tar.gz chromium_src-8be5bd63f15549b1fb009c69bfaacbfa0e36c359.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/gpu/webgl_conformance_tests.cc')
-rw-r--r-- | chrome/test/gpu/webgl_conformance_tests.cc | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/chrome/test/gpu/webgl_conformance_tests.cc b/chrome/test/gpu/webgl_conformance_tests.cc index b8ca609..2c171cb 100644 --- a/chrome/test/gpu/webgl_conformance_tests.cc +++ b/chrome/test/gpu/webgl_conformance_tests.cc @@ -2,31 +2,33 @@ // 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 "chrome/browser/ui/browser.h" +#include "base/test/test_timeouts.h" +#include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" +#include "chrome/test/automation/tab_proxy.h" +#include "chrome/test/ui/javascript_test_util.h" +#include "chrome/test/ui/ui_test.h" #include "content/public/common/content_switches.h" #include "net/base/net_util.h" namespace { -class WebGLConformanceTests : public InProcessBrowserTest { +class WebGLConformanceTests : public UITest { public: - WebGLConformanceTests() {} - - virtual void SetUpCommandLine(CommandLine* command_line) { - // This enables DOM automation for tab contents. - EnableDOMAutomation(); + WebGLConformanceTests() { + show_window_ = true; + dom_automation_enabled_ = true; + } - // Allow privileged WebGL extensions. - command_line->AppendSwitch(switches::kEnablePrivilegedWebGLExtensions); + void SetUp() { + // Ensure that a GPU bot is never blacklisted. + launch_arguments_.AppendSwitch(switches::kIgnoreGpuBlacklist); + UITest::SetUp(); } - virtual void SetUpInProcessBrowserTestFixture() { + void RunTest(const std::string& url) { FilePath webgl_conformance_path; PathService::Get(base::DIR_SOURCE_ROOT, &webgl_conformance_path); webgl_conformance_path = webgl_conformance_path.Append( @@ -36,29 +38,42 @@ class WebGLConformanceTests : public InProcessBrowserTest { ASSERT_TRUE(file_util::DirectoryExists(webgl_conformance_path)) << "Missing conformance tests: " << webgl_conformance_path.value(); - 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")); - } + 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")); - 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 + "');")); + scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); - 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; - } + 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())); - private: - FilePath test_path_; + // 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)); + + EXPECT_EQ(WideToUTF8(result),"true") << WideToUTF8(message); + } }; #define CONFORMANCE_TEST(name, url) \ -IN_PROC_BROWSER_TEST_F(WebGLConformanceTests, name) { \ +TEST_F(WebGLConformanceTests, name) { \ RunTest(url); \ } |