Chromium Code Reviews| 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 #ifndef CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ | 5 #ifndef CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ |
| 6 #define CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ | 6 #define CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 | 66 |
| 67 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; | 67 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; |
| 68 | 68 |
| 69 // What variant are we running - newlib, glibc, pnacl, etc? | 69 // What variant are we running - newlib, glibc, pnacl, etc? |
| 70 // This is used to compute what directory we're pulling data from, but it can | 70 // This is used to compute what directory we're pulling data from, but it can |
| 71 // also be used to affect the behavior of the test. | 71 // also be used to affect the behavior of the test. |
| 72 virtual FilePath::StringType Variant() = 0; | 72 virtual FilePath::StringType Variant() = 0; |
| 73 | 73 |
| 74 // Map a file relative to the variant directory to a URL served by the test | 74 // Map a file relative to the variant directory to a URL served by the test |
| 75 // web server. | 75 // web server. |
| 76 GURL TestURL(const FilePath::StringType& test_file); | 76 GURL TestURL(const FilePath::StringType& url_fragment); |
| 77 | 77 |
| 78 // Load a URL and listen to automation events with a given handler. | 78 // Load a URL and listen to automation events with a given handler. |
| 79 // Returns true if the test glue function correctly. (The handler should | 79 // Returns true if the test glue function correctly. (The handler should |
| 80 // seperately indicate if the test failed.) | 80 // seperately indicate if the test failed.) |
| 81 bool RunJavascriptTest(const GURL& url, TestMessageHandler* handler); | 81 bool RunJavascriptTest(const GURL& url, TestMessageHandler* handler); |
| 82 | 82 |
| 83 // Run a simple test that checks that a nexe loads correctly. Useful for | 83 // Run a simple test that checks that a nexe loads correctly. Useful for |
| 84 // setting up other tests, such as checking that UMA data was logged. | 84 // setting up other tests, such as checking that UMA data was logged. |
| 85 void RunLoadTest(const FilePath::StringType& test_file); | 85 void RunLoadTest(const FilePath::StringType& test_file); |
| 86 | 86 |
| 87 // Run a test that was originally written to use NaCl's integration testing | |
| 88 // jig. These tests were originally driven by NaCl's SCons build in the | |
| 89 // nacl_integration test stage on the Chrome waterfall. Changes in the | |
| 90 // boundaries between the Chrome and NaCl repos have resulted in many of | |
| 91 // these tests having a stronger afinity with the Chrome repo. This method | |
|
Mark Seaborn
2012/09/12 18:09:45
'affinity'
Nick Bray (chromium)
2012/09/12 20:50:59
Done.
| |
| 92 // provides a compatability layer to simplify turning nacl_integration tests | |
|
Mark Seaborn
2012/09/12 18:09:45
'compatibility'
Nick Bray (chromium)
2012/09/12 20:50:59
Done.
| |
| 93 // into browser tests. | |
| 94 void RunNaClIntegrationTest(const FilePath::StringType& url_fragment); | |
| 95 | |
| 87 private: | 96 private: |
| 88 bool StartTestServer(); | 97 bool StartTestServer(); |
| 89 | 98 |
| 90 scoped_ptr<net::TestServer> test_server_; | 99 scoped_ptr<net::TestServer> test_server_; |
| 91 }; | 100 }; |
| 92 | 101 |
| 93 class NaClBrowserTestNewlib : public NaClBrowserTestBase { | 102 class NaClBrowserTestNewlib : public NaClBrowserTestBase { |
| 94 public: | 103 public: |
| 95 virtual FilePath::StringType Variant() OVERRIDE; | 104 virtual FilePath::StringType Variant() OVERRIDE; |
| 96 }; | 105 }; |
| 97 | 106 |
| 98 class NaClBrowserTestGLibc : public NaClBrowserTestBase { | 107 class NaClBrowserTestGLibc : public NaClBrowserTestBase { |
| 99 public: | 108 public: |
| 100 virtual FilePath::StringType Variant() OVERRIDE; | 109 virtual FilePath::StringType Variant() OVERRIDE; |
| 101 }; | 110 }; |
| 102 | 111 |
| 103 #define NACL_BROWSER_TEST_F(suite, name, body) \ | 112 #define NACL_BROWSER_TEST_F(suite, name, body) \ |
| 104 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ | 113 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ |
| 105 body \ | 114 body \ |
| 106 IN_PROC_BROWSER_TEST_F(suite##GLibc, name) \ | 115 IN_PROC_BROWSER_TEST_F(suite##GLibc, name) \ |
| 107 body | 116 body |
| 108 | 117 |
| 109 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ | 118 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ |
| OLD | NEW |