Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/test/histogram_tester.h" | 14 #include "base/test/histogram_tester.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/extensions/browser_action_test_util.h" | 16 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 17 #include "chrome/browser/extensions/extension_browsertest.h" | 17 #include "chrome/browser/extensions/extension_browsertest.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/extensions/test_extension_dir.h" | 19 #include "chrome/browser/extensions/test_extension_dir.h" |
| 20 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
| 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 23 #include "chrome/common/extensions/extension_process_policy.h" | 23 #include "chrome/common/extensions/extension_process_policy.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/test/base/in_process_browser_test.h" | 25 #include "chrome/test/base/in_process_browser_test.h" |
| 26 #include "chrome/test/base/ui_test_utils.h" | 26 #include "chrome/test/base/ui_test_utils.h" |
| 27 #include "components/guest_view/browser/test_guest_view_manager.h" | 27 #include "components/guest_view/browser/test_guest_view_manager.h" |
| 28 #include "content/public/browser/child_process_security_policy.h" | 28 #include "content/public/browser/child_process_security_policy.h" |
| 29 #include "content/public/browser/navigation_entry.h" | |
| 29 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/browser/render_frame_host.h" | 31 #include "content/public/browser/render_frame_host.h" |
| 31 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
| 32 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 33 #include "content/public/common/browser_side_navigation_policy.h" | 34 #include "content/public/common/browser_side_navigation_policy.h" |
| 34 #include "content/public/test/browser_test_utils.h" | 35 #include "content/public/test/browser_test_utils.h" |
| 35 #include "content/public/test/test_navigation_observer.h" | 36 #include "content/public/test/test_navigation_observer.h" |
| 36 #include "content/public/test/test_utils.h" | 37 #include "content/public/test/test_utils.h" |
| 37 #include "extensions/browser/app_window/app_window.h" | 38 #include "extensions/browser/app_window/app_window.h" |
| 38 #include "extensions/browser/app_window/app_window_registry.h" | 39 #include "extensions/browser/app_window/app_window_registry.h" |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1226 // frame's (a.com) process. | 1227 // frame's (a.com) process. |
| 1227 GURL b_url(embedded_test_server()->GetURL("b.com", "/empty.html")); | 1228 GURL b_url(embedded_test_server()->GetURL("b.com", "/empty.html")); |
| 1228 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame0", b_url)); | 1229 EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame0", b_url)); |
| 1229 { | 1230 { |
| 1230 content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0); | 1231 content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0); |
| 1231 EXPECT_EQ(subframe->GetProcess(), main_frame->GetProcess()); | 1232 EXPECT_EQ(subframe->GetProcess(), main_frame->GetProcess()); |
| 1232 EXPECT_EQ(subframe->GetSiteInstance(), main_frame->GetSiteInstance()); | 1233 EXPECT_EQ(subframe->GetSiteInstance(), main_frame->GetSiteInstance()); |
| 1233 } | 1234 } |
| 1234 } | 1235 } |
| 1235 | 1236 |
| 1237 // Test to verify that loading a resource other than an icon file is | |
| 1238 // disallowed for hosted apps. See https://crbug.com/717626. | |
| 1239 IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, HostedAppManifest) { | |
| 1240 // Load an extension with a background page. | |
| 1241 scoped_refptr<const Extension> extension = | |
| 1242 LoadExtension(test_data_dir_.AppendASCII("hosted_app")); | |
| 1243 ASSERT_TRUE(extension); | |
| 1244 | |
| 1245 content::WebContents* tab = | |
| 1246 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 1247 content::TestNavigationObserver observer(tab); | |
| 1248 NavigateToURL(extension->GetResourceURL("/manifest.json")); | |
| 1249 EXPECT_TRUE(!observer.last_navigation_succeeded()); | |
| 1250 EXPECT_EQ(tab->GetController().GetLastCommittedEntry()->GetPageType(), | |
| 1251 content::PAGE_TYPE_ERROR); | |
|
Devlin
2017/05/24 17:27:19
Can we expand this to include a check for icons th
Devlin
2017/05/24 17:39:17
Missed this one?
nasko
2017/05/24 18:46:37
Oops, sorry, indeed I missed this one. Added.
| |
| 1252 } | |
| 1253 | |
| 1236 } // namespace extensions | 1254 } // namespace extensions |
| OLD | NEW |