| 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/location.h" | 6 #include "base/location.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.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/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 private: | 43 private: |
| 44 base::Closure callback_; | 44 base::Closure callback_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 namespace dom_distiller { | 49 namespace dom_distiller { |
| 50 | 50 |
| 51 const char* kExternalTestResourcesPath = | 51 const char* kExternalTestResourcesPath = |
| 52 "third_party/dom_distiller_js/dist/test/data"; | 52 "third_party/dom_distiller_js/dist/test/data"; |
| 53 const char* kTestFilePath = "/war/test.html?console_log=0"; | 53 const char* kTestFilePath = "/war/test.html?console_log=0&filter=*.*"; |
| 54 const char* kRunJsTestsJs = | 54 const char* kRunJsTestsJs = |
| 55 "(function() {return org.chromium.distiller.JsTestEntry.run();})();"; | 55 "(function() {return org.chromium.distiller.JsTestEntry.run();})();"; |
| 56 | 56 |
| 57 class DomDistillerJsTest : public content::ContentBrowserTest { | 57 class DomDistillerJsTest : public content::ContentBrowserTest { |
| 58 public: | 58 public: |
| 59 DomDistillerJsTest() : result_(NULL) {} | 59 DomDistillerJsTest() : result_(NULL) {} |
| 60 | 60 |
| 61 // content::ContentBrowserTest: | 61 // content::ContentBrowserTest: |
| 62 void SetUpOnMainThread() override { | 62 void SetUpOnMainThread() override { |
| 63 AddComponentsResources(); | 63 AddComponentsResources(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 << " skipped = " << skipped; | 155 << " skipped = " << skipped; |
| 156 // Ensure that running the tests succeeded. | 156 // Ensure that running the tests succeeded. |
| 157 EXPECT_TRUE(success); | 157 EXPECT_TRUE(success); |
| 158 | 158 |
| 159 // Only print the log if there was an error. | 159 // Only print the log if there was an error. |
| 160 if (!success) { | 160 if (!success) { |
| 161 ASSERT_TRUE(dict->HasKey("log")); | 161 ASSERT_TRUE(dict->HasKey("log")); |
| 162 std::string console_log; | 162 std::string console_log; |
| 163 ASSERT_TRUE(dict->GetString("log", &console_log)); | 163 ASSERT_TRUE(dict->GetString("log", &console_log)); |
| 164 VLOG(0) << "Console log:\n" << console_log; | 164 VLOG(0) << "Console log:\n" << console_log; |
| 165 VLOG(0) << "\n\n" |
| 166 "More info at third_party/dom_distiller_js/README.chromium.\n" |
| 167 "To disable tests, modify the filter parameter in |kTestFilePath|,\n" |
| 168 "in gtest_filter syntax.\n\n"; |
| 165 } | 169 } |
| 166 } | 170 } |
| 167 | 171 |
| 168 } // namespace dom_distiller | 172 } // namespace dom_distiller |
| OLD | NEW |