| 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/files/file_path.h" | 8 #include "base/files/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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 base::FilePath::StringType Variant() = 0; | 72 virtual base::FilePath::StringType Variant() = 0; |
| 73 | 73 |
| 74 // Where are the files for this class of test located on disk? | 74 // Where are the files for this class of test located on disk? |
| 75 virtual bool GetDocumentRoot(base::FilePath* document_root); | 75 virtual bool GetDocumentRoot(base::FilePath* document_root); |
| 76 | 76 |
| 77 virtual bool IsAPnaclTest(); | 77 virtual bool IsAPnaclTest(); |
| 78 | 78 |
| 79 virtual bool IsPnaclDisabled(); | |
| 80 | |
| 81 // Map a file relative to the variant directory to a URL served by the test | 79 // Map a file relative to the variant directory to a URL served by the test |
| 82 // web server. | 80 // web server. |
| 83 GURL TestURL(const base::FilePath::StringType& url_fragment); | 81 GURL TestURL(const base::FilePath::StringType& url_fragment); |
| 84 | 82 |
| 85 // Load a URL and listen to automation events with a given handler. | 83 // Load a URL and listen to automation events with a given handler. |
| 86 // Returns true if the test glue function correctly. (The handler should | 84 // Returns true if the test glue function correctly. (The handler should |
| 87 // seperately indicate if the test failed.) | 85 // seperately indicate if the test failed.) |
| 88 bool RunJavascriptTest(const GURL& url, content::TestMessageHandler* handler); | 86 bool RunJavascriptTest(const GURL& url, content::TestMessageHandler* handler); |
| 89 | 87 |
| 90 // Run a simple test that checks that a nexe loads correctly. Useful for | 88 // Run a simple test that checks that a nexe loads correctly. Useful for |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 123 |
| 126 virtual bool IsAPnaclTest() OVERRIDE; | 124 virtual bool IsAPnaclTest() OVERRIDE; |
| 127 }; | 125 }; |
| 128 | 126 |
| 129 class NaClBrowserTestPnaclNonSfi : public NaClBrowserTestBase { | 127 class NaClBrowserTestPnaclNonSfi : public NaClBrowserTestBase { |
| 130 public: | 128 public: |
| 131 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; | 129 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; |
| 132 virtual base::FilePath::StringType Variant() OVERRIDE; | 130 virtual base::FilePath::StringType Variant() OVERRIDE; |
| 133 }; | 131 }; |
| 134 | 132 |
| 135 // Class used to test that when --disable-pnacl is specified the PNaCl mime | |
| 136 // type is not available. | |
| 137 class NaClBrowserTestPnaclDisabled : public NaClBrowserTestBase { | |
| 138 public: | |
| 139 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; | |
| 140 | |
| 141 virtual base::FilePath::StringType Variant() OVERRIDE; | |
| 142 | |
| 143 virtual bool IsAPnaclTest() OVERRIDE; | |
| 144 | |
| 145 virtual bool IsPnaclDisabled() OVERRIDE; | |
| 146 }; | |
| 147 | |
| 148 class NaClBrowserTestNonSfiMode : public NaClBrowserTestBase { | 133 class NaClBrowserTestNonSfiMode : public NaClBrowserTestBase { |
| 149 public: | 134 public: |
| 150 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; | 135 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; |
| 151 virtual base::FilePath::StringType Variant() OVERRIDE; | 136 virtual base::FilePath::StringType Variant() OVERRIDE; |
| 152 }; | 137 }; |
| 153 | 138 |
| 154 // A NaCl browser test only using static files. | 139 // A NaCl browser test only using static files. |
| 155 class NaClBrowserTestStatic : public NaClBrowserTestBase { | 140 class NaClBrowserTestStatic : public NaClBrowserTestBase { |
| 156 public: | 141 public: |
| 157 virtual base::FilePath::StringType Variant() OVERRIDE; | 142 virtual base::FilePath::StringType Variant() OVERRIDE; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 185 |
| 201 #define NACL_BROWSER_TEST_F(suite, name, body) \ | 186 #define NACL_BROWSER_TEST_F(suite, name, body) \ |
| 202 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ | 187 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ |
| 203 body \ | 188 body \ |
| 204 IN_PROC_BROWSER_TEST_F(suite##GLibc, MAYBE_GLIBC(name)) \ | 189 IN_PROC_BROWSER_TEST_F(suite##GLibc, MAYBE_GLIBC(name)) \ |
| 205 body \ | 190 body \ |
| 206 IN_PROC_BROWSER_TEST_F(suite##Pnacl, MAYBE_PNACL(name)) \ | 191 IN_PROC_BROWSER_TEST_F(suite##Pnacl, MAYBE_PNACL(name)) \ |
| 207 body | 192 body |
| 208 | 193 |
| 209 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ | 194 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ |
| OLD | NEW |