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

Side by Side Diff: Source/web/tests/FrameLoaderClientImplTest.cpp

Issue 1314703003: Oilpan: Fix a raw pointer in FrameLoaderClientImplTest. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove the field. Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 { 67 {
68 ON_CALL(m_webFrameClient, userAgentOverride(_, _)).WillByDefault(Return( WebString())); 68 ON_CALL(m_webFrameClient, userAgentOverride(_, _)).WillByDefault(Return( WebString()));
69 69
70 FrameTestHelpers::TestWebViewClient webViewClient; 70 FrameTestHelpers::TestWebViewClient webViewClient;
71 m_webView = WebView::create(&webViewClient); 71 m_webView = WebView::create(&webViewClient);
72 // FIXME: http://crbug.com/363843. This needs to find a better way to 72 // FIXME: http://crbug.com/363843. This needs to find a better way to
73 // not create graphics layers. 73 // not create graphics layers.
74 m_webView->settings()->setAcceleratedCompositingEnabled(false); 74 m_webView->settings()->setAcceleratedCompositingEnabled(false);
75 m_mainFrame = WebLocalFrame::create(WebTreeScopeType::Document, &m_webFr ameClient); 75 m_mainFrame = WebLocalFrame::create(WebTreeScopeType::Document, &m_webFr ameClient);
76 m_webView->setMainFrame(m_mainFrame); 76 m_webView->setMainFrame(m_mainFrame);
77 m_frameLoaderClientImpl = toFrameLoaderClientImpl(toWebLocalFrameImpl(m_ webView->mainFrame())->frame()->loader().client());
78 } 77 }
79 78
80 void TearDown() override 79 void TearDown() override
81 { 80 {
82 m_webView->close(); 81 m_webView->close();
83 m_mainFrame->close(); 82 m_mainFrame->close();
84 } 83 }
85 84
86 WebString userAgent() 85 WebString userAgent()
87 { 86 {
88 // The test always returns the same user agent, regardless of the URL pa ssed in. 87 // The test always returns the same user agent, regardless of the URL pa ssed in.
89 KURL dummyURL(ParsedURLString, "about:blank"); 88 KURL dummyURL(ParsedURLString, "about:blank");
90 WTF::CString userAgent = m_frameLoaderClientImpl->userAgent(dummyURL).ut f8(); 89 WTF::CString userAgent = frameLoaderClientImpl().userAgent(dummyURL).utf 8();
sof 2015/08/25 10:37:14 You can use frameLoaderClient() for this also (and
Yuta Kitamura 2015/08/26 05:32:30 OK, I'll follow up on this. Follow-up of a follow-
91 return WebString::fromUTF8(userAgent.data(), userAgent.length()); 90 return WebString::fromUTF8(userAgent.data(), userAgent.length());
92 } 91 }
93 92
94 WebLocalFrameImpl* mainFrame() { return toWebLocalFrameImpl(m_webView->mainF rame()); } 93 WebLocalFrameImpl* mainFrame() { return toWebLocalFrameImpl(m_webView->mainF rame()); }
95 Document& document() { return *toWebLocalFrameImpl(m_mainFrame)->frame()->do cument(); } 94 Document& document() { return *toWebLocalFrameImpl(m_mainFrame)->frame()->do cument(); }
96 MockWebFrameClient& webFrameClient() { return m_webFrameClient; } 95 MockWebFrameClient& webFrameClient() { return m_webFrameClient; }
97 FrameLoaderClient& frameLoaderClient() { return *m_frameLoaderClientImpl; } 96 FrameLoaderClient& frameLoaderClient() { return frameLoaderClientImpl(); }
97 FrameLoaderClientImpl& frameLoaderClientImpl() { return *toFrameLoaderClient Impl(toWebLocalFrameImpl(m_webView->mainFrame())->frame()->loader().client()); }
98 98
99 private: 99 private:
100 MockWebFrameClient m_webFrameClient; 100 MockWebFrameClient m_webFrameClient;
101 FrameLoaderClientImpl* m_frameLoaderClientImpl;
102 WebView* m_webView; 101 WebView* m_webView;
103 WebFrame* m_mainFrame; 102 WebFrame* m_mainFrame;
104 }; 103 };
105 104
106 TEST_F(FrameLoaderClientImplTest, UserAgentOverride) 105 TEST_F(FrameLoaderClientImplTest, UserAgentOverride)
107 { 106 {
108 const WebString defaultUserAgent = userAgent(); 107 const WebString defaultUserAgent = userAgent();
109 const WebString overrideUserAgent = WebString::fromUTF8("dummy override"); 108 const WebString overrideUserAgent = WebString::fromUTF8("dummy override");
110 109
111 // Override the user agent and make sure we get it back. 110 // Override the user agent and make sure we get it back.
(...skipping 30 matching lines...) Expand all
142 EXPECT_CALL(webFrameClient(), createPluginPlaceholder(mainFrame(), _)) 141 EXPECT_CALL(webFrameClient(), createPluginPlaceholder(mainFrame(), _))
143 .WillOnce(Return(nullptr)); 142 .WillOnce(Return(nullptr));
144 OwnPtrWillBeRawPtr<PluginPlaceholder> pluginPlaceholder = frameLoaderCli ent().createPluginPlaceholder( 143 OwnPtrWillBeRawPtr<PluginPlaceholder> pluginPlaceholder = frameLoaderCli ent().createPluginPlaceholder(
145 document(), url, paramNames, paramValues, mimeType, loadManually); 144 document(), url, paramNames, paramValues, mimeType, loadManually);
146 ASSERT_FALSE(pluginPlaceholder); 145 ASSERT_FALSE(pluginPlaceholder);
147 } 146 }
148 } 147 }
149 148
150 } // namespace 149 } // namespace
151 } // namespace blink 150 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698