Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2300463002: Add observers for DIP scale change. (Closed)
Patch Set: Attempt to fix unit test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
Tima Vaisburd 2016/10/25 01:51:43 Actually I'm not sure about this, maybe we need to
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 SitePerProcessHighDPIBrowserTest::kDeviceScaleFactor;
635 #else
636 GetFrameDeviceScaleFactor(web_contents());
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 7727 matching lines...) Expand 10 before | Expand all | Expand 10 after
8373 NavigationHandleWatcher watcher(shell()->web_contents()); 8383 NavigationHandleWatcher watcher(shell()->web_contents());
8374 TestNavigationObserver load_observer(shell()->web_contents()); 8384 TestNavigationObserver load_observer(shell()->web_contents());
8375 GURL frame_url = embedded_test_server()->GetURL("c.com", "/title1.html"); 8385 GURL frame_url = embedded_test_server()->GetURL("c.com", "/title1.html");
8376 EXPECT_TRUE(ExecuteScript( 8386 EXPECT_TRUE(ExecuteScript(
8377 shell()->web_contents(), 8387 shell()->web_contents(),
8378 "window.frames[0].location = \"" + frame_url.spec() + "\";")); 8388 "window.frames[0].location = \"" + frame_url.spec() + "\";"));
8379 load_observer.Wait(); 8389 load_observer.Wait();
8380 } 8390 }
8381 8391
8382 } // namespace content 8392 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698