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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 &device_scale_factor)); | 619 &device_scale_factor)); |
620 return device_scale_factor; | 620 return device_scale_factor; |
621 } | 621 } |
622 | 622 |
623 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, | 623 IN_PROC_BROWSER_TEST_F(SitePerProcessHighDPIBrowserTest, |
624 SubframeLoadsWithCorrectDeviceScaleFactor) { | 624 SubframeLoadsWithCorrectDeviceScaleFactor) { |
625 GURL main_url(embedded_test_server()->GetURL( | 625 GURL main_url(embedded_test_server()->GetURL( |
626 "a.com", "/cross_site_iframe_factory.html?a(b)")); | 626 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
627 NavigateToURL(shell(), main_url); | 627 NavigateToURL(shell(), main_url); |
628 | 628 |
629 EXPECT_EQ(SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor, | 629 // On Android forcing device scale factor does not work for tests, therefore |
630 GetFrameDeviceScaleFactor(web_contents())); | 630 // we ensure that make frame and iframe have the same DIP scale there, but |
| 631 // not necessarily kDeviceScaleFactor. |
| 632 const double expected_dip_scale = |
| 633 #if defined(OS_ANDROID) |
| 634 GetFrameDeviceScaleFactor(web_contents()); |
| 635 #else |
| 636 SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor; |
| 637 #endif |
| 638 |
| 639 EXPECT_EQ(expected_dip_scale, GetFrameDeviceScaleFactor(web_contents())); |
631 | 640 |
632 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); | 641 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 642 ASSERT_EQ(1U, root->child_count()); |
| 643 |
633 FrameTreeNode* child = root->child_at(0); | 644 FrameTreeNode* child = root->child_at(0); |
634 EXPECT_EQ(SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor, | 645 EXPECT_EQ(expected_dip_scale, GetFrameDeviceScaleFactor(child)); |
635 GetFrameDeviceScaleFactor(child)); | |
636 } | 646 } |
637 | 647 |
638 // Ensure that navigating subframes in --site-per-process mode works and the | 648 // Ensure that navigating subframes in --site-per-process mode works and the |
639 // correct documents are committed. | 649 // correct documents are committed. |
640 #if defined(OS_WIN) | 650 #if defined(OS_WIN) |
641 // This test is flaky on Windows, see https://crbug.com/629419. | 651 // This test is flaky on Windows, see https://crbug.com/629419. |
642 #define MAYBE_CrossSiteIframe DISABLED_CrossSiteIframe | 652 #define MAYBE_CrossSiteIframe DISABLED_CrossSiteIframe |
643 #else | 653 #else |
644 #define MAYBE_CrossSiteIframe CrossSiteIframe | 654 #define MAYBE_CrossSiteIframe CrossSiteIframe |
645 #endif | 655 #endif |
(...skipping 7880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8526 EXPECT_TRUE(NavigateToURL(shell(), b_url)); | 8536 EXPECT_TRUE(NavigateToURL(shell(), b_url)); |
8527 | 8537 |
8528 base::string16 expected_title(base::UTF8ToUTF16("foo")); | 8538 base::string16 expected_title(base::UTF8ToUTF16("foo")); |
8529 TitleWatcher title_watcher(popup2->web_contents(), expected_title); | 8539 TitleWatcher title_watcher(popup2->web_contents(), expected_title); |
8530 EXPECT_TRUE(ExecuteScript( | 8540 EXPECT_TRUE(ExecuteScript( |
8531 shell(), "window.open('','popup2').postMessage('foo', '*');")); | 8541 shell(), "window.open('','popup2').postMessage('foo', '*');")); |
8532 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 8542 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
8533 } | 8543 } |
8534 | 8544 |
8535 } // namespace content | 8545 } // namespace content |
OLD | NEW |