| 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 "content/common/frame_messages.h" | 7 #include "content/common/frame_messages.h" |
| 7 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
| 8 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 9 #include "content/public/test/frame_load_waiter.h" | 10 #include "content/public/test/frame_load_waiter.h" |
| 10 #include "content/public/test/render_view_test.h" | 11 #include "content/public/test/render_view_test.h" |
| 11 #include "content/renderer/render_frame_impl.h" | 12 #include "content/renderer/render_frame_impl.h" |
| 12 #include "content/renderer/render_view_impl.h" | 13 #include "content/renderer/render_view_impl.h" |
| 13 #include "content/test/fake_compositor_dependencies.h" | 14 #include "content/test/fake_compositor_dependencies.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 16 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 55 |
| 55 RenderFrameImpl::CreateFrame(kSubframeRouteId, kFrameProxyRouteId, | 56 RenderFrameImpl::CreateFrame(kSubframeRouteId, kFrameProxyRouteId, |
| 56 MSG_ROUTING_NONE, MSG_ROUTING_NONE, | 57 MSG_ROUTING_NONE, MSG_ROUTING_NONE, |
| 57 FrameReplicationState(), | 58 FrameReplicationState(), |
| 58 compositor_deps_.get(), widget_params); | 59 compositor_deps_.get(), widget_params); |
| 59 | 60 |
| 60 frame_ = RenderFrameImpl::FromRoutingID(kSubframeRouteId); | 61 frame_ = RenderFrameImpl::FromRoutingID(kSubframeRouteId); |
| 61 EXPECT_TRUE(frame_->is_subframe_); | 62 EXPECT_TRUE(frame_->is_subframe_); |
| 62 } | 63 } |
| 63 | 64 |
| 65 void TearDown() override { |
| 66 #if defined(LEAK_SANITIZER) |
| 67 // Do this before shutting down V8 in RenderViewTest::TearDown(). |
| 68 // http://crbug.com/328552 |
| 69 __lsan_do_leak_check(); |
| 70 #endif |
| 71 RenderViewTest::TearDown(); |
| 72 } |
| 73 |
| 64 // Loads the given HTML into the frame as a data: URL and blocks until | 74 // Loads the given HTML into the frame as a data: URL and blocks until |
| 65 // the navigation is committed. | 75 // the navigation is committed. |
| 66 void LoadHTMLInFrame(const char* html) { | 76 void LoadHTMLInFrame(const char* html) { |
| 67 std::string url_str = "data:text/html;charset=utf-8,"; | 77 std::string url_str = "data:text/html;charset=utf-8,"; |
| 68 url_str.append(html); | 78 url_str.append(html); |
| 69 GURL url(url_str); | 79 GURL url(url_str); |
| 70 frame_->GetWebFrame()->loadRequest(blink::WebURLRequest(url)); | 80 frame_->GetWebFrame()->loadRequest(blink::WebURLRequest(url)); |
| 71 // The load actually happens asynchronously, so we pump messages to process | 81 // The load actually happens asynchronously, so we pump messages to process |
| 72 // the pending continuation. | 82 // the pending continuation. |
| 73 FrameLoadWaiter(frame_).Wait(); | 83 FrameLoadWaiter(frame_).Wait(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 151 |
| 142 scoped_ptr<IPC::Message> was_shown_message( | 152 scoped_ptr<IPC::Message> was_shown_message( |
| 143 new ViewMsg_WasShown(0, true, ui::LatencyInfo())); | 153 new ViewMsg_WasShown(0, true, ui::LatencyInfo())); |
| 144 FrameWidget()->OnMessageReceived(*was_shown_message); | 154 FrameWidget()->OnMessageReceived(*was_shown_message); |
| 145 | 155 |
| 146 EXPECT_FALSE(FrameWidget()->is_hidden()); | 156 EXPECT_FALSE(FrameWidget()->is_hidden()); |
| 147 EXPECT_TRUE(observer.visible()); | 157 EXPECT_TRUE(observer.visible()); |
| 148 } | 158 } |
| 149 | 159 |
| 150 } // namespace | 160 } // namespace |
| OLD | NEW |