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

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

Issue 1975753006: Pull to refresh: Use new reload type RELOAD_MAIN_RESOURCE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #14 and #16 Created 4 years, 7 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 6046 matching lines...) Expand 10 before | Expand all | Expand 10 after
6057 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie nt); 6057 ASSERT_EQ(toWebLocalFrameImpl(mainFrame->firstChild())->client(), &childClie nt);
6058 6058
6059 EXPECT_EQ(mainClient.childFrameCreationCount(), 2); 6059 EXPECT_EQ(mainClient.childFrameCreationCount(), 2);
6060 EXPECT_EQ(childClient.willSendRequestCallCount(), 2); 6060 EXPECT_EQ(childClient.willSendRequestCallCount(), 2);
6061 EXPECT_EQ(childClient.getCachePolicy(), WebCachePolicy::ValidatingCacheData) ; 6061 EXPECT_EQ(childClient.getCachePolicy(), WebCachePolicy::ValidatingCacheData) ;
6062 } 6062 }
6063 6063
6064 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt { 6064 class TestSameDocumentWebFrameClient : public FrameTestHelpers::TestWebFrameClie nt {
6065 public: 6065 public:
6066 TestSameDocumentWebFrameClient() 6066 TestSameDocumentWebFrameClient()
6067 : m_frameLoadTypeSameSeen(false) 6067 : m_frameLoadTypeReloadMainResourceSeen(false)
6068 { 6068 {
6069 } 6069 }
6070 6070
6071 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&) 6071 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest&, const WebURLResponse&)
6072 { 6072 {
6073 if (toWebLocalFrameImpl(frame)->frame()->loader().loadType() == FrameLoa dTypeSame) 6073 if (toWebLocalFrameImpl(frame)->frame()->loader().loadType() == FrameLoa dTypeReloadMainResource)
6074 m_frameLoadTypeSameSeen = true; 6074 m_frameLoadTypeReloadMainResourceSeen = true;
6075 } 6075 }
6076 6076
6077 bool frameLoadTypeSameSeen() const { return m_frameLoadTypeSameSeen; } 6077 bool frameLoadTypeReloadMainResourceSeen() const { return m_frameLoadTypeRel oadMainResourceSeen; }
6078 6078
6079 private: 6079 private:
6080 bool m_frameLoadTypeSameSeen; 6080 bool m_frameLoadTypeReloadMainResourceSeen;
6081 }; 6081 };
6082 6082
6083 TEST_P(ParameterizedWebFrameTest, NavigateToSame) 6083 TEST_P(ParameterizedWebFrameTest, NavigateToSame)
6084 { 6084 {
6085 registerMockedHttpURLLoad("navigate_to_same.html"); 6085 registerMockedHttpURLLoad("navigate_to_same.html");
6086 TestSameDocumentWebFrameClient client; 6086 TestSameDocumentWebFrameClient client;
6087 FrameTestHelpers::WebViewHelper webViewHelper(this); 6087 FrameTestHelpers::WebViewHelper webViewHelper(this);
6088 webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html", true, & client); 6088 webViewHelper.initializeAndLoad(m_baseURL + "navigate_to_same.html", true, & client);
6089 EXPECT_FALSE(client.frameLoadTypeSameSeen()); 6089 EXPECT_FALSE(client.frameLoadTypeReloadMainResourceSeen());
6090 6090
6091 FrameLoadRequest frameRequest(0, ResourceRequest(toLocalFrame(webViewHelper. webViewImpl()->page()->mainFrame())->document()->url())); 6091 FrameLoadRequest frameRequest(0, ResourceRequest(toLocalFrame(webViewHelper. webViewImpl()->page()->mainFrame())->document()->url()));
6092 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa d(frameRequest); 6092 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa d(frameRequest);
6093 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()- >mainFrame()); 6093 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()- >mainFrame());
6094 6094
6095 EXPECT_TRUE(client.frameLoadTypeSameSeen()); 6095 EXPECT_TRUE(client.frameLoadTypeReloadMainResourceSeen());
6096 } 6096 }
6097 6097
6098 class TestSameDocumentWithImageWebFrameClient : public FrameTestHelpers::TestWeb FrameClient { 6098 class TestSameDocumentWithImageWebFrameClient : public FrameTestHelpers::TestWeb FrameClient {
6099 public: 6099 public:
6100 TestSameDocumentWithImageWebFrameClient() 6100 TestSameDocumentWithImageWebFrameClient()
6101 : m_numOfImageRequests(0) 6101 : m_numOfImageRequests(0)
6102 { 6102 {
6103 } 6103 }
6104 6104
6105 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&) 6105 virtual void willSendRequest(WebLocalFrame* frame, unsigned, WebURLRequest& request, const WebURLResponse&)
(...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after
8682 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); 8682 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame();
8683 v8::HandleScope scope(v8::Isolate::GetCurrent()); 8683 v8::HandleScope scope(v8::Isolate::GetCurrent());
8684 mainFrame->executeScript(WebScriptSource("hello = 'world';")); 8684 mainFrame->executeScript(WebScriptSource("hello = 'world';"));
8685 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); 8685 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page");
8686 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello")); 8686 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello"));
8687 ASSERT_TRUE(result->IsString()); 8687 ASSERT_TRUE(result->IsString());
8688 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked())); 8688 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked()));
8689 } 8689 }
8690 8690
8691 } // namespace blink 8691 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/AssertMatchingEnums.cpp ('k') | third_party/WebKit/public/web/WebFrameLoadType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698