OLD | NEW |
1 | 1 |
2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "content/browser/browser_url_handler.h" | 6 #include "content/browser/browser_url_handler.h" |
7 #include "content/browser/renderer_host/test_backing_store.h" | 7 #include "content/browser/renderer_host/test_backing_store.h" |
8 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
9 #include "content/browser/site_instance.h" | 9 #include "content/browser/site_instance.h" |
10 #include "content/browser/tab_contents/navigation_controller.h" | 10 #include "content/browser/tab_contents/navigation_controller.h" |
11 #include "content/browser/tab_contents/navigation_entry.h" | 11 #include "content/browser/tab_contents/navigation_entry_impl.h" |
12 #include "content/browser/tab_contents/test_tab_contents.h" | 12 #include "content/browser/tab_contents/test_tab_contents.h" |
13 #include "content/common/dom_storage_common.h" | 13 #include "content/common/dom_storage_common.h" |
14 #include "content/common/view_messages.h" | 14 #include "content/common/view_messages.h" |
15 #include "content/public/common/content_client.h" | 15 #include "content/public/common/content_client.h" |
16 #include "content/test/test_browser_context.h" | 16 #include "content/test/test_browser_context.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 #include "webkit/forms/password_form.h" | 18 #include "webkit/forms/password_form.h" |
19 #include "webkit/glue/webkit_glue.h" | 19 #include "webkit/glue/webkit_glue.h" |
20 #include "webkit/glue/webpreferences.h" | 20 #include "webkit/glue/webpreferences.h" |
21 | 21 |
| 22 using content::NavigationEntry; |
22 using webkit::forms::PasswordForm; | 23 using webkit::forms::PasswordForm; |
23 | 24 |
24 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 25 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
25 int page_id, | 26 int page_id, |
26 const GURL& url, | 27 const GURL& url, |
27 content::PageTransition transition) { | 28 content::PageTransition transition) { |
28 params->page_id = page_id; | 29 params->page_id = page_id; |
29 params->url = url; | 30 params->url = url; |
30 params->referrer = content::Referrer(); | 31 params->referrer = content::Referrer(); |
31 params->transition = transition; | 32 params->transition = transition; |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 SiteInstance::CreateSiteInstance(browser_context_.get()); | 359 SiteInstance::CreateSiteInstance(browser_context_.get()); |
359 | 360 |
360 return new TestTabContents(browser_context_.get(), instance); | 361 return new TestTabContents(browser_context_.get(), instance); |
361 } | 362 } |
362 | 363 |
363 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { | 364 void RenderViewHostTestHarness::NavigateAndCommit(const GURL& url) { |
364 contents()->NavigateAndCommit(url); | 365 contents()->NavigateAndCommit(url); |
365 } | 366 } |
366 | 367 |
367 void RenderViewHostTestHarness::Reload() { | 368 void RenderViewHostTestHarness::Reload() { |
368 content::NavigationEntry* entry = controller().GetLastCommittedEntry(); | 369 NavigationEntry* entry = controller().GetLastCommittedEntry(); |
369 DCHECK(entry); | 370 DCHECK(entry); |
370 controller().Reload(false); | 371 controller().Reload(false); |
371 rvh()->SendNavigate(entry->GetPageID(), entry->GetURL()); | 372 rvh()->SendNavigate(entry->GetPageID(), entry->GetURL()); |
372 } | 373 } |
373 | 374 |
374 void RenderViewHostTestHarness::SetUp() { | 375 void RenderViewHostTestHarness::SetUp() { |
375 SetContents(CreateTestTabContents()); | 376 SetContents(CreateTestTabContents()); |
376 } | 377 } |
377 | 378 |
378 void RenderViewHostTestHarness::TearDown() { | 379 void RenderViewHostTestHarness::TearDown() { |
379 SetContents(NULL); | 380 SetContents(NULL); |
380 | 381 |
381 // Make sure that we flush any messages related to TabContents destruction | 382 // Make sure that we flush any messages related to TabContents destruction |
382 // before we destroy the browser context. | 383 // before we destroy the browser context. |
383 MessageLoop::current()->RunAllPending(); | 384 MessageLoop::current()->RunAllPending(); |
384 | 385 |
385 // Release the browser context on the UI thread. | 386 // Release the browser context on the UI thread. |
386 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 387 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
387 message_loop_.RunAllPending(); | 388 message_loop_.RunAllPending(); |
388 } | 389 } |
OLD | NEW |