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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug/leak_annotations.h" | 6 #include "base/debug/leak_annotations.h" |
7 #include "content/common/frame_messages.h" | 7 #include "content/common/frame_messages.h" |
8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
9 #include "content/public/test/frame_load_waiter.h" | 9 #include "content/public/test/frame_load_waiter.h" |
10 #include "content/public/test/render_view_test.h" | 10 #include "content/public/test/render_view_test.h" |
11 #include "content/public/test/test_utils.h" | 11 #include "content/public/test/test_utils.h" |
12 #include "content/renderer/render_frame_impl.h" | 12 #include "content/renderer/render_frame_impl.h" |
13 #include "content/renderer/render_view_impl.h" | 13 #include "content/renderer/render_view_impl.h" |
14 #include "content/test/fake_compositor_dependencies.h" | 14 #include "content/test/fake_compositor_dependencies.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 16 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
17 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 const int32 kSubframeRouteId = 20; | 20 const int32 kSubframeRouteId = 20; |
21 const int32 kSubframeWidgetRouteId = 21; | 21 const int32 kSubframeWidgetRouteId = 21; |
22 const int32 kFrameProxyRouteId = 22; | 22 const int32 kFrameProxyRouteId = 22; |
23 const int32 kSubframeSurfaceId = 43; | |
24 } // namespace | 23 } // namespace |
25 | 24 |
26 namespace content { | 25 namespace content { |
27 | 26 |
28 // RenderFrameImplTest creates a RenderFrameImpl that is a child of the | 27 // RenderFrameImplTest creates a RenderFrameImpl that is a child of the |
29 // main frame, and has its own RenderWidget. This behaves like an out | 28 // main frame, and has its own RenderWidget. This behaves like an out |
30 // of process frame even though it is in the same process as its parent. | 29 // of process frame even though it is in the same process as its parent. |
31 class RenderFrameImplTest : public RenderViewTest { | 30 class RenderFrameImplTest : public RenderViewTest { |
32 public: | 31 public: |
33 ~RenderFrameImplTest() override {} | 32 ~RenderFrameImplTest() override {} |
34 | 33 |
35 void SetUp() override { | 34 void SetUp() override { |
36 RenderViewTest::SetUp(); | 35 RenderViewTest::SetUp(); |
37 EXPECT_FALSE(static_cast<RenderFrameImpl*>(view_->GetMainRenderFrame()) | 36 EXPECT_FALSE(static_cast<RenderFrameImpl*>(view_->GetMainRenderFrame()) |
38 ->is_subframe_); | 37 ->is_subframe_); |
39 | 38 |
40 FrameMsg_NewFrame_WidgetParams widget_params; | 39 FrameMsg_NewFrame_WidgetParams widget_params; |
41 widget_params.routing_id = kSubframeWidgetRouteId; | 40 widget_params.routing_id = kSubframeWidgetRouteId; |
42 widget_params.surface_id = kSubframeSurfaceId; | |
43 widget_params.hidden = false; | 41 widget_params.hidden = false; |
44 | 42 |
45 IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess()); | 43 IsolateAllSitesForTesting(base::CommandLine::ForCurrentProcess()); |
46 | 44 |
47 LoadHTML("Parent frame <iframe name='frame'></iframe>"); | 45 LoadHTML("Parent frame <iframe name='frame'></iframe>"); |
48 | 46 |
49 RenderFrameImpl::FromWebFrame( | 47 RenderFrameImpl::FromWebFrame( |
50 view_->GetMainRenderFrame()->GetWebFrame()->firstChild()) | 48 view_->GetMainRenderFrame()->GetWebFrame()->firstChild()) |
51 ->OnSwapOut(kFrameProxyRouteId, false, FrameReplicationState()); | 49 ->OnSwapOut(kFrameProxyRouteId, false, FrameReplicationState()); |
52 | 50 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 RenderFrameTestObserver observer(frame()); | 148 RenderFrameTestObserver observer(frame()); |
151 | 149 |
152 ViewMsg_WasShown was_shown_message(0, true, ui::LatencyInfo()); | 150 ViewMsg_WasShown was_shown_message(0, true, ui::LatencyInfo()); |
153 frame_widget()->OnMessageReceived(was_shown_message); | 151 frame_widget()->OnMessageReceived(was_shown_message); |
154 | 152 |
155 EXPECT_FALSE(frame_widget()->is_hidden()); | 153 EXPECT_FALSE(frame_widget()->is_hidden()); |
156 EXPECT_TRUE(observer.visible()); | 154 EXPECT_TRUE(observer.visible()); |
157 } | 155 } |
158 | 156 |
159 } // namespace | 157 } // namespace |
OLD | NEW |