OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 << "Theme color should be bright green."; | 720 << "Theme color should be bright green."; |
721 } | 721 } |
722 } | 722 } |
723 | 723 |
724 TEST_F(DocumentTest, ValidationMessageCleanup) { | 724 TEST_F(DocumentTest, ValidationMessageCleanup) { |
725 ValidationMessageClient* original_client = | 725 ValidationMessageClient* original_client = |
726 &GetPage().GetValidationMessageClient(); | 726 &GetPage().GetValidationMessageClient(); |
727 MockValidationMessageClient* mock_client = new MockValidationMessageClient(); | 727 MockValidationMessageClient* mock_client = new MockValidationMessageClient(); |
728 GetDocument().GetSettings()->SetScriptEnabled(true); | 728 GetDocument().GetSettings()->SetScriptEnabled(true); |
729 GetPage().SetValidationMessageClient(mock_client); | 729 GetPage().SetValidationMessageClient(mock_client); |
730 // implicitOpen()-implicitClose() makes Document.loadEventFinished() | 730 // ImplicitOpen()-CancelParsing() makes Document.loadEventFinished() |
731 // true. It's necessary to kick unload process. | 731 // true. It's necessary to kick unload process. |
732 GetDocument().ImplicitOpen(kForceSynchronousParsing); | 732 GetDocument().ImplicitOpen(kForceSynchronousParsing); |
733 GetDocument().ImplicitClose(); | 733 GetDocument().CancelParsing(); |
734 GetDocument().AppendChild(GetDocument().createElement("html")); | 734 GetDocument().AppendChild(GetDocument().createElement("html")); |
735 SetHtmlInnerHTML("<body><input required></body>"); | 735 SetHtmlInnerHTML("<body><input required></body>"); |
736 Element* script = GetDocument().createElement("script"); | 736 Element* script = GetDocument().createElement("script"); |
737 script->setTextContent( | 737 script->setTextContent( |
738 "window.onunload = function() {" | 738 "window.onunload = function() {" |
739 "document.querySelector('input').reportValidity(); };"); | 739 "document.querySelector('input').reportValidity(); };"); |
740 GetDocument().body()->AppendChild(script); | 740 GetDocument().body()->AppendChild(script); |
741 HTMLInputElement* input = | 741 HTMLInputElement* input = |
742 toHTMLInputElement(GetDocument().body()->firstChild()); | 742 toHTMLInputElement(GetDocument().body()->firstChild()); |
743 DVLOG(0) << GetDocument().body()->outerHTML(); | 743 DVLOG(0) << GetDocument().body()->outerHTML(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 appcache_host->host_ = WTF::MakeUnique<MockWebApplicationCacheHost>(); | 791 appcache_host->host_ = WTF::MakeUnique<MockWebApplicationCacheHost>(); |
792 appcache_host->SelectCacheWithManifest( | 792 appcache_host->SelectCacheWithManifest( |
793 KURL(KURL(), "https://test.com/foobar/manifest")); | 793 KURL(KURL(), "https://test.com/foobar/manifest")); |
794 MockWebApplicationCacheHost* mock_web_host = | 794 MockWebApplicationCacheHost* mock_web_host = |
795 static_cast<MockWebApplicationCacheHost*>(appcache_host->host_.get()); | 795 static_cast<MockWebApplicationCacheHost*>(appcache_host->host_.get()); |
796 EXPECT_FALSE(mock_web_host->with_manifest_was_called_); | 796 EXPECT_FALSE(mock_web_host->with_manifest_was_called_); |
797 EXPECT_TRUE(mock_web_host->without_manifest_was_called_); | 797 EXPECT_TRUE(mock_web_host->without_manifest_was_called_); |
798 } | 798 } |
799 | 799 |
800 } // namespace blink | 800 } // namespace blink |
OLD | NEW |