OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 #include "content/public/browser/render_frame_host.h" | 6 #include "content/public/browser/render_frame_host.h" |
7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
8 #include "content/public/test/browser_test_utils.h" | 8 #include "content/public/test/browser_test_utils.h" |
9 #include "content/public/test/content_browser_test.h" | 9 #include "content/public/test/content_browser_test.h" |
10 #include "content/public/test/content_browser_test_utils.h" | 10 #include "content/public/test/content_browser_test_utils.h" |
11 #include "content/public/test/test_utils.h" | 11 #include "content/public/test/test_utils.h" |
12 #include "content/shell/browser/shell.h" | 12 #include "content/shell/browser/shell.h" |
13 #include "content/test/content_browser_test_utils_internal.h" | 13 #include "content/test/content_browser_test_utils_internal.h" |
14 #include "content/test/test_content_browser_client.h" | 14 #include "content/test/test_content_browser_client.h" |
15 #include "net/dns/mock_host_resolver.h" | 15 #include "net/dns/mock_host_resolver.h" |
16 #include "net/test/embedded_test_server/embedded_test_server.h" | 16 #include "net/test/embedded_test_server/embedded_test_server.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class RenderWidgetHostViewChildFrameTest : public ContentBrowserTest { | 20 class RenderWidgetHostViewChildFrameTest : public ContentBrowserTest { |
21 public: | 21 public: |
22 RenderWidgetHostViewChildFrameTest() {} | 22 RenderWidgetHostViewChildFrameTest() {} |
23 | 23 |
24 void SetUpCommandLine(base::CommandLine* command_line) override { | 24 void SetUpCommandLine(base::CommandLine* command_line) override { |
25 IsolateAllSitesForTesting(command_line); | 25 IsolateAllSitesForTesting(command_line); |
26 } | 26 } |
27 | 27 |
28 void SetUpOnMainThread() override { | 28 void SetUpOnMainThread() override { |
29 host_resolver()->AddRule("*", "127.0.0.1"); | 29 host_resolver()->AddRule("*", "127.0.0.1"); |
30 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 30 ASSERT_TRUE(embedded_test_server()->Start()); |
31 SetupCrossSiteRedirector(embedded_test_server()); | 31 SetupCrossSiteRedirector(embedded_test_server()); |
32 } | 32 } |
33 | 33 |
34 void CheckScreenWidth(RenderFrameHost* render_frame_host) { | 34 void CheckScreenWidth(RenderFrameHost* render_frame_host) { |
35 int width; | 35 int width; |
36 ExecuteScriptAndGetValue(render_frame_host, "window.screen.width") | 36 ExecuteScriptAndGetValue(render_frame_host, "window.screen.width") |
37 ->GetAsInteger(&width); | 37 ->GetAsInteger(&width); |
38 EXPECT_EQ(expected_screen_width_, width); | 38 EXPECT_EQ(expected_screen_width_, width); |
39 } | 39 } |
40 | 40 |
(...skipping 24 matching lines...) Expand all Loading... |
65 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), | 65 ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), |
66 "window.screen.width")->GetAsInteger(&main_frame_screen_width); | 66 "window.screen.width")->GetAsInteger(&main_frame_screen_width); |
67 set_expected_screen_width(main_frame_screen_width); | 67 set_expected_screen_width(main_frame_screen_width); |
68 EXPECT_FALSE(main_frame_screen_width == 0); | 68 EXPECT_FALSE(main_frame_screen_width == 0); |
69 | 69 |
70 shell()->web_contents()->ForEachFrame( | 70 shell()->web_contents()->ForEachFrame( |
71 base::Bind(&RenderWidgetHostViewChildFrameTest::CheckScreenWidth, this)); | 71 base::Bind(&RenderWidgetHostViewChildFrameTest::CheckScreenWidth, this)); |
72 } | 72 } |
73 | 73 |
74 } // namespace content | 74 } // namespace content |
OLD | NEW |