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 "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 10 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/test/base/test_switches.h" | 18 #include "chrome/test/base/test_switches.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/site_instance.h" | 24 #include "content/public/browser/site_instance.h" |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "content/public/test/browser_test_utils.h" | 26 #include "content/public/test/browser_test_utils.h" |
27 #include "content/public/test/test_navigation_observer.h" | 27 #include "content/public/test/test_navigation_observer.h" |
28 #include "extensions/browser/extension_host.h" | 28 #include "extensions/browser/extension_host.h" |
29 #include "extensions/browser/extension_system.h" | 29 #include "extensions/browser/extension_system.h" |
| 30 #include "extensions/browser/install_flag.h" |
30 #include "extensions/browser/process_map.h" | 31 #include "extensions/browser/process_map.h" |
31 #include "extensions/common/extension.h" | 32 #include "extensions/common/extension.h" |
32 #include "extensions/common/file_util.h" | 33 #include "extensions/common/file_util.h" |
33 #include "extensions/common/switches.h" | 34 #include "extensions/common/switches.h" |
34 #include "net/dns/mock_host_resolver.h" | 35 #include "net/dns/mock_host_resolver.h" |
35 #include "net/test/embedded_test_server/embedded_test_server.h" | 36 #include "net/test/embedded_test_server/embedded_test_server.h" |
36 #include "sync/api/string_ordinal.h" | 37 #include "sync/api/string_ordinal.h" |
37 | 38 |
38 using content::NavigationController; | 39 using content::NavigationController; |
39 using content::RenderViewHost; | 40 using content::RenderViewHost; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 304 |
304 // Load an app as a bookmark app. | 305 // Load an app as a bookmark app. |
305 std::string error; | 306 std::string error; |
306 scoped_refptr<const Extension> extension(extensions::file_util::LoadExtension( | 307 scoped_refptr<const Extension> extension(extensions::file_util::LoadExtension( |
307 test_data_dir_.AppendASCII("app_process"), | 308 test_data_dir_.AppendASCII("app_process"), |
308 extensions::Manifest::UNPACKED, | 309 extensions::Manifest::UNPACKED, |
309 Extension::FROM_BOOKMARK, | 310 Extension::FROM_BOOKMARK, |
310 &error)); | 311 &error)); |
311 service->OnExtensionInstalled(extension.get(), | 312 service->OnExtensionInstalled(extension.get(), |
312 syncer::StringOrdinal::CreateInitialOrdinal(), | 313 syncer::StringOrdinal::CreateInitialOrdinal(), |
313 false /* no requirement errors */, | 314 extensions::kInstallFlagInstallImmediately); |
314 extensions::NOT_BLACKLISTED, | |
315 false /* not ephemeral */, | |
316 false /* don't wait for idle */); | |
317 ASSERT_TRUE(extension.get()); | 315 ASSERT_TRUE(extension.get()); |
318 ASSERT_TRUE(extension->from_bookmark()); | 316 ASSERT_TRUE(extension->from_bookmark()); |
319 | 317 |
320 // Test both opening a URL in a new tab, and opening a tab and then navigating | 318 // Test both opening a URL in a new tab, and opening a tab and then navigating |
321 // it. Either way, bookmark app tabs should be considered normal processes | 319 // it. Either way, bookmark app tabs should be considered normal processes |
322 // with no elevated privileges and no WebUI bindings. | 320 // with no elevated privileges and no WebUI bindings. |
323 ui_test_utils::NavigateToURLWithDisposition( | 321 ui_test_utils::NavigateToURLWithDisposition( |
324 browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB, | 322 browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB, |
325 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 323 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
326 EXPECT_FALSE(process_map->Contains( | 324 EXPECT_FALSE(process_map->Contains( |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 // Navigate the popup to another process outside the app. | 871 // Navigate the popup to another process outside the app. |
874 GURL non_app_url(base_url.Resolve("path3/empty.html")); | 872 GURL non_app_url(base_url.Resolve("path3/empty.html")); |
875 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); | 873 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); |
876 SiteInstance* new_instance = popup_contents->GetSiteInstance(); | 874 SiteInstance* new_instance = popup_contents->GetSiteInstance(); |
877 EXPECT_NE(app_instance, new_instance); | 875 EXPECT_NE(app_instance, new_instance); |
878 | 876 |
879 // It should still be in the same BrowsingInstance, allowing postMessage to | 877 // It should still be in the same BrowsingInstance, allowing postMessage to |
880 // work. | 878 // work. |
881 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); | 879 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); |
882 } | 880 } |
OLD | NEW |