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 "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 browser()->profile())->extension_service(); | 297 browser()->profile())->extension_service(); |
298 extensions::ProcessMap* process_map = | 298 extensions::ProcessMap* process_map = |
299 extensions::ProcessMap::Get(browser()->profile()); | 299 extensions::ProcessMap::Get(browser()->profile()); |
300 | 300 |
301 host_resolver()->AddRule("*", "127.0.0.1"); | 301 host_resolver()->AddRule("*", "127.0.0.1"); |
302 ASSERT_TRUE(embedded_test_server()->Start()); | 302 ASSERT_TRUE(embedded_test_server()->Start()); |
303 GURL base_url = GetTestBaseURL("app_process"); | 303 GURL base_url = GetTestBaseURL("app_process"); |
304 | 304 |
305 // Load an app as a bookmark app. | 305 // Load an app as a bookmark app. |
306 std::string error; | 306 std::string error; |
307 scoped_refptr<const Extension> extension(extensions::file_util::LoadExtension( | 307 scoped_refptr<const Extension> extension; |
308 test_data_dir_.AppendASCII("app_process"), | 308 { |
309 extensions::Manifest::UNPACKED, | 309 base::ThreadRestrictions::ScopedAllowIO allow_io; |
310 Extension::FROM_BOOKMARK, | 310 extension = extensions::file_util::LoadExtension( |
311 &error)); | 311 test_data_dir_.AppendASCII("app_process"), |
| 312 extensions::Manifest::UNPACKED, Extension::FROM_BOOKMARK, &error); |
| 313 } |
312 service->OnExtensionInstalled(extension.get(), | 314 service->OnExtensionInstalled(extension.get(), |
313 syncer::StringOrdinal::CreateInitialOrdinal(), | 315 syncer::StringOrdinal::CreateInitialOrdinal(), |
314 extensions::kInstallFlagInstallImmediately); | 316 extensions::kInstallFlagInstallImmediately); |
315 ASSERT_TRUE(extension.get()); | 317 ASSERT_TRUE(extension.get()); |
316 ASSERT_TRUE(extension->from_bookmark()); | 318 ASSERT_TRUE(extension->from_bookmark()); |
317 | 319 |
318 // Test both opening a URL in a new tab, and opening a tab and then navigating | 320 // Test both opening a URL in a new tab, and opening a tab and then navigating |
319 // it. Either way, bookmark app tabs should be considered normal processes | 321 // it. Either way, bookmark app tabs should be considered normal processes |
320 // with no elevated privileges and no WebUI bindings. | 322 // with no elevated privileges and no WebUI bindings. |
321 ui_test_utils::NavigateToURLWithDisposition( | 323 ui_test_utils::NavigateToURLWithDisposition( |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 // Navigate the popup to another process outside the app. | 858 // Navigate the popup to another process outside the app. |
857 GURL non_app_url(base_url.Resolve("path3/empty.html")); | 859 GURL non_app_url(base_url.Resolve("path3/empty.html")); |
858 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); | 860 ui_test_utils::NavigateToURL(active_browser_list->get(1), non_app_url); |
859 SiteInstance* new_instance = popup_contents->GetSiteInstance(); | 861 SiteInstance* new_instance = popup_contents->GetSiteInstance(); |
860 EXPECT_NE(app_instance, new_instance); | 862 EXPECT_NE(app_instance, new_instance); |
861 | 863 |
862 // It should still be in the same BrowsingInstance, allowing postMessage to | 864 // It should still be in the same BrowsingInstance, allowing postMessage to |
863 // work. | 865 // work. |
864 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); | 866 EXPECT_TRUE(app_instance->IsRelatedSiteInstance(new_instance)); |
865 } | 867 } |
OLD | NEW |