Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_TEST_BASE_JAVASCRIPT_BROWSER_TEST_H_ | |
| 6 #define CHROME_TEST_BASE_JAVASCRIPT_BROWSER_TEST_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_vector.h" | |
| 9 #include "base/strings/string16.h" | |
| 10 #include "base/values.h" | |
| 11 #include "chrome/test/base/in_process_browser_test.h" | |
| 12 | |
| 13 // A base class providing construction of javascript testing assets. | |
| 14 class JavaScriptBrowserTest : public InProcessBrowserTest { | |
| 15 public: | |
| 16 static const base::FilePath::CharType kA11yAuditLibraryJSPath[]; | |
| 17 static const base::FilePath::CharType kMockJSPath[]; | |
| 18 static const base::FilePath::CharType kWebUILibraryJS[]; | |
| 19 static const base::FilePath::CharType kWebUITestFolder[]; | |
| 20 | |
| 21 typedef ScopedVector<const base::Value> ConstValueVector; | |
| 22 JavaScriptBrowserTest() {} | |
|
dmazzoni
2014/06/10 16:06:16
Nit: blank line before
David Tseng
2014/06/10 20:14:25
Done.
| |
| 23 virtual ~JavaScriptBrowserTest() {} | |
| 24 | |
| 25 // Add a custom helper JS library for your test. | |
| 26 // If a relative path is specified, it'll be read | |
| 27 // as relative to the test data dir. | |
| 28 void AddLibrary(const base::FilePath& library_path); | |
| 29 | |
| 30 protected: | |
| 31 // InProcessBrowserTest overrides. | |
| 32 virtual void SetUpOnMainThread() OVERRIDE; | |
| 33 | |
| 34 // Builds a vector of strings of all added javascript libraries suitable for | |
| 35 // execution by subclasses. | |
| 36 void BuildJavascriptLibraries(std::vector<base::string16>* libraries); | |
| 37 | |
| 38 // Builds a string with a call to the runTest JS function, passing the | |
| 39 // given |is_async|, |test_name| and its |args|. | |
| 40 // This is then suitable for execution by subclasses in a | |
| 41 // |RunJavaScriptBrowserTestF| call. | |
| 42 base::string16 BuildRunTestJSCall(bool is_async, | |
| 43 const std::string& test_name, | |
| 44 const ConstValueVector& args); | |
| 45 | |
| 46 private: | |
| 47 // User added libraries. | |
| 48 std::vector<base::FilePath> user_libraries_; | |
| 49 | |
| 50 // User library search paths. | |
| 51 std::vector<base::FilePath> library_search_paths_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(JavaScriptBrowserTest); | |
| 54 }; | |
| 55 | |
| 56 #endif // CHROME_TEST_BASE_JAVASCRIPT_BROWSER_TEST_H_ | |
| OLD | NEW |