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

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

Issue 1480043002: [WIP] Call WebTestProxyBase::CheckDone() in didStopLoading() Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 10 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 5869 matching lines...) Expand 10 before | Expand all | Expand 10 after
5880 , m_willSendRequestCallCount(0) 5880 , m_willSendRequestCallCount(0)
5881 , m_childFrameCreationCount(0) 5881 , m_childFrameCreationCount(0)
5882 { 5882 {
5883 } 5883 }
5884 5884
5885 void setChildWebFrameClient(TestCachePolicyWebFrameClient* client) { m_child Client = client; } 5885 void setChildWebFrameClient(TestCachePolicyWebFrameClient* client) { m_child Client = client; }
5886 WebURLRequest::CachePolicy cachePolicy() const { return m_policy; } 5886 WebURLRequest::CachePolicy cachePolicy() const { return m_policy; }
5887 int willSendRequestCallCount() const { return m_willSendRequestCallCount; } 5887 int willSendRequestCallCount() const { return m_willSendRequestCallCount; }
5888 int childFrameCreationCount() const { return m_childFrameCreationCount; } 5888 int childFrameCreationCount() const { return m_childFrameCreationCount; }
5889 5889
5890 virtual WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType s cope, const WebString&, WebSandboxFlags, const WebFrameOwnerProperties& frameOwn erProperties) 5890 WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, co nst WebString&, WebSandboxFlags, const WebFrameOwnerProperties& frameOwnerProper ties) override
5891 { 5891 {
5892 ASSERT(m_childClient); 5892 ASSERT(m_childClient);
5893 m_childFrameCreationCount++; 5893 m_childFrameCreationCount++;
5894 WebFrame* frame = WebLocalFrame::create(scope, m_childClient); 5894 WebFrame* frame = WebLocalFrame::create(scope, m_childClient);
5895 parent->appendChild(frame); 5895 parent->appendChild(frame);
5896 return frame; 5896 return frame;
5897 } 5897 }
5898 5898
5899 virtual void didStartLoading(bool toDifferentDocument) 5899 void didStartLoading(bool toDifferentDocument) override
5900 { 5900 {
5901 if (m_parentClient) { 5901 if (m_parentClient) {
5902 m_parentClient->didStartLoading(toDifferentDocument); 5902 m_parentClient->didStartLoading(toDifferentDocument);
5903 return; 5903 return;
5904 } 5904 }
5905 TestWebFrameClient::didStartLoading(toDifferentDocument); 5905 TestWebFrameClient::didStartLoading(toDifferentDocument);
5906 } 5906 }
5907 5907
5908 virtual void didStopLoading() 5908 void didStopLoading(WebLocalFrame* frame) override
5909 { 5909 {
5910 if (m_parentClient) { 5910 if (m_parentClient) {
5911 m_parentClient->didStopLoading(); 5911 m_parentClient->didStopLoading(frame);
5912 return; 5912 return;
5913 } 5913 }
5914 TestWebFrameClient::didStopLoading(); 5914 TestWebFrameClient::didStopLoading(frame);
5915 } 5915 }
5916 5916
5917 void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) override 5917 void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) override
5918 { 5918 {
5919 m_policy = request.cachePolicy(); 5919 m_policy = request.cachePolicy();
5920 m_willSendRequestCallCount++; 5920 m_willSendRequestCallCount++;
5921 } 5921 }
5922 5922
5923 private: 5923 private:
5924 TestCachePolicyWebFrameClient* m_parentClient; 5924 TestCachePolicyWebFrameClient* m_parentClient;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5958 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::ReloadIgnoringCacheData) ; 5958 EXPECT_EQ(childClient.cachePolicy(), WebURLRequest::ReloadIgnoringCacheData) ;
5959 } 5959 }
5960 5960
5961 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt { 5961 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt {
5962 public: 5962 public:
5963 TestSameDocumentWebFrameClient() 5963 TestSameDocumentWebFrameClient()
5964 : m_frameLoadTypeSameSeen(false) 5964 : m_frameLoadTypeSameSeen(false)
5965 { 5965 {
5966 } 5966 }
5967 5967
5968 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&) 5968 void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const W ebURLResponse&) override
5969 { 5969 {
5970 if (toWebLocalFrameImpl(frame)->frame()->loader().loadType() == FrameLoa dTypeSame) 5970 if (toWebLocalFrameImpl(frame)->frame()->loader().loadType() == FrameLoa dTypeSame)
5971 m_frameLoadTypeSameSeen = true; 5971 m_frameLoadTypeSameSeen = true;
5972 } 5972 }
5973 5973
5974 bool frameLoadTypeSameSeen() const { return m_frameLoadTypeSameSeen; } 5974 bool frameLoadTypeSameSeen() const { return m_frameLoadTypeSameSeen; }
5975 5975
5976 private: 5976 private:
5977 bool m_frameLoadTypeSameSeen; 5977 bool m_frameLoadTypeSameSeen;
5978 }; 5978 };
(...skipping 13 matching lines...) Expand all
5992 EXPECT_TRUE(client.frameLoadTypeSameSeen()); 5992 EXPECT_TRUE(client.frameLoadTypeSameSeen());
5993 } 5993 }
5994 5994
5995 class TestSameDocumentWithImageWebFrameClient : public FrameTestHelpers::TestWeb FrameClient { 5995 class TestSameDocumentWithImageWebFrameClient : public FrameTestHelpers::TestWeb FrameClient {
5996 public: 5996 public:
5997 TestSameDocumentWithImageWebFrameClient() 5997 TestSameDocumentWithImageWebFrameClient()
5998 : m_numOfImageRequests(0) 5998 : m_numOfImageRequests(0)
5999 { 5999 {
6000 } 6000 }
6001 6001
6002 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) 6002 void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) override
6003 { 6003 {
6004 if (request.requestContext() == WebURLRequest::RequestContextImage) { 6004 if (request.requestContext() == WebURLRequest::RequestContextImage) {
6005 m_numOfImageRequests++; 6005 m_numOfImageRequests++;
6006 EXPECT_EQ(WebURLRequest::UseProtocolCachePolicy, request.cachePolicy ()); 6006 EXPECT_EQ(WebURLRequest::UseProtocolCachePolicy, request.cachePolicy ());
6007 } 6007 }
6008 } 6008 }
6009 6009
6010 int numOfImageRequests() const { return m_numOfImageRequests; } 6010 int numOfImageRequests() const { return m_numOfImageRequests; }
6011 6011
6012 private: 6012 private:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
6063 } 6063 }
6064 6064
6065 void didStartLoading(bool toDifferentDocument) override 6065 void didStartLoading(bool toDifferentDocument) override
6066 { 6066 {
6067 TestWebFrameClient::didStartLoading(toDifferentDocument); 6067 TestWebFrameClient::didStartLoading(toDifferentDocument);
6068 m_startLoadingCount++; 6068 m_startLoadingCount++;
6069 if (toDifferentDocument) 6069 if (toDifferentDocument)
6070 m_differentDocumentStartCount++; 6070 m_differentDocumentStartCount++;
6071 } 6071 }
6072 6072
6073 void didStopLoading() override 6073 void didStopLoading(WebLocalFrame* frame) override
6074 { 6074 {
6075 TestWebFrameClient::didStopLoading(); 6075 TestWebFrameClient::didStopLoading(frame);
6076 m_stopLoadingCount++; 6076 m_stopLoadingCount++;
6077 } 6077 }
6078 6078
6079 int startLoadingCount() const { return m_startLoadingCount; } 6079 int startLoadingCount() const { return m_startLoadingCount; }
6080 int stopLoadingCount() const { return m_stopLoadingCount; } 6080 int stopLoadingCount() const { return m_stopLoadingCount; }
6081 int differentDocumentStartCount() const { return m_differentDocumentStartCou nt; } 6081 int differentDocumentStartCount() const { return m_differentDocumentStartCou nt; }
6082 6082
6083 private: 6083 private:
6084 int m_startLoadingCount; 6084 int m_startLoadingCount;
6085 int m_stopLoadingCount; 6085 int m_stopLoadingCount;
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
6882 { 6882 {
6883 m_didNotify = false; 6883 m_didNotify = false;
6884 } 6884 }
6885 6885
6886 bool didNotify() const 6886 bool didNotify() const
6887 { 6887 {
6888 return m_didNotify; 6888 return m_didNotify;
6889 } 6889 }
6890 6890
6891 private: 6891 private:
6892 virtual void didChangeThemeColor() 6892 void didChangeThemeColor() override
6893 { 6893 {
6894 m_didNotify = true; 6894 m_didNotify = true;
6895 } 6895 }
6896 6896
6897 bool m_didNotify; 6897 bool m_didNotify;
6898 }; 6898 };
6899 6899
6900 TEST_P(ParameterizedWebFrameTest, ThemeColor) 6900 TEST_P(ParameterizedWebFrameTest, ThemeColor)
6901 { 6901 {
6902 registerMockedHttpURLLoad("theme_color_test.html"); 6902 registerMockedHttpURLLoad("theme_color_test.html");
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
7770 view->setMainFrame(remoteClient.frame()); 7770 view->setMainFrame(remoteClient.frame());
7771 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; 7771 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient;
7772 WebRemoteFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createRe moteChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClie nt); 7772 WebRemoteFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createRe moteChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClie nt);
7773 childFrame->detach(); 7773 childFrame->detach();
7774 view->close(); 7774 view->close();
7775 childFrame->close(); 7775 childFrame->close();
7776 } 7776 }
7777 7777
7778 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl ient { 7778 class TestConsoleMessageWebFrameClient : public FrameTestHelpers::TestWebFrameCl ient {
7779 public: 7779 public:
7780 virtual void didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine, const WebString& stackTrace) 7780 void didAddMessageToConsole(const WebConsoleMessage& message, const WebStrin g& sourceName, unsigned sourceLine, const WebString& stackTrace) override
7781 { 7781 {
7782 messages.append(message); 7782 messages.append(message);
7783 } 7783 }
7784 7784
7785 Vector<WebConsoleMessage> messages; 7785 Vector<WebConsoleMessage> messages;
7786 }; 7786 };
7787 7787
7788 TEST_P(ParameterizedWebFrameTest, CrossDomainAccessErrorsUseCallingWindow) 7788 TEST_P(ParameterizedWebFrameTest, CrossDomainAccessErrorsUseCallingWindow)
7789 { 7789 {
7790 registerMockedHttpURLLoad("hidden_frames.html"); 7790 registerMockedHttpURLLoad("hidden_frames.html");
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
8319 void didStartLoading(bool toDifferentDocument) override 8319 void didStartLoading(bool toDifferentDocument) override
8320 { 8320 {
8321 EXPECT_EQ(0, m_callbackCount++); 8321 EXPECT_EQ(0, m_callbackCount++);
8322 FrameTestHelpers::TestWebFrameClient::didStartLoading(toDifferentDocumen t); 8322 FrameTestHelpers::TestWebFrameClient::didStartLoading(toDifferentDocumen t);
8323 } 8323 }
8324 void didStartProvisionalLoad(WebLocalFrame*, double) override { EXPECT_EQ(1, m_callbackCount++); } 8324 void didStartProvisionalLoad(WebLocalFrame*, double) override { EXPECT_EQ(1, m_callbackCount++); }
8325 void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&, WebHist oryCommitType) override { EXPECT_EQ(2, m_callbackCount++); } 8325 void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&, WebHist oryCommitType) override { EXPECT_EQ(2, m_callbackCount++); }
8326 void didFinishDocumentLoad(WebLocalFrame*, bool documentIsEmpty) override { EXPECT_EQ(3, m_callbackCount++); } 8326 void didFinishDocumentLoad(WebLocalFrame*, bool documentIsEmpty) override { EXPECT_EQ(3, m_callbackCount++); }
8327 void didHandleOnloadEvents(WebLocalFrame*) override { EXPECT_EQ(4, m_callbac kCount++); } 8327 void didHandleOnloadEvents(WebLocalFrame*) override { EXPECT_EQ(4, m_callbac kCount++); }
8328 void didFinishLoad(WebLocalFrame*) override { EXPECT_EQ(5, m_callbackCount++ ); } 8328 void didFinishLoad(WebLocalFrame*) override { EXPECT_EQ(5, m_callbackCount++ ); }
8329 void didStopLoading() override 8329 void didStopLoading(WebLocalFrame* frame) override
8330 { 8330 {
8331 EXPECT_EQ(6, m_callbackCount++); 8331 EXPECT_EQ(6, m_callbackCount++);
8332 FrameTestHelpers::TestWebFrameClient::didStopLoading(); 8332 FrameTestHelpers::TestWebFrameClient::didStopLoading(frame);
8333 } 8333 }
8334 8334
8335 private: 8335 private:
8336 int m_callbackCount; 8336 int m_callbackCount;
8337 }; 8337 };
8338 8338
8339 TEST_F(WebFrameTest, CallbackOrdering) 8339 TEST_F(WebFrameTest, CallbackOrdering)
8340 { 8340 {
8341 registerMockedHttpURLLoad("foo.html"); 8341 registerMockedHttpURLLoad("foo.html");
8342 FrameTestHelpers::WebViewHelper webViewHelper; 8342 FrameTestHelpers::WebViewHelper webViewHelper;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
8407 } 8407 }
8408 8408
8409 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange) 8409 TEST_F(WebFrameVisibilityChangeTest, RemoteFrameParentVisibilityChange)
8410 { 8410 {
8411 swapLocalFrameToRemoteFrame(); 8411 swapLocalFrameToRemoteFrame();
8412 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p arentElement.style.display = 'none';")); 8412 executeScriptOnMainFrame(WebScriptSource("document.querySelector('iframe').p arentElement.style.display = 'none';"));
8413 EXPECT_FALSE(remoteFrameClient()->isVisible()); 8413 EXPECT_FALSE(remoteFrameClient()->isVisible());
8414 } 8414 }
8415 8415
8416 } // namespace blink 8416 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp ('k') | third_party/WebKit/public/web/WebFrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698