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 21 matching lines...) Expand all Loading... |
109 virtual base::FilePath::StringType Variant() OVERRIDE; | 111 virtual base::FilePath::StringType Variant() OVERRIDE; |
110 }; | 112 }; |
111 | 113 |
112 class NaClBrowserTestGLibc : public NaClBrowserTestBase { | 114 class NaClBrowserTestGLibc : public NaClBrowserTestBase { |
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: |
| 121 virtual base::FilePath::StringType Variant() OVERRIDE; |
| 122 |
| 123 virtual bool IsAPnaclTest() OVERRIDE; |
| 124 }; |
| 125 |
| 126 // Class used to test that when --disable-pnacl is specified the PNaCl mime |
| 127 // type is not available. |
| 128 class NaClBrowserTestPnaclDisabled : public NaClBrowserTestBase { |
| 129 public: |
119 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 130 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
120 | 131 |
121 virtual base::FilePath::StringType Variant() OVERRIDE; | 132 virtual base::FilePath::StringType Variant() OVERRIDE; |
122 | 133 |
123 virtual bool IsPnacl() OVERRIDE; | 134 virtual bool IsAPnaclTest() OVERRIDE; |
| 135 |
| 136 virtual bool IsPnaclDisabled() OVERRIDE; |
124 }; | 137 }; |
125 | 138 |
126 // Temporary class for running tests with the old cache enabled. Once all the | 139 // Temporary class for running tests with the old cache enabled. Once all the |
127 // pieces are stable and the old code is gone, this will go away. | 140 // pieces are stable and the old code is gone, this will go away. |
128 class NaClBrowserTestPnaclWithOldCache : public NaClBrowserTestPnacl { | 141 class NaClBrowserTestPnaclWithOldCache : public NaClBrowserTestPnacl { |
129 public: | 142 public: |
130 NaClBrowserTestPnaclWithOldCache(); | 143 NaClBrowserTestPnaclWithOldCache(); |
131 }; | 144 }; |
132 | 145 |
133 // A NaCl browser test only using static files. | 146 // A NaCl browser test only using static files. |
(...skipping 14 matching lines...) Expand all Loading... |
148 | 161 |
149 #if defined(ARCH_CPU_ARM_FAMILY) | 162 #if defined(ARCH_CPU_ARM_FAMILY) |
150 | 163 |
151 // There is no support for Glibc on ARM NaCl. | 164 // There is no support for Glibc on ARM NaCl. |
152 #define NACL_BROWSER_TEST_F(suite, name, body) \ | 165 #define NACL_BROWSER_TEST_F(suite, name, body) \ |
153 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ | 166 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ |
154 body | 167 body |
155 | 168 |
156 #else | 169 #else |
157 | 170 |
158 // Otherwise, we have Glibc, Newlib and PNaCl tests | 171 // Otherwise, we have Glibc, Newlib and Pnacl tests |
159 #define NACL_BROWSER_TEST_F(suite, name, body) \ | 172 #define NACL_BROWSER_TEST_F(suite, name, body) \ |
160 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ | 173 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ |
161 body \ | 174 body \ |
162 IN_PROC_BROWSER_TEST_F(suite##GLibc, name) \ | 175 IN_PROC_BROWSER_TEST_F(suite##GLibc, name) \ |
163 body \ | 176 body \ |
164 IN_PROC_BROWSER_TEST_F(suite##Pnacl, MAYBE_PNACL(name)) \ | 177 IN_PROC_BROWSER_TEST_F(suite##Pnacl, MAYBE_PNACL(name)) \ |
165 body | 178 body |
166 | 179 |
167 #endif | 180 #endif |
168 | 181 |
169 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ | 182 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ |
OLD | NEW |