| 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" |
| 11 #include "content/public/test/javascript_test_observer.h" | 11 #include "content/public/test/javascript_test_observer.h" |
| 12 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 12 | 13 |
| 13 // A helper base class that decodes structured automation messages of the form: | 14 // A helper base class that decodes structured automation messages of the form: |
| 14 // {"type": type_name, ...} | 15 // {"type": type_name, ...} |
| 15 class StructuredMessageHandler : public content::TestMessageHandler { | 16 class StructuredMessageHandler : public content::TestMessageHandler { |
| 16 public: | 17 public: |
| 17 MessageResponse HandleMessage(const std::string& json) override; | 18 MessageResponse HandleMessage(const std::string& json) override; |
| 18 | 19 |
| 19 // This method provides a higher-level interface for handling JSON messages | 20 // This method provides a higher-level interface for handling JSON messages |
| 20 // from the DOM automation controler. Instead of handling a string | 21 // from the DOM automation controler. Instead of handling a string |
| 21 // containing a JSON-encoded object, this specialization of TestMessageHandler | 22 // containing a JSON-encoded object, this specialization of TestMessageHandler |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // provides a compatibility layer to simplify turning nacl_integration tests | 97 // provides a compatibility layer to simplify turning nacl_integration tests |
| 97 // into browser tests. | 98 // into browser tests. |
| 98 // |full_url| is true if the full URL is given, otherwise it is a | 99 // |full_url| is true if the full URL is given, otherwise it is a |
| 99 // relative URL. | 100 // relative URL. |
| 100 void RunNaClIntegrationTest(const base::FilePath::StringType& url, | 101 void RunNaClIntegrationTest(const base::FilePath::StringType& url, |
| 101 bool full_url = false); | 102 bool full_url = false); |
| 102 | 103 |
| 103 private: | 104 private: |
| 104 bool StartTestServer(); | 105 bool StartTestServer(); |
| 105 | 106 |
| 106 scoped_ptr<net::SpawnedTestServer> test_server_; | 107 scoped_ptr<net::EmbeddedTestServer> test_server_; |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 class NaClBrowserTestNewlib : public NaClBrowserTestBase { | 110 class NaClBrowserTestNewlib : public NaClBrowserTestBase { |
| 110 public: | 111 public: |
| 111 base::FilePath::StringType Variant() override; | 112 base::FilePath::StringType Variant() override; |
| 112 }; | 113 }; |
| 113 | 114 |
| 114 class NaClBrowserTestGLibc : public NaClBrowserTestBase { | 115 class NaClBrowserTestGLibc : public NaClBrowserTestBase { |
| 115 public: | 116 public: |
| 116 base::FilePath::StringType Variant() override; | 117 base::FilePath::StringType Variant() override; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 206 |
| 206 #define NACL_BROWSER_TEST_F(suite, name, body) \ | 207 #define NACL_BROWSER_TEST_F(suite, name, body) \ |
| 207 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ | 208 IN_PROC_BROWSER_TEST_F(suite##Newlib, name) \ |
| 208 body \ | 209 body \ |
| 209 IN_PROC_BROWSER_TEST_F(suite##GLibc, MAYBE_GLIBC(name)) \ | 210 IN_PROC_BROWSER_TEST_F(suite##GLibc, MAYBE_GLIBC(name)) \ |
| 210 body \ | 211 body \ |
| 211 IN_PROC_BROWSER_TEST_F(suite##Pnacl, MAYBE_PNACL(name)) \ | 212 IN_PROC_BROWSER_TEST_F(suite##Pnacl, MAYBE_PNACL(name)) \ |
| 212 body | 213 body |
| 213 | 214 |
| 214 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ | 215 #endif // CHROME_TEST_NACL_NACL_BROWSERTEST_UTIL_H_ |
| OLD | NEW |