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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ui_test_utils::NavigateToURL(browser(), non_existent_extension); | 70 ui_test_utils::NavigateToURL(browser(), non_existent_extension); |
71 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 71 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
72 browser()->tab_strip_model()->GetActiveWebContents(), | 72 browser()->tab_strip_model()->GetActiveWebContents(), |
73 "window.domAutomationController.send(document.title)", | 73 "window.domAutomationController.send(document.title)", |
74 &result)); | 74 &result)); |
75 EXPECT_EQ(result, "Image failed to load"); | 75 EXPECT_EQ(result, "Image failed to load"); |
76 | 76 |
77 // A data URL. Data URLs should always be able to load chrome-extension:// | 77 // A data URL. Data URLs should always be able to load chrome-extension:// |
78 // resources. | 78 // resources. |
79 std::string file_source; | 79 std::string file_source; |
80 ASSERT_TRUE(base::ReadFileToString( | 80 { |
81 test_data_dir_.AppendASCII("extension_resource_request_policy") | 81 base::ThreadRestrictions::ScopedAllowIO allow_io; |
82 .AppendASCII("index.html"), &file_source)); | 82 ASSERT_TRUE(base::ReadFileToString( |
| 83 test_data_dir_.AppendASCII("extension_resource_request_policy") |
| 84 .AppendASCII("index.html"), |
| 85 &file_source)); |
| 86 } |
83 ui_test_utils::NavigateToURL(browser(), | 87 ui_test_utils::NavigateToURL(browser(), |
84 GURL(std::string("data:text/html;charset=utf-8,") + file_source)); | 88 GURL(std::string("data:text/html;charset=utf-8,") + file_source)); |
85 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 89 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
86 browser()->tab_strip_model()->GetActiveWebContents(), | 90 browser()->tab_strip_model()->GetActiveWebContents(), |
87 "window.domAutomationController.send(document.title)", | 91 "window.domAutomationController.send(document.title)", |
88 &result)); | 92 &result)); |
89 EXPECT_EQ(result, "Loaded"); | 93 EXPECT_EQ(result, "Loaded"); |
90 | 94 |
91 // A different extension. Legacy (manifest_version 1) extensions should always | 95 // A different extension. Legacy (manifest_version 1) extensions should always |
92 // be able to load each other's resources. | 96 // be able to load each other's resources. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 // The iframe should not load |private_page|, which is not web-accessible. | 350 // The iframe should not load |private_page|, which is not web-accessible. |
347 // | 351 // |
348 // TODO(alexmos): The failure mode differs on whether or not | 352 // TODO(alexmos): The failure mode differs on whether or not |
349 // --isolate-extensions is used: if it is on, the request is canceled and we | 353 // --isolate-extensions is used: if it is on, the request is canceled and we |
350 // stay on public.html (see https://crbug.com/656752), and if it's off, the | 354 // stay on public.html (see https://crbug.com/656752), and if it's off, the |
351 // request is blocked in ExtensionNavigationThrottle, which loads an error | 355 // request is blocked in ExtensionNavigationThrottle, which loads an error |
352 // page into the iframe. This check handles both cases, but we should make | 356 // page into the iframe. This check handles both cases, but we should make |
353 // the check stricter once --isolate-extensions is on by default. | 357 // the check stricter once --isolate-extensions is on by default. |
354 EXPECT_NE("Private", content); | 358 EXPECT_NE("Private", content); |
355 } | 359 } |
OLD | NEW |