OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/test/histogram_tester.h" | 9 #include "base/test/histogram_tester.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 ASSERT_TRUE(newtab); | 318 ASSERT_TRUE(newtab); |
319 | 319 |
320 EXPECT_NE(extension_url, newtab->GetMainFrame()->GetLastCommittedURL()); | 320 EXPECT_NE(extension_url, newtab->GetMainFrame()->GetLastCommittedURL()); |
321 EXPECT_FALSE(newtab->GetMainFrame()->GetSiteInstance()->GetSiteURL().SchemeIs( | 321 EXPECT_FALSE(newtab->GetMainFrame()->GetSiteInstance()->GetSiteURL().SchemeIs( |
322 extensions::kExtensionScheme)); | 322 extensions::kExtensionScheme)); |
323 | 323 |
324 // Verify that the blocking was recorded correctly in UMA. | 324 // Verify that the blocking was recorded correctly in UMA. |
325 uma.ExpectUniqueSample("Extensions.ShouldAllowOpenURL.Failure", | 325 uma.ExpectUniqueSample("Extensions.ShouldAllowOpenURL.Failure", |
326 2, /* FAILURE_SCHEME_NOT_HTTP_OR_HTTPS_OR_EXTENSION */ | 326 2, /* FAILURE_SCHEME_NOT_HTTP_OR_HTTPS_OR_EXTENSION */ |
327 1); | 327 1); |
| 328 uma.ExpectUniqueSample("Extensions.ShouldAllowOpenURL.Failure.Scheme", |
| 329 6 /* SCHEME_DATA */, 1); |
328 } | 330 } |
329 | 331 |
330 // Test that navigating to an extension URL is allowed on chrome:// and | 332 // Test that navigating to an extension URL is allowed on chrome:// and |
331 // chrome-search:// pages, even for URLs that are not web-accessible. | 333 // chrome-search:// pages, even for URLs that are not web-accessible. |
332 // See https://crbug.com/662602. | 334 // See https://crbug.com/662602. |
333 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, | 335 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, |
334 NavigateToInaccessibleResourceFromChromeURL) { | 336 NavigateToInaccessibleResourceFromChromeURL) { |
335 // Mint an extension URL which is not web-accessible. | 337 // Mint an extension URL which is not web-accessible. |
336 const extensions::Extension* extension = LoadExtension( | 338 const extensions::Extension* extension = LoadExtension( |
337 test_data_dir_.AppendASCII("uitest").AppendASCII("window_open")); | 339 test_data_dir_.AppendASCII("uitest").AppendASCII("window_open")); |
(...skipping 18 matching lines...) Expand all Loading... |
356 ASSERT_TRUE(content::ExecuteScript( | 358 ASSERT_TRUE(content::ExecuteScript( |
357 tab, "location.href = '" + extension_url.spec() + "';")); | 359 tab, "location.href = '" + extension_url.spec() + "';")); |
358 observer.Wait(); | 360 observer.Wait(); |
359 EXPECT_EQ(extension_url, tab->GetMainFrame()->GetLastCommittedURL()); | 361 EXPECT_EQ(extension_url, tab->GetMainFrame()->GetLastCommittedURL()); |
360 std::string result; | 362 std::string result; |
361 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 363 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
362 tab, "domAutomationController.send(document.body.innerText)", &result)); | 364 tab, "domAutomationController.send(document.body.innerText)", &result)); |
363 EXPECT_EQ("HOWDIE!!!", result); | 365 EXPECT_EQ("HOWDIE!!!", result); |
364 } | 366 } |
365 } | 367 } |
OLD | NEW |