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