| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/test/base/javascript_browser_test.h" | 5 #include "chrome/test/base/javascript_browser_test.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "content/public/browser/web_ui.h" | 10 #include "content/public/browser/web_ui.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 base::FilePath gen_test_data_directory; | 46 base::FilePath gen_test_data_directory; |
| 47 ASSERT_TRUE( | 47 ASSERT_TRUE( |
| 48 PathService::Get(chrome::DIR_GEN_TEST_DATA, &gen_test_data_directory)); | 48 PathService::Get(chrome::DIR_GEN_TEST_DATA, &gen_test_data_directory)); |
| 49 library_search_paths_.push_back(gen_test_data_directory); | 49 library_search_paths_.push_back(gen_test_data_directory); |
| 50 | 50 |
| 51 base::FilePath source_root_directory; | 51 base::FilePath source_root_directory; |
| 52 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_root_directory)); | 52 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_root_directory)); |
| 53 library_search_paths_.push_back(source_root_directory); | 53 library_search_paths_.push_back(source_root_directory); |
| 54 | 54 |
| 55 base::FilePath resources_pack_path; | |
| 56 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | |
| 57 ResourceBundle::GetSharedInstance().AddDataPackFromPath( | |
| 58 resources_pack_path, ui::SCALE_FACTOR_NONE); | |
| 59 | |
| 60 AddLibrary(base::FilePath(kMockJSPath)); | 55 AddLibrary(base::FilePath(kMockJSPath)); |
| 61 AddLibrary(base::FilePath(kWebUILibraryJS)); | 56 AddLibrary(base::FilePath(kWebUILibraryJS)); |
| 62 } | 57 } |
| 63 | 58 |
| 64 // TODO(dtseng): Make this return bool (success/failure) and remove ASSERt_TRUE | 59 // TODO(dtseng): Make this return bool (success/failure) and remove ASSERt_TRUE |
| 65 // calls. | 60 // calls. |
| 66 void JavaScriptBrowserTest::BuildJavascriptLibraries( | 61 void JavaScriptBrowserTest::BuildJavascriptLibraries( |
| 67 std::vector<base::string16>* libraries) { | 62 std::vector<base::string16>* libraries) { |
| 68 ASSERT_TRUE(libraries != NULL); | 63 ASSERT_TRUE(libraries != NULL); |
| 69 std::vector<base::FilePath>::iterator user_libraries_iterator; | 64 std::vector<base::FilePath>::iterator user_libraries_iterator; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 ConstValueVector::const_iterator arguments_iterator; | 109 ConstValueVector::const_iterator arguments_iterator; |
| 115 for (arguments_iterator = test_func_args.begin(); | 110 for (arguments_iterator = test_func_args.begin(); |
| 116 arguments_iterator != test_func_args.end(); | 111 arguments_iterator != test_func_args.end(); |
| 117 ++arguments_iterator) { | 112 ++arguments_iterator) { |
| 118 baked_argument_list->Append((*arguments_iterator)->DeepCopy()); | 113 baked_argument_list->Append((*arguments_iterator)->DeepCopy()); |
| 119 } | 114 } |
| 120 arguments.push_back(baked_argument_list); | 115 arguments.push_back(baked_argument_list); |
| 121 return content::WebUI::GetJavascriptCall(std::string("runTest"), | 116 return content::WebUI::GetJavascriptCall(std::string("runTest"), |
| 122 arguments.get()); | 117 arguments.get()); |
| 123 } | 118 } |
| OLD | NEW |