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

Side by Side Diff: content/test/render_view_fake_resources_test.cc

Issue 10449094: Fix client-side phishing detection test flakiness and ChromeOS failure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore the previous sandbox-enabled state Created 8 years, 6 months 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 | Annotate | Revision Log
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/public/test/render_view_fake_resources_test.h" 5 #include "content/public/test/render_view_fake_resources_test.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "content/common/resource_messages.h" 12 #include "content/common/resource_messages.h"
13 #include "content/common/view_messages.h" 13 #include "content/common/view_messages.h"
14 #include "content/public/common/resource_response.h" 14 #include "content/public/common/resource_response.h"
15 #include "content/renderer/render_thread_impl.h" 15 #include "content/renderer/render_thread_impl.h"
16 #include "content/renderer/render_view_impl.h" 16 #include "content/renderer/render_view_impl.h"
17 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
17 #include "content/test/mock_render_process.h" 18 #include "content/test/mock_render_process.h"
18 #include "googleurl/src/gurl.h" 19 #include "googleurl/src/gurl.h"
19 #include "net/base/upload_data.h" 20 #include "net/base/upload_data.h"
20 #include "net/http/http_response_headers.h" 21 #include "net/http/http_response_headers.h"
21 #include "net/url_request/url_request_status.h" 22 #include "net/url_request/url_request_status.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques t.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 // Generate a unique channel id so that multiple instances of the test can 62 // Generate a unique channel id so that multiple instances of the test can
62 // run in parallel. 63 // run in parallel.
63 std::string channel_id = IPC::Channel::GenerateVerifiedChannelID( 64 std::string channel_id = IPC::Channel::GenerateVerifiedChannelID(
64 std::string()); 65 std::string());
65 channel_.reset(new IPC::Channel(channel_id, 66 channel_.reset(new IPC::Channel(channel_id,
66 IPC::Channel::MODE_SERVER, this)); 67 IPC::Channel::MODE_SERVER, this));
67 ASSERT_TRUE(channel_->Connect()); 68 ASSERT_TRUE(channel_->Connect());
68 69
69 webkit_glue::SetJavaScriptFlags("--expose-gc"); 70 webkit_glue::SetJavaScriptFlags("--expose-gc");
70 mock_process_.reset(new MockRenderProcess); 71 mock_process_.reset(new MockRenderProcess);
72 sandbox_was_enabled_ =
73 RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting(false);
71 render_thread_ = new RenderThreadImpl(channel_id); 74 render_thread_ = new RenderThreadImpl(channel_id);
72 75
73 // Tell the renderer to create a view, then wait until it's ready. 76 // Tell the renderer to create a view, then wait until it's ready.
74 // We can't call View::Create() directly here or else we won't get 77 // We can't call View::Create() directly here or else we won't get
75 // RenderProcess's lazy initialization of WebKit. 78 // RenderProcess's lazy initialization of WebKit.
76 view_ = NULL; 79 view_ = NULL;
77 ViewMsg_New_Params params; 80 ViewMsg_New_Params params;
78 params.parent_window = 0; 81 params.parent_window = 0;
79 params.view_id = kViewId; 82 params.view_id = kViewId;
80 params.opener_route_id = MSG_ROUTING_NONE; 83 params.opener_route_id = MSG_ROUTING_NONE;
81 params.session_storage_namespace_id = 84 params.session_storage_namespace_id =
82 dom_storage::kInvalidSessionStorageNamespaceId; 85 dom_storage::kInvalidSessionStorageNamespaceId;
83 ASSERT_TRUE(channel_->Send(new ViewMsg_New(params))); 86 ASSERT_TRUE(channel_->Send(new ViewMsg_New(params)));
84 message_loop_.Run(); 87 message_loop_.Run();
85 } 88 }
86 89
87 void RenderViewFakeResourcesTest::TearDown() { 90 void RenderViewFakeResourcesTest::TearDown() {
88 // Try very hard to collect garbage before shutting down. 91 // Try very hard to collect garbage before shutting down.
89 GetMainFrame()->collectGarbage(); 92 GetMainFrame()->collectGarbage();
90 GetMainFrame()->collectGarbage(); 93 GetMainFrame()->collectGarbage();
91 94
92 ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId))); 95 ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId)));
93 do { 96 do {
94 message_loop_.RunAllPending(); 97 message_loop_.RunAllPending();
95 view_ = NULL; 98 view_ = NULL;
96 RenderView::ForEach(this); 99 RenderView::ForEach(this);
97 } while (view_); 100 } while (view_);
98 101
99 mock_process_.reset(); 102 mock_process_.reset();
103 RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting(
104 sandbox_was_enabled_);
100 } 105 }
101 106
102 RenderView* RenderViewFakeResourcesTest::view() { 107 RenderView* RenderViewFakeResourcesTest::view() {
103 return view_; 108 return view_;
104 } 109 }
105 110
106 WebKit::WebFrame* RenderViewFakeResourcesTest::GetMainFrame() { 111 WebKit::WebFrame* RenderViewFakeResourcesTest::GetMainFrame() {
107 return view_->GetWebView()->mainFrame(); 112 return view_->GetWebView()->mainFrame();
108 } 113 }
109 114
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 params.url = GURL(history_item.urlString()); 204 params.url = GURL(history_item.urlString());
200 params.transition = PAGE_TRANSITION_FORWARD_BACK; 205 params.transition = PAGE_TRANSITION_FORWARD_BACK;
201 params.state = webkit_glue::HistoryItemToString(history_item); 206 params.state = webkit_glue::HistoryItemToString(history_item);
202 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; 207 params.navigation_type = ViewMsg_Navigate_Type::NORMAL;
203 params.request_time = base::Time::Now(); 208 params.request_time = base::Time::Now();
204 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); 209 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params));
205 message_loop_.Run(); 210 message_loop_.Run();
206 } 211 }
207 212
208 } // namespace content 213 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_webkitplatformsupport_impl.cc ('k') | content/test/webrtc_audio_device_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698