| 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) {
|
| - 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.
|
| }
|
|
|