diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-06 12:48:11 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:33:43 +0000 |
commit | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (patch) | |
tree | fa14ba0ca8d2683ba2efdabd246dc9b18a1229c6 /chromium/content/browser/navigation_mhtml_browsertest.cc | |
parent | 79b4f909db1049fca459c07cca55af56a9b54fe3 (diff) | |
download | qtwebengine-chromium-7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3.tar.gz |
BASELINE: Update Chromium to 84.0.4147.141
Change-Id: Ib85eb4cfa1cbe2b2b81e5022c8cad5c493969535
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/content/browser/navigation_mhtml_browsertest.cc')
-rw-r--r-- | chromium/content/browser/navigation_mhtml_browsertest.cc | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/chromium/content/browser/navigation_mhtml_browsertest.cc b/chromium/content/browser/navigation_mhtml_browsertest.cc index e5397cd6519..5259af03c98 100644 --- a/chromium/content/browser/navigation_mhtml_browsertest.cc +++ b/chromium/content/browser/navigation_mhtml_browsertest.cc @@ -11,6 +11,7 @@ #include "base/threading/thread_restrictions.h" #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h" @@ -85,7 +86,7 @@ class MhtmlArchive { base::ScopedAllowBlockingForTesting allow_blocking_; EXPECT_TRUE(file_directory_.CreateUniqueTempDir()); base::FilePath file_path = file_directory_.GetPath().AppendASCII(file); - EXPECT_NE(-1, base::WriteFile(file_path, document.data(), document.size())); + EXPECT_TRUE(base::WriteFile(file_path, document)); return net::FilePathToFileURL(file_path); } @@ -315,16 +316,14 @@ IN_PROC_BROWSER_TEST_F(NavigationMhtmlBrowserTest, "<iframe src=\"javascript:console.log('test')\"></iframe>"); GURL mhtml_url = mhtml_archive.Write("index.mhtml"); - auto console_delegate = std::make_unique<ConsoleObserverDelegate>( - web_contents(), - base::StringPrintf( - "Blocked script execution in '%s' because the document's frame " - "is sandboxed and the 'allow-scripts' permission is not set.", - mhtml_url.spec().c_str())); - web_contents()->SetDelegate(console_delegate.get()); + WebContentsConsoleObserver console_observer(web_contents()); + console_observer.SetPattern(base::StringPrintf( + "Blocked script execution in '%s' because the document's frame " + "is sandboxed and the 'allow-scripts' permission is not set.", + mhtml_url.spec().c_str())); EXPECT_TRUE(NavigateToURL(shell(), mhtml_url)); - console_delegate->Wait(); + console_observer.Wait(); RenderFrameHostImpl* main_document = main_frame_host(); ASSERT_EQ(1u, main_document->child_count()); @@ -343,16 +342,14 @@ IN_PROC_BROWSER_TEST_F(NavigationMhtmlBrowserTest, IframeJavascriptUrlFound) { "<iframe></iframe>"); GURL mhtml_url = mhtml_archive.Write("index.mhtml"); - auto console_delegate = std::make_unique<ConsoleObserverDelegate>( - web_contents(), - base::StringPrintf( - "Blocked script execution in '%s' because the document's frame " - "is sandboxed and the 'allow-scripts' permission is not set.", - mhtml_url.spec().c_str())); - web_contents()->SetDelegate(console_delegate.get()); + WebContentsConsoleObserver console_observer(web_contents()); + console_observer.SetPattern(base::StringPrintf( + "Blocked script execution in '%s' because the document's frame " + "is sandboxed and the 'allow-scripts' permission is not set.", + mhtml_url.spec().c_str())); EXPECT_TRUE(NavigateToURL(shell(), mhtml_url)); - console_delegate->Wait(); + console_observer.Wait(); RenderFrameHostImpl* main_document = main_frame_host(); ASSERT_EQ(1u, main_document->child_count()); |