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

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

Issue 1738623004: Rename enums/functions that collide in chromium style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-4
Patch Set: get-names-5 Created 4 years, 9 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
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 5865 matching lines...) Expand 10 before | Expand all | Expand 10 after
5876 EXPECT_TRUE(firstItem); 5876 EXPECT_TRUE(firstItem);
5877 5877
5878 registerMockedHttpURLLoad("white-1x1.png"); 5878 registerMockedHttpURLLoad("white-1x1.png");
5879 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); 5879 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png");
5880 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); 5880 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem());
5881 5881
5882 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), We bHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy); 5882 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem.get()), We bHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy);
5883 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); 5883 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem());
5884 5884
5885 FrameTestHelpers::reloadFrame(frame); 5885 FrameTestHelpers::reloadFrame(frame);
5886 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy()); 5886 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().getCachePolicy());
5887 } 5887 }
5888 5888
5889 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) 5889 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload)
5890 { 5890 {
5891 registerMockedHttpURLLoad("page_with_blank_iframe.html"); 5891 registerMockedHttpURLLoad("page_with_blank_iframe.html");
5892 FrameTestHelpers::WebViewHelper webViewHelper(this); 5892 FrameTestHelpers::WebViewHelper webViewHelper(this);
5893 webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", t rue); 5893 webViewHelper.initializeAndLoad(m_baseURL + "page_with_blank_iframe.html", t rue);
5894 WebFrame* mainFrame = webViewHelper.webView()->mainFrame(); 5894 WebFrame* mainFrame = webViewHelper.webView()->mainFrame();
5895 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI mpl()->frame()->loader(); 5895 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI mpl()->frame()->loader();
5896 WebFrame* childFrame = mainFrame->firstChild(); 5896 WebFrame* childFrame = mainFrame->firstChild();
(...skipping 22 matching lines...) Expand all
5919 webViewHelper.initializeAndLoad(m_baseURL + "reload_post.html", true); 5919 webViewHelper.initializeAndLoad(m_baseURL + "reload_post.html", true);
5920 WebFrame* frame = webViewHelper.webView()->mainFrame(); 5920 WebFrame* frame = webViewHelper.webView()->mainFrame();
5921 5921
5922 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip t:document.forms[0].submit()"); 5922 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascrip t:document.forms[0].submit()");
5923 // Pump requests one more time after the javascript URL has executed to 5923 // Pump requests one more time after the javascript URL has executed to
5924 // trigger the actual POST load request. 5924 // trigger the actual POST load request.
5925 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF rame()); 5925 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF rame());
5926 EXPECT_EQ(WebString::fromUTF8("POST"), frame->dataSource()->request().httpMe thod()); 5926 EXPECT_EQ(WebString::fromUTF8("POST"), frame->dataSource()->request().httpMe thod());
5927 5927
5928 FrameTestHelpers::reloadFrame(frame); 5928 FrameTestHelpers::reloadFrame(frame);
5929 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy()); 5929 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().getCachePolicy());
5930 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT ype()); 5930 EXPECT_EQ(WebNavigationTypeFormResubmitted, frame->dataSource()->navigationT ype());
5931 } 5931 }
5932 5932
5933 TEST_P(ParameterizedWebFrameTest, LoadHistoryItemReload) 5933 TEST_P(ParameterizedWebFrameTest, LoadHistoryItemReload)
5934 { 5934 {
5935 registerMockedHttpURLLoad("fragment_middle_click.html"); 5935 registerMockedHttpURLLoad("fragment_middle_click.html");
5936 FrameTestHelpers::WebViewHelper webViewHelper(this); 5936 FrameTestHelpers::WebViewHelper webViewHelper(this);
5937 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr ue); 5937 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr ue);
5938 WebFrame* frame = webViewHelper.webView()->mainFrame(); 5938 WebFrame* frame = webViewHelper.webView()->mainFrame();
5939 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI mpl()->frame()->loader(); 5939 const FrameLoader& mainFrameLoader = webViewHelper.webViewImpl()->mainFrameI mpl()->frame()->loader();
5940 RefPtrWillBePersistent<HistoryItem> firstItem = mainFrameLoader.currentItem( ); 5940 RefPtrWillBePersistent<HistoryItem> firstItem = mainFrameLoader.currentItem( );
5941 EXPECT_TRUE(firstItem); 5941 EXPECT_TRUE(firstItem);
5942 5942
5943 registerMockedHttpURLLoad("white-1x1.png"); 5943 registerMockedHttpURLLoad("white-1x1.png");
5944 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png"); 5944 FrameTestHelpers::loadFrame(frame, m_baseURL + "white-1x1.png");
5945 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem()); 5945 EXPECT_NE(firstItem.get(), mainFrameLoader.currentItem());
5946 5946
5947 // Cache policy overrides should take. 5947 // Cache policy overrides should take.
5948 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), WebHisto ryDifferentDocumentLoad, WebURLRequest::ReloadIgnoringCacheData); 5948 FrameTestHelpers::loadHistoryItem(frame, WebHistoryItem(firstItem), WebHisto ryDifferentDocumentLoad, WebURLRequest::ReloadIgnoringCacheData);
5949 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem()); 5949 EXPECT_EQ(firstItem.get(), mainFrameLoader.currentItem());
5950 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().cachePolicy()); 5950 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque st().getCachePolicy());
5951 } 5951 }
5952 5952
5953 5953
5954 class TestCachePolicyWebFrameClient : public FrameTestHelpers::TestWebFrameClien t { 5954 class TestCachePolicyWebFrameClient : public FrameTestHelpers::TestWebFrameClien t {
5955 public: 5955 public:
5956 explicit TestCachePolicyWebFrameClient(TestCachePolicyWebFrameClient* parent Client) 5956 explicit TestCachePolicyWebFrameClient(TestCachePolicyWebFrameClient* parent Client)
5957 : m_parentClient(parentClient) 5957 : m_parentClient(parentClient)
5958 , m_policy(WebURLRequest::UseProtocolCachePolicy) 5958 , m_policy(WebURLRequest::UseProtocolCachePolicy)
5959 , m_childClient(0) 5959 , m_childClient(0)
5960 , m_willSendRequestCallCount(0) 5960 , m_willSendRequestCallCount(0)
5961 , m_childFrameCreationCount(0) 5961 , m_childFrameCreationCount(0)
5962 { 5962 {
5963 } 5963 }
5964 5964
5965 void setChildWebFrameClient(TestCachePolicyWebFrameClient* client) { m_child Client = client; } 5965 void setChildWebFrameClient(TestCachePolicyWebFrameClient* client) { m_child Client = client; }
5966 WebURLRequest::CachePolicy cachePolicy() const { return m_policy; } 5966 WebURLRequest::CachePolicy getCachePolicy() const { return m_policy; }
5967 int willSendRequestCallCount() const { return m_willSendRequestCallCount; } 5967 int willSendRequestCallCount() const { return m_willSendRequestCallCount; }
5968 int childFrameCreationCount() const { return m_childFrameCreationCount; } 5968 int childFrameCreationCount() const { return m_childFrameCreationCount; }
5969 5969
5970 virtual WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType s cope, const WebString&, const WebString&, WebSandboxFlags, const WebFrameOwnerPr operties& frameOwnerProperties) 5970 virtual WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType s cope, const WebString&, const WebString&, WebSandboxFlags, const WebFrameOwnerPr operties& frameOwnerProperties)
5971 { 5971 {
5972 ASSERT(m_childClient); 5972 ASSERT(m_childClient);
5973 m_childFrameCreationCount++; 5973 m_childFrameCreationCount++;
5974 WebFrame* frame = WebLocalFrame::create(scope, m_childClient); 5974 WebFrame* frame = WebLocalFrame::create(scope, m_childClient);
5975 parent->appendChild(frame); 5975 parent->appendChild(frame);
5976 return frame; 5976 return frame;
(...skipping 12 matching lines...) Expand all
5989 { 5989 {
5990 if (m_parentClient) { 5990 if (m_parentClient) {
5991 m_parentClient->didStopLoading(); 5991 m_parentClient->didStopLoading();
5992 return; 5992 return;
5993 } 5993 }
5994 TestWebFrameClient::didStopLoading(); 5994 TestWebFrameClient::didStopLoading();
5995 } 5995 }
5996 5996
5997 void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) override 5997 void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) override
5998 { 5998 {
5999 m_policy = request.cachePolicy(); 5999 m_policy = request.getCachePolicy();
6000 m_willSendRequestCallCount++; 6000 m_willSendRequestCallCount++;
6001 } 6001 }
6002 6002
6003 private: 6003 private:
6004 TestCachePolicyWebFrameClient* m_parentClient; 6004 TestCachePolicyWebFrameClient* m_parentClient;
6005 6005
6006 WebURLRequest::CachePolicy m_policy; 6006 WebURLRequest::CachePolicy m_policy;
6007 TestCachePolicyWebFrameClient* m_childClient; 6007 TestCachePolicyWebFrameClient* m_childClient;
6008 int m_willSendRequestCallCount; 6008 int m_willSendRequestCallCount;
6009 int m_childFrameCreationCount; 6009 int m_childFrameCreationCount;
6010 }; 6010 };
6011 6011
6012 TEST_P(ParameterizedWebFrameTest, ReloadIframe) 6012 TEST_P(ParameterizedWebFrameTest, ReloadIframe)
6013 { 6013 {
6014 registerMockedHttpURLLoad("iframe_reload.html"); 6014 registerMockedHttpURLLoad("iframe_reload.html");
6015 registerMockedHttpURLLoad("visible_iframe.html"); 6015 registerMockedHttpURLLoad("visible_iframe.html");
6016 TestCachePolicyWebFrameClient mainClient(0); 6016 TestCachePolicyWebFrameClient mainClient(0);
6017 TestCachePolicyWebFrameClient childClient(&mainClient); 6017 TestCachePolicyWebFrameClient childClient(&mainClient);
6018 mainClient.setChildWebFrameClient(&childClient); 6018 mainClient.setChildWebFrameClient(&childClient);
6019 6019
6020 FrameTestHelpers::WebViewHelper webViewHelper(this); 6020 FrameTestHelpers::WebViewHelper webViewHelper(this);
6021 webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, &mai nClient); 6021 webViewHelper.initializeAndLoad(m_baseURL + "iframe_reload.html", true, &mai nClient);
6022 6022
6023 WebLocalFrameImpl* mainFrame = webViewHelper.webViewImpl()->mainFrameImpl(); 6023 WebLocalFrameImpl* mainFrame = webViewHelper.webViewImpl()->mainFrameImpl();
6024 RefPtrWillBeRawPtr<WebLocalFrameImpl> childFrame = toWebLocalFrameImpl(mainF rame->firstChild()); 6024 RefPtrWillBeRawPtr<WebLocalFrameImpl> childFrame = toWebLocalFrameImpl(mainF rame->firstChild());
6025 ASSERT_EQ(childFrame->client(), &childClient); 6025 ASSERT_EQ(childFrame->client(), &childClient);
6026 EXPECT_EQ(mainClient.childFrameCreationCount(), 1); 6026 EXPECT_EQ(mainClient.childFrameCreationCount(), 1);
6027 EXPECT_EQ(childClient.willSendRequestCallCount(), 1); 6027 EXPECT_EQ(childClient.willSendRequestCallCount(), 1);
6028 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::UseProtocolCachePolicy); 6028 EXPECT_EQ(childClient.getCachePolicy(), WebURLRequest::UseProtocolCachePolic y);
6029 6029
6030 FrameTestHelpers::reloadFrame(mainFrame); 6030 FrameTestHelpers::reloadFrame(mainFrame);
6031 6031
6032 // A new WebFrame should have been created, but the child WebFrameClient sho uld be reused. 6032 // A new WebFrame should have been created, but the child WebFrameClient sho uld be reused.
6033 ASSERT_NE(childFrame, toWebLocalFrameImpl(mainFrame->firstChild())); 6033 ASSERT_NE(childFrame, toWebLocalFrameImpl(mainFrame->firstChild()));
6034 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie nt); 6034 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie nt);
6035 6035
6036 EXPECT_EQ(mainClient.childFrameCreationCount(), 2); 6036 EXPECT_EQ(mainClient.childFrameCreationCount(), 2);
6037 EXPECT_EQ(childClient.willSendRequestCallCount(), 2); 6037 EXPECT_EQ(childClient.willSendRequestCallCount(), 2);
6038 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::ReloadIgnoringCacheData) ; 6038 EXPECT_EQ(childClient.getCachePolicy(), WebURLRequest::ReloadIgnoringCacheDa ta);
6039 } 6039 }
6040 6040
6041 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt { 6041 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt {
6042 public: 6042 public:
6043 TestSameDocumentWebFrameClient() 6043 TestSameDocumentWebFrameClient()
6044 : m_frameLoadTypeSameSeen(false) 6044 : m_frameLoadTypeSameSeen(false)
6045 { 6045 {
6046 } 6046 }
6047 6047
6048 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&) 6048 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&)
(...skipping 27 matching lines...) Expand all
6076 public: 6076 public:
6077 TestSameDocumentWithImageWebFrameClient() 6077 TestSameDocumentWithImageWebFrameClient()
6078 : m_numOfImageRequests(0) 6078 : m_numOfImageRequests(0)
6079 { 6079 {
6080 } 6080 }
6081 6081
6082 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) 6082 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&)
6083 { 6083 {
6084 if (request.requestContext() == WebURLRequest::RequestContextImage) { 6084 if (request.requestContext() == WebURLRequest::RequestContextImage) {
6085 m_numOfImageRequests++; 6085 m_numOfImageRequests++;
6086 EXPECT_EQ(WebURLRequest::UseProtocolCachePolicy, request.cachePolicy ()); 6086 EXPECT_EQ(WebURLRequest::UseProtocolCachePolicy, request.getCachePol icy());
6087 } 6087 }
6088 } 6088 }
6089 6089
6090 int numOfImageRequests() const { return m_numOfImageRequests; } 6090 int numOfImageRequests() const { return m_numOfImageRequests; }
6091 6091
6092 private: 6092 private:
6093 int m_numOfImageRequests; 6093 int m_numOfImageRequests;
6094 }; 6094 };
6095 6095
6096 TEST_P(ParameterizedWebFrameTest, NavigateToSameNoConditionalRequestForSubresour ce) 6096 TEST_P(ParameterizedWebFrameTest, NavigateToSameNoConditionalRequestForSubresour ce)
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
6869 6869
6870 TEST_P(ParameterizedWebFrameTest, ReloadBypassingCache) 6870 TEST_P(ParameterizedWebFrameTest, ReloadBypassingCache)
6871 { 6871 {
6872 // Check that a reload ignoring cache on a frame will result in the cache 6872 // Check that a reload ignoring cache on a frame will result in the cache
6873 // policy of the request being set to ReloadBypassingCache. 6873 // policy of the request being set to ReloadBypassingCache.
6874 registerMockedHttpURLLoad("foo.html"); 6874 registerMockedHttpURLLoad("foo.html");
6875 FrameTestHelpers::WebViewHelper webViewHelper(this); 6875 FrameTestHelpers::WebViewHelper webViewHelper(this);
6876 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true); 6876 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true);
6877 WebFrame* frame = webViewHelper.webView()->mainFrame(); 6877 WebFrame* frame = webViewHelper.webView()->mainFrame();
6878 FrameTestHelpers::reloadFrameIgnoringCache(frame); 6878 FrameTestHelpers::reloadFrameIgnoringCache(frame);
6879 EXPECT_EQ(WebURLRequest::ReloadBypassingCache, frame->dataSource()->request( ).cachePolicy()); 6879 EXPECT_EQ(WebURLRequest::ReloadBypassingCache, frame->dataSource()->request( ).getCachePolicy());
6880 } 6880 }
6881 6881
6882 static void nodeImageTestValidation(const IntSize& referenceBitmapSize, DragImag e* dragImage) 6882 static void nodeImageTestValidation(const IntSize& referenceBitmapSize, DragImag e* dragImage)
6883 { 6883 {
6884 // Prepare the reference bitmap. 6884 // Prepare the reference bitmap.
6885 SkBitmap bitmap; 6885 SkBitmap bitmap;
6886 bitmap.allocN32Pixels(referenceBitmapSize.width(), referenceBitmapSize.heigh t()); 6886 bitmap.allocN32Pixels(referenceBitmapSize.width(), referenceBitmapSize.heigh t());
6887 SkCanvas canvas(bitmap); 6887 SkCanvas canvas(bitmap);
6888 canvas.drawColor(SK_ColorGREEN); 6888 canvas.drawColor(SK_ColorGREEN);
6889 6889
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
8481 } 8481 }
8482 8482
8483 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) 8483 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange)
8484 { 8484 {
8485 swapLocalFrameToRemoteFrame(); 8485 swapLocalFrameToRemoteFrame();
8486 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p arentElement.style.display = 'none';")); 8486 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p arentElement.style.display = 'none';"));
8487 EXPECT_FALSE(remoteFrameClient()->isVisible()); 8487 EXPECT_FALSE(remoteFrameClient()->isVisible());
8488 } 8488 }
8489 8489
8490 } // namespace blink 8490 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698