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

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

Issue 20300002: Fix trailing whitespace in .cpp, .h, and .idl files (ex. Source/core) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | « Source/web/tests/PrerenderingTest.cpp ('k') | Source/weborigin/KURL.h » ('j') | 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 EXPECT_EQ(forms.size(), 1U); 232 EXPECT_EQ(forms.size(), 1U);
233 233
234 // This test passes if this doesn't crash. 234 // This test passes if this doesn't crash.
235 WebSearchableFormData searchableDataForm(forms[0]); 235 WebSearchableFormData searchableDataForm(forms[0]);
236 } 236 }
237 237
238 TEST_F(WebFrameTest, ChromePageJavascript) 238 TEST_F(WebFrameTest, ChromePageJavascript)
239 { 239 {
240 registerMockedChromeURLLoad("history.html"); 240 registerMockedChromeURLLoad("history.html");
241 241
242 // Pass true to enable JavaScript. 242 // Pass true to enable JavaScript.
243 m_webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.ht ml", true); 243 m_webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.ht ml", true);
244 244
245 // Try to run JS against the chrome-style URL. 245 // Try to run JS against the chrome-style URL.
246 FrameTestHelpers::loadFrame(m_webView->mainFrame(), "javascript:document.bod y.appendChild(document.createTextNode('Clobbered'))"); 246 FrameTestHelpers::loadFrame(m_webView->mainFrame(), "javascript:document.bod y.appendChild(document.createTextNode('Clobbered'))");
247 247
248 // Required to see any updates in contentAsText. 248 // Required to see any updates in contentAsText.
249 m_webView->layout(); 249 m_webView->layout();
250 250
251 // Now retrieve the frame's text and ensure it was modified by running javas cript. 251 // Now retrieve the frame's text and ensure it was modified by running javas cript.
(...skipping 19 matching lines...) Expand all
271 std::string content = std::string(m_webView->mainFrame()->contentAsText(1024 ).utf8().data()); 271 std::string content = std::string(m_webView->mainFrame()->contentAsText(1024 ).utf8().data());
272 EXPECT_EQ(std::string::npos, content.find("Clobbered")); 272 EXPECT_EQ(std::string::npos, content.find("Clobbered"));
273 } 273 }
274 274
275 TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) 275 TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck)
276 { 276 {
277 registerMockedHttpURLLoad("postmessage_test.html"); 277 registerMockedHttpURLLoad("postmessage_test.html");
278 278
279 // Pass true to enable JavaScript. 279 // Pass true to enable JavaScript.
280 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_ test.html", true); 280 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_ test.html", true);
281 281
282 // Send a message with the correct origin. 282 // Send a message with the correct origin.
283 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL)) ); 283 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL)) );
284 WebDOMEvent event = m_webView->mainFrame()->document().createEvent("MessageE vent"); 284 WebDOMEvent event = m_webView->mainFrame()->document().createEvent("MessageE vent");
285 WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); 285 WebDOMMessageEvent message = event.to<WebDOMMessageEvent>();
286 WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); 286 WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo"));
287 message.initMessageEvent("message", false, false, data, "http://origin.com", 0, ""); 287 message.initMessageEvent("message", false, false, data, "http://origin.com", 0, "");
288 m_webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, m essage); 288 m_webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, m essage);
289 289
290 // Send another message with incorrect origin. 290 // Send another message with incorrect origin.
291 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeU RL))); 291 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeU RL)));
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 m_webView->close(); 1948 m_webView->close();
1949 m_webView = 0; 1949 m_webView = 0;
1950 } 1950 }
1951 1951
1952 class TestDidCreateFrameWebFrameClient : public WebFrameClient { 1952 class TestDidCreateFrameWebFrameClient : public WebFrameClient {
1953 public: 1953 public:
1954 TestDidCreateFrameWebFrameClient() : m_frameCount(0), m_parent(0) 1954 TestDidCreateFrameWebFrameClient() : m_frameCount(0), m_parent(0)
1955 { 1955 {
1956 } 1956 }
1957 1957
1958 virtual void didCreateFrame(WebFrame* parent, WebFrame* child) 1958 virtual void didCreateFrame(WebFrame* parent, WebFrame* child)
1959 { 1959 {
1960 m_frameCount++; 1960 m_frameCount++;
1961 if (!m_parent) 1961 if (!m_parent)
1962 m_parent = parent; 1962 m_parent = parent;
1963 } 1963 }
1964 1964
1965 int m_frameCount; 1965 int m_frameCount;
1966 WebFrame* m_parent; 1966 WebFrame* m_parent;
1967 }; 1967 };
1968 1968
1969 TEST_F(WebFrameTest, DidCreateFrame) 1969 TEST_F(WebFrameTest, DidCreateFrame)
1970 { 1970 {
1971 registerMockedHttpURLLoad("iframes_test.html"); 1971 registerMockedHttpURLLoad("iframes_test.html");
1972 registerMockedHttpURLLoad("visible_iframe.html"); 1972 registerMockedHttpURLLoad("visible_iframe.html");
1973 registerMockedHttpURLLoad("invisible_iframe.html"); 1973 registerMockedHttpURLLoad("invisible_iframe.html");
1974 registerMockedHttpURLLoad("zero_sized_iframe.html"); 1974 registerMockedHttpURLLoad("zero_sized_iframe.html");
1975 1975
1976 TestDidCreateFrameWebFrameClient webFrameClient; 1976 TestDidCreateFrameWebFrameClient webFrameClient;
1977 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test .html", false, &webFrameClient); 1977 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test .html", false, &webFrameClient);
1978 1978
1979 EXPECT_EQ(webFrameClient.m_frameCount, 3); 1979 EXPECT_EQ(webFrameClient.m_frameCount, 3);
1980 EXPECT_EQ(webFrameClient.m_parent, m_webView->mainFrame()); 1980 EXPECT_EQ(webFrameClient.m_parent, m_webView->mainFrame());
1981 1981
1982 m_webView->close(); 1982 m_webView->close();
1983 m_webView = 0; 1983 m_webView = 0;
1984 } 1984 }
1985 1985
1986 class FindUpdateWebFrameClient : public WebFrameClient { 1986 class FindUpdateWebFrameClient : public WebFrameClient {
1987 public: 1987 public:
1988 FindUpdateWebFrameClient() 1988 FindUpdateWebFrameClient()
1989 : m_findResultsAreReady(false) 1989 : m_findResultsAreReady(false)
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3169 public: 3169 public:
3170 TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false ) 3170 TestAccessInitialDocumentWebFrameClient() : m_didAccessInitialDocument(false )
3171 { 3171 {
3172 } 3172 }
3173 3173
3174 virtual void didAccessInitialDocument(WebFrame* frame) 3174 virtual void didAccessInitialDocument(WebFrame* frame)
3175 { 3175 {
3176 EXPECT_TRUE(!m_didAccessInitialDocument); 3176 EXPECT_TRUE(!m_didAccessInitialDocument);
3177 m_didAccessInitialDocument = true; 3177 m_didAccessInitialDocument = true;
3178 } 3178 }
3179 3179
3180 bool m_didAccessInitialDocument; 3180 bool m_didAccessInitialDocument;
3181 }; 3181 };
3182 3182
3183 TEST_F(WebFrameTest, DidAccessInitialDocumentBody) 3183 TEST_F(WebFrameTest, DidAccessInitialDocumentBody)
3184 { 3184 {
3185 TestAccessInitialDocumentWebFrameClient webFrameClient; 3185 TestAccessInitialDocumentWebFrameClient webFrameClient;
3186 m_webView = FrameTestHelpers::createWebView(true, &webFrameClient); 3186 m_webView = FrameTestHelpers::createWebView(true, &webFrameClient);
3187 runPendingTasks(); 3187 runPendingTasks();
3188 EXPECT_FALSE(webFrameClient.m_didAccessInitialDocument); 3188 EXPECT_FALSE(webFrameClient.m_didAccessInitialDocument);
3189 3189
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
3461 webViewImpl->page()->mainFrame()->loader()->load(frameRequest); 3461 webViewImpl->page()->mainFrame()->loader()->load(frameRequest);
3462 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 3462 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
3463 3463
3464 EXPECT_TRUE(client.frameLoadTypeSameSeen()); 3464 EXPECT_TRUE(client.frameLoadTypeSameSeen());
3465 m_webView->close(); 3465 m_webView->close();
3466 m_webView = 0; 3466 m_webView = 0;
3467 } 3467 }
3468 3468
3469 3469
3470 } // namespace 3470 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/PrerenderingTest.cpp ('k') | Source/weborigin/KURL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698