| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "content/test/test_render_frame.h" | 52 #include "content/test/test_render_frame.h" |
| 53 #include "net/base/net_errors.h" | 53 #include "net/base/net_errors.h" |
| 54 #include "net/cert/cert_status_flags.h" | 54 #include "net/cert/cert_status_flags.h" |
| 55 #include "testing/gtest/include/gtest/gtest.h" | 55 #include "testing/gtest/include/gtest/gtest.h" |
| 56 #include "third_party/WebKit/public/platform/WebData.h" | 56 #include "third_party/WebKit/public/platform/WebData.h" |
| 57 #include "third_party/WebKit/public/platform/WebHTTPBody.h" | 57 #include "third_party/WebKit/public/platform/WebHTTPBody.h" |
| 58 #include "third_party/WebKit/public/platform/WebString.h" | 58 #include "third_party/WebKit/public/platform/WebString.h" |
| 59 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 59 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 60 #include "third_party/WebKit/public/web/WebDataSource.h" | 60 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 61 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" | 61 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" |
| 62 #include "third_party/WebKit/public/web/WebHeap.h" |
| 62 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 63 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
| 63 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 64 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 64 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 65 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 65 #include "third_party/WebKit/public/web/WebPerformance.h" | 66 #include "third_party/WebKit/public/web/WebPerformance.h" |
| 66 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 67 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 67 #include "third_party/WebKit/public/web/WebSettings.h" | 68 #include "third_party/WebKit/public/web/WebSettings.h" |
| 68 #include "third_party/WebKit/public/web/WebView.h" | 69 #include "third_party/WebKit/public/web/WebView.h" |
| 69 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 70 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
| 70 #include "ui/events/event.h" | 71 #include "ui/events/event.h" |
| 71 #include "ui/events/keycodes/keyboard_codes.h" | 72 #include "ui/events/keycodes/keyboard_codes.h" |
| 72 #include "ui/gfx/codec/jpeg_codec.h" | 73 #include "ui/gfx/codec/jpeg_codec.h" |
| 73 #include "ui/gfx/range/range.h" | 74 #include "ui/gfx/range/range.h" |
| 74 | 75 |
| 75 #if defined(USE_AURA) && defined(USE_X11) | 76 #if defined(USE_AURA) && defined(USE_X11) |
| 76 #include <X11/Xlib.h> | 77 #include <X11/Xlib.h> |
| 77 #include "ui/events/event_constants.h" | 78 #include "ui/events/event_constants.h" |
| 78 #include "ui/events/keycodes/keyboard_code_conversion.h" | 79 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 79 #include "ui/events/test/events_test_utils.h" | 80 #include "ui/events/test/events_test_utils.h" |
| 80 #include "ui/events/test/events_test_utils_x11.h" | 81 #include "ui/events/test/events_test_utils_x11.h" |
| 81 #endif | 82 #endif |
| 82 | 83 |
| 83 #if defined(USE_OZONE) | 84 #if defined(USE_OZONE) |
| 84 #include "ui/events/keycodes/keyboard_code_conversion.h" | 85 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 85 #endif | 86 #endif |
| 86 | 87 |
| 87 #include "url/url_constants.h" | 88 #include "url/url_constants.h" |
| 88 | 89 |
| 89 using blink::WebFrame; | 90 using blink::WebFrame; |
| 91 using blink::WebHeap; |
| 90 using blink::WebInputEvent; | 92 using blink::WebInputEvent; |
| 91 using blink::WebLocalFrame; | 93 using blink::WebLocalFrame; |
| 92 using blink::WebMouseEvent; | 94 using blink::WebMouseEvent; |
| 93 using blink::WebRuntimeFeatures; | 95 using blink::WebRuntimeFeatures; |
| 94 using blink::WebString; | 96 using blink::WebString; |
| 95 using blink::WebTextDirection; | 97 using blink::WebTextDirection; |
| 96 using blink::WebURLError; | 98 using blink::WebURLError; |
| 97 | 99 |
| 98 namespace content { | 100 namespace content { |
| 99 | 101 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 ~RenderViewImplTest() override {} | 166 ~RenderViewImplTest() override {} |
| 165 | 167 |
| 166 void SetUp() override { | 168 void SetUp() override { |
| 167 // Enable Blink's experimental and test only features so that test code | 169 // Enable Blink's experimental and test only features so that test code |
| 168 // does not have to bother enabling each feature. | 170 // does not have to bother enabling each feature. |
| 169 WebRuntimeFeatures::enableExperimentalFeatures(true); | 171 WebRuntimeFeatures::enableExperimentalFeatures(true); |
| 170 WebRuntimeFeatures::enableTestOnlyFeatures(true); | 172 WebRuntimeFeatures::enableTestOnlyFeatures(true); |
| 171 RenderViewTest::SetUp(); | 173 RenderViewTest::SetUp(); |
| 172 } | 174 } |
| 173 | 175 |
| 176 // To avoid flaky leak reports, insist on GCing |
| 177 // Blink upon shutdown to clear out garbage. |
| 178 void TearDown() override { |
| 179 WebHeap::collectGarbageForTesting(); |
| 180 RenderViewTest::TearDown(); |
| 181 } |
| 182 |
| 174 RenderViewImpl* view() { | 183 RenderViewImpl* view() { |
| 175 return static_cast<RenderViewImpl*>(view_); | 184 return static_cast<RenderViewImpl*>(view_); |
| 176 } | 185 } |
| 177 | 186 |
| 178 int view_page_id() { | 187 int view_page_id() { |
| 179 return view()->page_id_; | 188 return view()->page_id_; |
| 180 } | 189 } |
| 181 | 190 |
| 182 TestRenderFrame* frame() { | 191 TestRenderFrame* frame() { |
| 183 return static_cast<TestRenderFrame*>(view()->GetMainRenderFrame()); | 192 return static_cast<TestRenderFrame*>(view()->GetMainRenderFrame()); |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 ExecuteJavaScriptForTests( | 503 ExecuteJavaScriptForTests( |
| 495 "document.getElementById('elt_text').value = 'foo';"); | 504 "document.getElementById('elt_text').value = 'foo';"); |
| 496 ProcessPendingMessages(); | 505 ProcessPendingMessages(); |
| 497 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { | 506 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
| 498 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( | 507 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
| 499 FrameHostMsg_UpdateState::ID)); | 508 FrameHostMsg_UpdateState::ID)); |
| 500 } else { | 509 } else { |
| 501 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( | 510 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
| 502 ViewHostMsg_UpdateState::ID)); | 511 ViewHostMsg_UpdateState::ID)); |
| 503 } | 512 } |
| 504 ProcessPendingMessages(); | |
| 505 } | 513 } |
| 506 | 514 |
| 507 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { | 515 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { |
| 508 // An http url will trigger a resource load so cannot be used here. | 516 // An http url will trigger a resource load so cannot be used here. |
| 509 CommonNavigationParams common_params; | 517 CommonNavigationParams common_params; |
| 510 StartNavigationParams start_params; | 518 StartNavigationParams start_params; |
| 511 RequestNavigationParams request_params; | 519 RequestNavigationParams request_params; |
| 512 common_params.url = GURL("data:text/html,<div>Page</div>"); | 520 common_params.url = GURL("data:text/html,<div>Page</div>"); |
| 513 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 521 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 514 common_params.transition = ui::PAGE_TRANSITION_TYPED; | 522 common_params.transition = ui::PAGE_TRANSITION_TYPED; |
| (...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 FROM_HERE, | 2742 FROM_HERE, |
| 2735 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2743 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2736 ExecuteJavaScriptForTests("debugger;"); | 2744 ExecuteJavaScriptForTests("debugger;"); |
| 2737 | 2745 |
| 2738 // CloseWhilePaused should resume execution and continue here. | 2746 // CloseWhilePaused should resume execution and continue here. |
| 2739 EXPECT_FALSE(IsPaused()); | 2747 EXPECT_FALSE(IsPaused()); |
| 2740 Detach(); | 2748 Detach(); |
| 2741 } | 2749 } |
| 2742 | 2750 |
| 2743 } // namespace content | 2751 } // namespace content |
| OLD | NEW |