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/web_ui_browser_test.h" | 5 #include "chrome/test/base/web_ui_browser_test.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 test_handler_->PreloadJavaScript(libraries[i], preload_host); | 452 test_handler_->PreloadJavaScript(libraries[i], preload_host); |
453 | 453 |
454 if (is_test) | 454 if (is_test) |
455 result = test_handler_->RunJavaScriptTestWithResult(content); | 455 result = test_handler_->RunJavaScriptTestWithResult(content); |
456 else if (preload_host) | 456 else if (preload_host) |
457 test_handler_->PreloadJavaScript(content, preload_host); | 457 test_handler_->PreloadJavaScript(content, preload_host); |
458 else | 458 else |
459 test_handler_->RunJavaScript(content); | 459 test_handler_->RunJavaScript(content); |
460 | 460 |
461 if (error_messages_.Get().size() > 0) { | 461 if (error_messages_.Get().size() > 0) { |
462 LOG(ERROR) << "Encountered javascript console error(s)"; | 462 LOG(ERROR) << "CONDITION FAILURE: encountered javascript console error(s):"; |
463 for (const auto& msg : error_messages_.Get()) { | |
464 LOG(ERROR) << "JS ERROR: '" << msg << "'"; | |
michaelpg
2016/07/29 22:38:29
Do you not normally see console errors when your t
| |
465 } | |
466 LOG(ERROR) << "JS call assumed failed, because JS console error(s) found."; | |
467 | |
463 result = false; | 468 result = false; |
464 error_messages_.Get().clear(); | 469 error_messages_.Get().clear(); |
465 } | 470 } |
466 return result; | 471 return result; |
467 } | 472 } |
468 | 473 |
469 void WebUIBrowserTest::SetupHandlers() { | 474 void WebUIBrowserTest::SetupHandlers() { |
470 content::WebUI* web_ui_instance = | 475 content::WebUI* web_ui_instance = |
471 override_selected_web_ui_ | 476 override_selected_web_ui_ |
472 ? override_selected_web_ui_ | 477 ? override_selected_web_ui_ |
(...skipping 10 matching lines...) Expand all Loading... | |
483 } | 488 } |
484 | 489 |
485 GURL WebUIBrowserTest::WebUITestDataPathToURL( | 490 GURL WebUIBrowserTest::WebUITestDataPathToURL( |
486 const base::FilePath::StringType& path) { | 491 const base::FilePath::StringType& path) { |
487 base::FilePath dir_test_data; | 492 base::FilePath dir_test_data; |
488 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); | 493 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); |
489 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); | 494 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); |
490 EXPECT_TRUE(base::PathExists(test_path)); | 495 EXPECT_TRUE(base::PathExists(test_path)); |
491 return net::FilePathToFileURL(test_path); | 496 return net::FilePathToFileURL(test_path); |
492 } | 497 } |
OLD | NEW |