| OLD | NEW |
| 1 |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // 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 |
| 3 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 4 | 5 |
| 5 #include "content/browser/browser_url_handler.h" | 6 #include "content/browser/browser_url_handler.h" |
| 6 #include "content/browser/renderer_host/test_backing_store.h" | 7 #include "content/browser/renderer_host/test_backing_store.h" |
| 7 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
| 8 #include "content/browser/site_instance.h" | 9 #include "content/browser/site_instance.h" |
| 9 #include "content/browser/tab_contents/navigation_controller.h" | 10 #include "content/browser/tab_contents/navigation_controller.h" |
| 10 #include "content/browser/tab_contents/test_tab_contents.h" | 11 #include "content/browser/tab_contents/test_tab_contents.h" |
| 11 #include "content/common/content_client.h" | 12 #include "content/common/content_client.h" |
| 12 #include "content/common/dom_storage_common.h" | 13 #include "content/common/dom_storage_common.h" |
| 13 #include "content/common/view_messages.h" | 14 #include "content/common/view_messages.h" |
| 14 #include "content/test/test_browser_context.h" | 15 #include "content/test/test_browser_context.h" |
| 15 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 16 #include "webkit/glue/webkit_glue.h" | 17 #include "webkit/glue/webkit_glue.h" |
| 17 #include "webkit/glue/webpreferences.h" | 18 #include "webkit/glue/webpreferences.h" |
| 18 #include "webkit/glue/password_form.h" | 19 #include "webkit/glue/password_form.h" |
| 19 | 20 |
| 20 using webkit_glue::PasswordForm; | 21 using webkit_glue::PasswordForm; |
| 21 | 22 |
| 22 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 23 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
| 23 int page_id, | 24 int page_id, |
| 24 const GURL& url, | 25 const GURL& url, |
| 25 PageTransition::Type transition) { | 26 content::PageTransition transition) { |
| 26 params->page_id = page_id; | 27 params->page_id = page_id; |
| 27 params->url = url; | 28 params->url = url; |
| 28 params->referrer = GURL(); | 29 params->referrer = GURL(); |
| 29 params->transition = transition; | 30 params->transition = transition; |
| 30 params->redirects = std::vector<GURL>(); | 31 params->redirects = std::vector<GURL>(); |
| 31 params->should_update_history = false; | 32 params->should_update_history = false; |
| 32 params->searchable_form_url = GURL(); | 33 params->searchable_form_url = GURL(); |
| 33 params->searchable_form_encoding = std::string(); | 34 params->searchable_form_encoding = std::string(); |
| 34 params->password_form = PasswordForm(); | 35 params->password_form = PasswordForm(); |
| 35 params->security_info = std::string(); | 36 params->security_info = std::string(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 71 |
| 71 bool TestRenderViewHost::IsRenderViewLive() const { | 72 bool TestRenderViewHost::IsRenderViewLive() const { |
| 72 return render_view_created_; | 73 return render_view_created_; |
| 73 } | 74 } |
| 74 | 75 |
| 75 bool TestRenderViewHost::TestOnMessageReceived(const IPC::Message& msg) { | 76 bool TestRenderViewHost::TestOnMessageReceived(const IPC::Message& msg) { |
| 76 return OnMessageReceived(msg); | 77 return OnMessageReceived(msg); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void TestRenderViewHost::SendNavigate(int page_id, const GURL& url) { | 80 void TestRenderViewHost::SendNavigate(int page_id, const GURL& url) { |
| 80 SendNavigateWithTransition(page_id, url, PageTransition::LINK); | 81 SendNavigateWithTransition(page_id, url, content::PAGE_TRANSITION_LINK); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void TestRenderViewHost::SendNavigateWithTransition( | 84 void TestRenderViewHost::SendNavigateWithTransition( |
| 84 int page_id, const GURL& url, PageTransition::Type transition) { | 85 int page_id, const GURL& url, content::PageTransition transition) { |
| 85 ViewHostMsg_FrameNavigate_Params params; | 86 ViewHostMsg_FrameNavigate_Params params; |
| 86 | 87 |
| 87 params.page_id = page_id; | 88 params.page_id = page_id; |
| 88 params.url = url; | 89 params.url = url; |
| 89 params.referrer = GURL(); | 90 params.referrer = GURL(); |
| 90 params.transition = transition; | 91 params.transition = transition; |
| 91 params.redirects = std::vector<GURL>(); | 92 params.redirects = std::vector<GURL>(); |
| 92 params.should_update_history = true; | 93 params.should_update_history = true; |
| 93 params.searchable_form_url = GURL(); | 94 params.searchable_form_url = GURL(); |
| 94 params.searchable_form_encoding = std::string(); | 95 params.searchable_form_encoding = std::string(); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 SetContents(NULL); | 363 SetContents(NULL); |
| 363 | 364 |
| 364 // Make sure that we flush any messages related to TabContents destruction | 365 // Make sure that we flush any messages related to TabContents destruction |
| 365 // before we destroy the browser context. | 366 // before we destroy the browser context. |
| 366 MessageLoop::current()->RunAllPending(); | 367 MessageLoop::current()->RunAllPending(); |
| 367 | 368 |
| 368 // Release the browser context on the UI thread. | 369 // Release the browser context on the UI thread. |
| 369 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); | 370 message_loop_.DeleteSoon(FROM_HERE, browser_context_.release()); |
| 370 message_loop_.RunAllPending(); | 371 message_loop_.RunAllPending(); |
| 371 } | 372 } |
| OLD | NEW |