| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 protected: | 71 protected: |
| 72 base::Closure js_test_execution_done_callback_; | 72 base::Closure js_test_execution_done_callback_; |
| 73 const base::Value* result_; | 73 const base::Value* result_; |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 void AddComponentsResources() { | 76 void AddComponentsResources() { |
| 77 base::FilePath pak_file; | 77 base::FilePath pak_file; |
| 78 base::FilePath pak_dir; | 78 base::FilePath pak_dir; |
| 79 #if defined(OS_ANDROID) |
| 80 CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &pak_dir)); |
| 81 pak_dir = pak_dir.Append(FILE_PATH_LITERAL("paks")); |
| 82 #else |
| 79 PathService::Get(base::DIR_MODULE, &pak_dir); | 83 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 80 pak_file = pak_dir.Append(FILE_PATH_LITERAL("components_resources.pak")); | 84 #endif // OS_ANDROID |
| 85 pak_file = |
| 86 pak_dir.Append(FILE_PATH_LITERAL("components_tests_resources.pak")); |
| 81 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( | 87 ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath( |
| 82 pak_file, ui::SCALE_FACTOR_NONE); | 88 pak_file, ui::SCALE_FACTOR_NONE); |
| 83 } | 89 } |
| 84 | 90 |
| 85 void SetUpTestServer() { | 91 void SetUpTestServer() { |
| 86 base::FilePath path; | 92 base::FilePath path; |
| 87 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 93 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 88 path = path.AppendASCII(kExternalTestResourcesPath); | 94 path = path.AppendASCII(kExternalTestResourcesPath); |
| 89 embedded_test_server()->ServeFilesFromDirectory(path); | 95 embedded_test_server()->ServeFilesFromDirectory(path); |
| 90 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 96 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Only print the log if there was an error. | 157 // Only print the log if there was an error. |
| 152 if (!success) { | 158 if (!success) { |
| 153 ASSERT_TRUE(dict->HasKey("log")); | 159 ASSERT_TRUE(dict->HasKey("log")); |
| 154 std::string console_log; | 160 std::string console_log; |
| 155 ASSERT_TRUE(dict->GetString("log", &console_log)); | 161 ASSERT_TRUE(dict->GetString("log", &console_log)); |
| 156 VLOG(0) << "Console log:\n" << console_log; | 162 VLOG(0) << "Console log:\n" << console_log; |
| 157 } | 163 } |
| 158 } | 164 } |
| 159 | 165 |
| 160 } // namespace dom_distiller | 166 } // namespace dom_distiller |
| OLD | NEW |