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

Side by Side Diff: content/browser/web_contents/render_view_host_manager_unittest.cc

Issue 10451047: content: Move javascript_message_type.h into content/ from ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm CONTEXT_EXPORT 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 "base/utf_string_conversions.h" 5 #include "base/utf_string_conversions.h"
6 #include "content/browser/browser_thread_impl.h" 6 #include "content/browser/browser_thread_impl.h"
7 #include "content/browser/mock_content_browser_client.h" 7 #include "content/browser/mock_content_browser_client.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_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/web_contents/navigation_controller_impl.h"
10 #include "content/browser/web_contents/navigation_entry_impl.h" 11 #include "content/browser/web_contents/navigation_entry_impl.h"
11 #include "content/browser/web_contents/navigation_controller_impl.h"
12 #include "content/browser/web_contents/render_view_host_manager.h" 12 #include "content/browser/web_contents/render_view_host_manager.h"
13 #include "content/browser/web_contents/test_web_contents.h" 13 #include "content/browser/web_contents/test_web_contents.h"
14 #include "content/common/test_url_constants.h" 14 #include "content/common/test_url_constants.h"
15 #include "content/common/view_messages.h" 15 #include "content/common/view_messages.h"
16 #include "content/public/browser/notification_details.h" 16 #include "content/public/browser/notification_details.h"
17 #include "content/public/browser/notification_source.h" 17 #include "content/public/browser/notification_source.h"
18 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
19 #include "content/public/browser/web_ui_controller.h" 19 #include "content/public/browser/web_ui_controller.h"
20 #include "content/public/browser/web_ui_controller_factory.h" 20 #include "content/public/browser/web_ui_controller_factory.h"
21 #include "content/public/common/javascript_message_type.h"
21 #include "content/public/common/page_transition_types.h" 22 #include "content/public/common/page_transition_types.h"
22 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
23 #include "content/test/mock_render_process_host.h" 24 #include "content/test/mock_render_process_host.h"
24 #include "content/test/test_browser_context.h" 25 #include "content/test/test_browser_context.h"
25 #include "content/test/test_content_client.h" 26 #include "content/test/test_content_client.h"
26 #include "content/test/test_notification_tracker.h" 27 #include "content/test/test_notification_tracker.h"
27 #include "googleurl/src/url_util.h" 28 #include "googleurl/src/url_util.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 #include "ui/base/javascript_message_type.h"
30 #include "webkit/glue/webkit_glue.h" 30 #include "webkit/glue/webkit_glue.h"
31 31
32 using content::BrowserContext; 32 using content::BrowserContext;
33 using content::BrowserThread; 33 using content::BrowserThread;
34 using content::BrowserThreadImpl; 34 using content::BrowserThreadImpl;
35 using content::MockRenderProcessHost; 35 using content::MockRenderProcessHost;
36 using content::NavigationController; 36 using content::NavigationController;
37 using content::NavigationEntry; 37 using content::NavigationEntry;
38 using content::NavigationEntryImpl; 38 using content::NavigationEntryImpl;
39 using content::RenderViewHost; 39 using content::RenderViewHost;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 rvh()->GetRoutingID(), kNtpUrl, msg, false, &result, &unused); 318 rvh()->GetRoutingID(), kNtpUrl, msg, false, &result, &unused);
319 // Enable pumping for check in BrowserMessageFilter::CheckCanDispatchOnUI. 319 // Enable pumping for check in BrowserMessageFilter::CheckCanDispatchOnUI.
320 before_unload_msg.EnableMessagePumping(); 320 before_unload_msg.EnableMessagePumping();
321 EXPECT_TRUE(ntp_rvh->OnMessageReceived(before_unload_msg)); 321 EXPECT_TRUE(ntp_rvh->OnMessageReceived(before_unload_msg));
322 EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID)); 322 EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID));
323 323
324 // Also test RunJavaScriptMessage. 324 // Also test RunJavaScriptMessage.
325 ntp_process_host->sink().ClearMessages(); 325 ntp_process_host->sink().ClearMessages();
326 ViewHostMsg_RunJavaScriptMessage js_msg( 326 ViewHostMsg_RunJavaScriptMessage js_msg(
327 rvh()->GetRoutingID(), msg, msg, kNtpUrl, 327 rvh()->GetRoutingID(), msg, msg, kNtpUrl,
328 ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, &result, &unused); 328 content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, &result, &unused);
329 js_msg.EnableMessagePumping(); 329 js_msg.EnableMessagePumping();
330 EXPECT_TRUE(ntp_rvh->OnMessageReceived(js_msg)); 330 EXPECT_TRUE(ntp_rvh->OnMessageReceived(js_msg));
331 EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID)); 331 EXPECT_TRUE(ntp_process_host->sink().GetUniqueMessageMatching(IPC_REPLY_ID));
332 } 332 }
333 333
334 // When there is an error with the specified page, renderer exits view-source 334 // When there is an error with the specified page, renderer exits view-source
335 // mode. See WebFrameImpl::DidFail(). We check by this test that 335 // mode. See WebFrameImpl::DidFail(). We check by this test that
336 // EnableViewSourceMode message is sent on every navigation regardless 336 // EnableViewSourceMode message is sent on every navigation regardless
337 // RenderView is being newly created or reused. 337 // RenderView is being newly created or reused.
338 TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { 338 TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) {
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 EXPECT_FALSE(rvh1->GetSiteInstance()->IsRelatedSiteInstance( 828 EXPECT_FALSE(rvh1->GetSiteInstance()->IsRelatedSiteInstance(
829 rvh3->GetSiteInstance())); 829 rvh3->GetSiteInstance()));
830 830
831 // No scripting is allowed across BrowsingInstances, so we should not create 831 // No scripting is allowed across BrowsingInstances, so we should not create
832 // swapped out RVHs for the opener chain in this case. 832 // swapped out RVHs for the opener chain in this case.
833 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost( 833 EXPECT_FALSE(opener1_manager->GetSwappedOutRenderViewHost(
834 rvh3->GetSiteInstance())); 834 rvh3->GetSiteInstance()));
835 EXPECT_FALSE(opener2_manager->GetSwappedOutRenderViewHost( 835 EXPECT_FALSE(opener2_manager->GetSwappedOutRenderViewHost(
836 rvh3->GetSiteInstance())); 836 rvh3->GetSiteInstance()));
837 } 837 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698