Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1516)

Unified Diff: chrome/browser/extensions/window_open_apitest.cc

Issue 2830893002: Refactor of ExtensionNavigationThrottle (Closed)
Patch Set: One more comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/window_open_apitest.cc
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc
index 1b31d161937be5c301f345d7440ff79ebf3ec99e..fbae038f82baf487d12b3d221c5a8e469d8a5c90 100644
--- a/chrome/browser/extensions/window_open_apitest.cc
+++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -17,6 +17,7 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_frame_host.h"
@@ -240,7 +241,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenExtension) {
WebContents* newtab = NULL;
ASSERT_NO_FATAL_FAILURE(
OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(),
- start_url.Resolve("newtab.html"), true, &newtab));
+ start_url.Resolve("newtab.html"), true, &newtab));
bool result = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()",
@@ -251,17 +252,21 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenExtension) {
// Tests that if an extension page calls window.open to an invalid extension
// URL, the browser doesn't crash.
IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenInvalidExtension) {
ncarter (slow) 2017/05/01 21:50:37 Also incidental cleanup (this test had been failin
- ASSERT_TRUE(LoadExtension(
- test_data_dir_.AppendASCII("uitest").AppendASCII("window_open")));
+ const extensions::Extension* extension = LoadExtension(
+ test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"));
+ ASSERT_TRUE(extension);
- GURL start_url(std::string(extensions::kExtensionScheme) +
- url::kStandardSchemeSeparator +
- last_loaded_extension_id() + "/test.html");
+ GURL start_url = extension->GetResourceURL("/test.html");
ui_test_utils::NavigateToURL(browser(), start_url);
- ASSERT_NO_FATAL_FAILURE(
- OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(),
+ WebContents* newtab = nullptr;
+ ASSERT_NO_FATAL_FAILURE(OpenWindow(
+ browser()->tab_strip_model()->GetActiveWebContents(),
GURL("chrome-extension://thisissurelynotavalidextensionid/newtab.html"),
- false, NULL));
+ false, &newtab));
+
+ // This is expected to commit an error page.
+ ASSERT_EQ(content::PAGE_TYPE_ERROR,
+ newtab->GetController().GetLastCommittedEntry()->GetPageType());
// If we got to this point, we didn't crash, so we're good.
}

Powered by Google App Engine
This is Rietveld 408576698