| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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 IsPnacl(); | 77 virtual bool IsAPnaclTest(); |
| 78 |
| 79 virtual bool IsPnaclDisabled(); |
| 78 | 80 |
| 79 // Map a file relative to the variant directory to a URL served by the test | 81 // Map a file relative to the variant directory to a URL served by the test |
| 80 // web server. | 82 // web server. |
| 81 GURL TestURL(const base::FilePath::StringType& url_fragment); | 83 GURL TestURL(const base::FilePath::StringType& url_fragment); |
| 82 | 84 |
| 83 // Load a URL and listen to automation events with a given handler. | 85 // Load a URL and listen to automation events with a given handler. |
| 84 // Returns true if the test glue function correctly. (The handler should | 86 // Returns true if the test glue function correctly. (The handler should |
| 85 // seperately indicate if the test failed.) | 87 // seperately indicate if the test failed.) |
| 86 bool RunJavascriptTest(const GURL& url, TestMessageHandler* handler); | 88 bool RunJavascriptTest(const GURL& url, TestMessageHandler* handler); |
| 87 | 89 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 113 public: | 115 public: |
| 114 virtual base::FilePath::StringType Variant() OVERRIDE; | 116 virtual base::FilePath::StringType Variant() OVERRIDE; |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 class NaClBrowserTestPnacl : public NaClBrowserTestBase { | 119 class NaClBrowserTestPnacl : public NaClBrowserTestBase { |
| 118 public: | 120 public: |
| 119 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 121 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
| 120 | 122 |
| 121 virtual base::FilePath::StringType Variant() OVERRIDE; | 123 virtual base::FilePath::StringType Variant() OVERRIDE; |
| 122 | 124 |
| 123 virtual bool IsPnacl() OVERRIDE; | 125 virtual bool IsAPnaclTest() OVERRIDE; |
| 126 }; |
| 127 |
| 128 // Class used to test that when --disable-pnacl is specified the PNaCl mime |
| 129 // type is not available. |
| 130 class NaClBrowserTestPnaclDisabled : public NaClBrowserTestBase { |
| 131 public: |
| 132 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
| 133 |
| 134 virtual base::FilePath::StringType Variant() OVERRIDE; |
| 135 |
| 136 virtual bool IsAPnaclTest() OVERRIDE; |
| 137 |
| 138 virtual bool IsPnaclDisabled() OVERRIDE; |
| 124 }; | 139 }; |
| 125 | 140 |
| 126 // Temporary class for running tests with the new cache enabled. Once all the | 141 // Temporary class for running tests with the new cache enabled. Once all the |
| 127 // pieces land, this will go away and the new cache will be on by default. | 142 // pieces land, this will go away and the new cache will be on by default. |
| 128 class NaClBrowserTestPnaclWithNewCache : public NaClBrowserTestPnacl { | 143 class NaClBrowserTestPnaclWithNewCache : public NaClBrowserTestPnacl { |
| 129 public: | 144 public: |
| 130 NaClBrowserTestPnaclWithNewCache(); | 145 NaClBrowserTestPnaclWithNewCache(); |
| 131 }; | 146 }; |
| 132 | 147 |
| 133 // A NaCl browser test only using static files. | 148 // A NaCl browser test only using static files. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 150 | 165 |
| 151 #if defined(ARCH_CPU_ARM_FAMILY) | 166 #if defined(ARCH_CPU_ARM_FAMILY) |
| 152 | 167 |
| 153 // There is no support for Glibc on ARM NaCl. | 168 // There is no support for Glibc on ARM NaCl. |
| 154 #define NACL_BROWSER_TEST_F(suite, name, body) \ | 169 #define NACL_BROWSER_TEST_F(suite, name, body) \ |
| 155 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ | 170 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ |
| 156 body | 171 body |
| 157 | 172 |
| 158 #else | 173 #else |
| 159 | 174 |
| 160 // Otherwise, we have Glibc, Newlib and PNaCl tests | 175 // Otherwise, we have Glibc, Newlib, Pnacl, and PnaclDisabled tests |
| 161 #define NACL_BROWSER_TEST_F(suite, name, body) \ | 176 #define NACL_BROWSER_TEST_F(suite, name, body) \ |
| 162 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ | 177 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ |
| 163 body \ | 178 body \ |
| 164 IN_PROC_BROWSER_TEST_F(suite##GLibc, name) \ | 179 IN_PROC_BROWSER_TEST_F(suite##GLibc, name) \ |
| 165 body \ | 180 body \ |
| 166 IN_PROC_BROWSER_TEST_F(suite##Pnacl, MAYBE_PNACL(name)) \ | 181 IN_PROC_BROWSER_TEST_F(suite##Pnacl, MAYBE_PNACL(name)) \ |
| 167 body | 182 body |
| 168 | 183 |
| 169 #endif | 184 #endif |
| 170 | 185 |
| 171 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ | 186 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ |
| OLD | NEW |