| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| 11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 #include "content/public/test/browser_test_utils.h" |
| 13 #include "content/test/gpu/gpu_test_config.h" | 14 #include "content/test/gpu/gpu_test_config.h" |
| 14 #include "content/test/gpu/gpu_test_expectations_parser.h" | 15 #include "content/test/gpu/gpu_test_expectations_parser.h" |
| 15 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 19 class WebGLConformanceTests : public InProcessBrowserTest { | 20 class WebGLConformanceTests : public InProcessBrowserTest { |
| 20 public: | 21 public: |
| 21 WebGLConformanceTests() {} | 22 WebGLConformanceTests() {} |
| 22 | 23 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 51 void RunTest(const std::string& url) { | 52 void RunTest(const std::string& url) { |
| 52 std::string test_name = | 53 std::string test_name = |
| 53 testing::UnitTest::GetInstance()->current_test_info()->name(); | 54 testing::UnitTest::GetInstance()->current_test_info()->name(); |
| 54 int32 expectation = | 55 int32 expectation = |
| 55 test_expectations_.GetTestExpectation(test_name, bot_config_); | 56 test_expectations_.GetTestExpectation(test_name, bot_config_); |
| 56 if (expectation != GPUTestExpectationsParser::kGpuTestPass) { | 57 if (expectation != GPUTestExpectationsParser::kGpuTestPass) { |
| 57 LOG(WARNING) << "Test " << test_name << " is bypassed"; | 58 LOG(WARNING) << "Test " << test_name << " is bypassed"; |
| 58 return; | 59 return; |
| 59 } | 60 } |
| 60 | 61 |
| 61 ui_test_utils::DOMMessageQueue message_queue; | 62 content::DOMMessageQueue message_queue; |
| 62 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_path_)); | 63 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_path_)); |
| 63 ui_test_utils::NavigateToURL( | 64 ui_test_utils::NavigateToURL( |
| 64 browser(), GURL("javascript:start('" + url + "');")); | 65 browser(), GURL("javascript:start('" + url + "');")); |
| 65 | 66 |
| 66 std::string message; | 67 std::string message; |
| 67 // Wait for message indicating the test has finished running. | 68 // Wait for message indicating the test has finished running. |
| 68 ASSERT_TRUE(message_queue.WaitForMessage(&message)); | 69 ASSERT_TRUE(message_queue.WaitForMessage(&message)); |
| 69 EXPECT_STREQ("\"SUCCESS\"", message.c_str()) << message; | 70 EXPECT_STREQ("\"SUCCESS\"", message.c_str()) << message; |
| 70 } | 71 } |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 FilePath test_path_; | 74 FilePath test_path_; |
| 74 GPUTestBotConfig bot_config_; | 75 GPUTestBotConfig bot_config_; |
| 75 GPUTestExpectationsParser test_expectations_; | 76 GPUTestExpectationsParser test_expectations_; |
| 76 }; | 77 }; |
| 77 | 78 |
| 78 #define CONFORMANCE_TEST(name, url) \ | 79 #define CONFORMANCE_TEST(name, url) \ |
| 79 IN_PROC_BROWSER_TEST_F(WebGLConformanceTests, name) { \ | 80 IN_PROC_BROWSER_TEST_F(WebGLConformanceTests, name) { \ |
| 80 RunTest(url); \ | 81 RunTest(url); \ |
| 81 } | 82 } |
| 82 | 83 |
| 83 // The test declarations are located in webgl_conformance_test_list_autogen.h, | 84 // The test declarations are located in webgl_conformance_test_list_autogen.h, |
| 84 // because the list is automatically generated by a script. | 85 // because the list is automatically generated by a script. |
| 85 // See: generate_webgl_conformance_test_list.py | 86 // See: generate_webgl_conformance_test_list.py |
| 86 #include "webgl_conformance_test_list_autogen.h" | 87 #include "webgl_conformance_test_list_autogen.h" |
| 87 | 88 |
| 88 } // namespace | 89 } // namespace |
| OLD | NEW |