Index: chrome/browser/extensions/extension_resource_request_policy_apitest.cc |
diff --git a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc |
index d3c3fcb9c66bb3551dba1901c2a0ea2eaf4b4b86..29da55095815f4ba3dd35a07d24d572ecc68ea49 100644 |
--- a/chrome/browser/extensions/extension_resource_request_policy_apitest.cc |
+++ b/chrome/browser/extensions/extension_resource_request_policy_apitest.cc |
@@ -337,39 +337,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, |
ASSERT_TRUE(RunExtensionSubtest("accessible_cer", "main.html")) << message_; |
} |
-class NavigationErrorObserver : public content::WebContentsObserver { |
- public: |
- NavigationErrorObserver(content::WebContents* web_contents, const GURL& url) |
- : content::WebContentsObserver(web_contents), |
- url_(url), |
- saw_navigation_(false) {} |
- |
- void DidFinishNavigation(content::NavigationHandle* handle) override { |
- if (handle->GetURL() != url_) |
- return; |
- EXPECT_TRUE(handle->IsErrorPage()); |
- saw_navigation_ = true; |
- if (run_loop_.running()) |
- run_loop_.Quit(); |
- } |
- |
- void Wait() { |
- if (!saw_navigation_) |
- run_loop_.Run(); |
- } |
- |
- private: |
- // The url we want to see a navigation for. |
- GURL url_; |
- |
- // Have we seen the navigation for |url_| yet? |
- bool saw_navigation_; |
- |
- base::RunLoop run_loop_; |
- |
- DISALLOW_COPY_AND_ASSIGN(NavigationErrorObserver); |
-}; |
- |
IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, |
IframeNavigateToInaccessible) { |
ASSERT_TRUE(embedded_test_server()->Start()); |
@@ -388,7 +355,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionResourceRequestPolicyTest, |
GURL private_page( |
"chrome-extension://kegmjfcnjamahdnldjmlpachmpielcdk/private.html"); |
- NavigationErrorObserver observer(web_contents, private_page); |
ASSERT_TRUE(content::ExecuteScript(web_contents, "navigateFrameNow()")); |
- observer.Wait(); |
+ WaitForLoadStop(web_contents); |
+ EXPECT_NE(private_page, web_contents->GetLastCommittedURL()); |
+ std::string content; |
+ EXPECT_TRUE(ExecuteScriptAndExtractString( |
+ ChildFrameAt(web_contents->GetMainFrame(), 0), |
+ "domAutomationController.send(document.body.innerText)", &content)); |
+ EXPECT_NE("Private", content); |
Devlin
2016/11/02 16:19:22
It looks like the previous version of this checked
alexmos
2016/11/02 17:32:46
I removed the error page expectation because there
Devlin
2016/11/02 20:50:57
Two thoughts:
- Is there any way we can test that
alexmos
2016/11/03 00:43:26
Unfortunately, this is tricky. The result depends
Devlin
2016/11/03 00:57:09
Okay, this is fine for now, thanks for the TODO.
|
} |