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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/process_map.h" | 9 #include "chrome/browser/extensions/process_map.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 base_url.Resolve("path1/empty.html"), true); | 156 base_url.Resolve("path1/empty.html"), true); |
157 LOG(INFO) << "WindowOpenHelper 1."; | 157 LOG(INFO) << "WindowOpenHelper 1."; |
158 WindowOpenHelper(browser(), host2, | 158 WindowOpenHelper(browser(), host2, |
159 base_url.Resolve("path2/empty.html"), true); | 159 base_url.Resolve("path2/empty.html"), true); |
160 LOG(INFO) << "End of test."; | 160 LOG(INFO) << "End of test."; |
161 } | 161 } |
162 }; | 162 }; |
163 | 163 |
164 // Tests that hosted apps with the background permission get a process-per-app | 164 // Tests that hosted apps with the background permission get a process-per-app |
165 // model, since all pages need to be able to script the background page. | 165 // model, since all pages need to be able to script the background page. |
166 IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { | 166 #if defined(OS_WIN) |
| 167 #define MAYBE_AppProcess FLAKY_AppProcess |
| 168 #else |
| 169 #define MAYBE_AppProcess AppProcess |
| 170 #endif |
| 171 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcess) { |
167 LOG(INFO) << "Start of test."; | 172 LOG(INFO) << "Start of test."; |
168 | 173 |
169 extensions::ProcessMap* process_map = | 174 extensions::ProcessMap* process_map = |
170 browser()->profile()->GetExtensionService()->process_map(); | 175 browser()->profile()->GetExtensionService()->process_map(); |
171 | 176 |
172 host_resolver()->AddRule("*", "127.0.0.1"); | 177 host_resolver()->AddRule("*", "127.0.0.1"); |
173 ASSERT_TRUE(test_server()->Start()); | 178 ASSERT_TRUE(test_server()->Start()); |
174 | 179 |
175 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); | 180 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
176 | 181 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 browser()->GetWebContentsAt(6)->GetRenderViewHost(), L"", | 270 browser()->GetWebContentsAt(6)->GetRenderViewHost(), L"", |
266 L"window.domAutomationController.send(window.opener != null)", | 271 L"window.domAutomationController.send(window.opener != null)", |
267 &windowOpenerValid)); | 272 &windowOpenerValid)); |
268 ASSERT_TRUE(windowOpenerValid); | 273 ASSERT_TRUE(windowOpenerValid); |
269 | 274 |
270 LOG(INFO) << "End of test."; | 275 LOG(INFO) << "End of test."; |
271 } | 276 } |
272 | 277 |
273 // Test that hosted apps without the background permission use a process per app | 278 // Test that hosted apps without the background permission use a process per app |
274 // instance model, such that separate instances are in separate processes. | 279 // instance model, such that separate instances are in separate processes. |
275 IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessInstances) { | 280 #if defined(OS_WIN) |
| 281 #define MAYBE_AppProcessInstances FLAKY_AppProcessInstances |
| 282 #else |
| 283 #define MAYBE_AppProcessInstances AppProcessInstances |
| 284 #endif |
| 285 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcessInstances) { |
276 TestAppInstancesHelper("app_process_instances"); | 286 TestAppInstancesHelper("app_process_instances"); |
277 } | 287 } |
278 | 288 |
279 // Test that hosted apps with the background permission but that set | 289 // Test that hosted apps with the background permission but that set |
280 // allow_js_access to false also use a process per app instance model. | 290 // allow_js_access to false also use a process per app instance model. |
281 // Separate instances should be in separate processes. | 291 // Separate instances should be in separate processes. |
282 IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessBackgroundInstances) { | 292 #if defined(OS_WIN) |
| 293 #define MAYBE_AppProcessBackgroundInstances FLAKY_AppProcessBackgroundInstances |
| 294 #else |
| 295 #define MAYBE_AppProcessBackgroundInstances AppProcessBackgroundInstances |
| 296 #endif |
| 297 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcessBackgroundInstances) { |
283 TestAppInstancesHelper("app_process_background_instances"); | 298 TestAppInstancesHelper("app_process_background_instances"); |
284 } | 299 } |
285 | 300 |
286 // Tests that bookmark apps do not use the app process model and are treated | 301 // Tests that bookmark apps do not use the app process model and are treated |
287 // like normal web pages instead. http://crbug.com/104636. | 302 // like normal web pages instead. http://crbug.com/104636. |
288 IN_PROC_BROWSER_TEST_F(AppApiTest, BookmarkAppGetsNormalProcess) { | 303 #if defined(OS_WIN) |
| 304 #define MAYBE_BookmarkAppGetsNormalProcess FLAKY_BookmarkAppGetsNormalProcess |
| 305 #else |
| 306 #define MAYBE_BookmarkAppGetsNormalProcess BookmarkAppGetsNormalProcess |
| 307 #endif |
| 308 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_BookmarkAppGetsNormalProcess) { |
289 ExtensionService* service = browser()->profile()->GetExtensionService(); | 309 ExtensionService* service = browser()->profile()->GetExtensionService(); |
290 extensions::ProcessMap* process_map = service->process_map(); | 310 extensions::ProcessMap* process_map = service->process_map(); |
291 | 311 |
292 host_resolver()->AddRule("*", "127.0.0.1"); | 312 host_resolver()->AddRule("*", "127.0.0.1"); |
293 ASSERT_TRUE(test_server()->Start()); | 313 ASSERT_TRUE(test_server()->Start()); |
294 GURL base_url = GetTestBaseURL("app_process"); | 314 GURL base_url = GetTestBaseURL("app_process"); |
295 | 315 |
296 // Load an app as a bookmark app. | 316 // Load an app as a bookmark app. |
297 std::string error; | 317 std::string error; |
298 scoped_refptr<const Extension> extension(extension_file_util::LoadExtension( | 318 scoped_refptr<const Extension> extension(extension_file_util::LoadExtension( |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 js_reload_observer2.Wait(); | 512 js_reload_observer2.Wait(); |
493 EXPECT_FALSE(process_map->Contains( | 513 EXPECT_FALSE(process_map->Contains( |
494 contents->GetRenderProcessHost()->GetID())); | 514 contents->GetRenderProcessHost()->GetID())); |
495 } | 515 } |
496 | 516 |
497 // Tests that if we have a non-app process (path3/container.html) that has an | 517 // Tests that if we have a non-app process (path3/container.html) that has an |
498 // iframe with a URL in the app's extent (path1/iframe.html), then opening a | 518 // iframe with a URL in the app's extent (path1/iframe.html), then opening a |
499 // link from that iframe to a new window to a URL in the app's extent (path1/ | 519 // link from that iframe to a new window to a URL in the app's extent (path1/ |
500 // empty.html) results in the new window being in an app process. See | 520 // empty.html) results in the new window being in an app process. See |
501 // http://crbug.com/89272 for more details. | 521 // http://crbug.com/89272 for more details. |
502 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { | 522 #if defined(OS_WIN) |
| 523 #define MAYBE_OpenAppFromIframe FLAKY_OpenAppFromIframe |
| 524 #else |
| 525 #define MAYBE_OpenAppFromIframe OpenAppFromIframe |
| 526 #endif |
| 527 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_OpenAppFromIframe) { |
503 extensions::ProcessMap* process_map = | 528 extensions::ProcessMap* process_map = |
504 browser()->profile()->GetExtensionService()->process_map(); | 529 browser()->profile()->GetExtensionService()->process_map(); |
505 | 530 |
506 host_resolver()->AddRule("*", "127.0.0.1"); | 531 host_resolver()->AddRule("*", "127.0.0.1"); |
507 ASSERT_TRUE(test_server()->Start()); | 532 ASSERT_TRUE(test_server()->Start()); |
508 | 533 |
509 GURL base_url = GetTestBaseURL("app_process"); | 534 GURL base_url = GetTestBaseURL("app_process"); |
510 | 535 |
511 // Load app and start URL (not in the app). | 536 // Load app and start URL (not in the app). |
512 const Extension* app = | 537 const Extension* app = |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 ASSERT_TRUE(is_installed); | 612 ASSERT_TRUE(is_installed); |
588 } | 613 } |
589 | 614 |
590 // Tests that if we have an app process (path1/container.html) with a non-app | 615 // Tests that if we have an app process (path1/container.html) with a non-app |
591 // iframe (path3/iframe.html), then opening a link from that iframe to a new | 616 // iframe (path3/iframe.html), then opening a link from that iframe to a new |
592 // window to a same-origin non-app URL (path3/empty.html) should keep the window | 617 // window to a same-origin non-app URL (path3/empty.html) should keep the window |
593 // in the app process. | 618 // in the app process. |
594 // This is in contrast to OpenAppFromIframe, since here the popup will not be | 619 // This is in contrast to OpenAppFromIframe, since here the popup will not be |
595 // missing special permissions and should be scriptable from the iframe. | 620 // missing special permissions and should be scriptable from the iframe. |
596 // See http://crbug.com/92669 for more details. | 621 // See http://crbug.com/92669 for more details. |
597 IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { | 622 #if defined(OS_WIN) |
| 623 #define MAYBE_OpenWebPopupFromWebIframe FLAKY_OpenWebPopupFromWebIframe |
| 624 #else |
| 625 #define MAYBE_OpenWebPopupFromWebIframe OpenWebPopupFromWebIframe |
| 626 #endif |
| 627 IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_OpenWebPopupFromWebIframe) { |
598 extensions::ProcessMap* process_map = | 628 extensions::ProcessMap* process_map = |
599 browser()->profile()->GetExtensionService()->process_map(); | 629 browser()->profile()->GetExtensionService()->process_map(); |
600 | 630 |
601 host_resolver()->AddRule("*", "127.0.0.1"); | 631 host_resolver()->AddRule("*", "127.0.0.1"); |
602 ASSERT_TRUE(test_server()->Start()); | 632 ASSERT_TRUE(test_server()->Start()); |
603 | 633 |
604 GURL base_url = GetTestBaseURL("app_process"); | 634 GURL base_url = GetTestBaseURL("app_process"); |
605 | 635 |
606 // Load app and start URL (in the app). | 636 // Load app and start URL (in the app). |
607 const Extension* app = | 637 const Extension* app = |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 710 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
681 GetController())); | 711 GetController())); |
682 browser()->Reload(CURRENT_TAB); | 712 browser()->Reload(CURRENT_TAB); |
683 observer.Wait(); | 713 observer.Wait(); |
684 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 714 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
685 contents->GetRenderViewHost(), L"", | 715 contents->GetRenderViewHost(), L"", |
686 L"window.domAutomationController.send(chrome.app.isInstalled)", | 716 L"window.domAutomationController.send(chrome.app.isInstalled)", |
687 &is_installed)); | 717 &is_installed)); |
688 ASSERT_TRUE(is_installed); | 718 ASSERT_TRUE(is_installed); |
689 } | 719 } |
OLD | NEW |