2011-04-05 Sheriff Bot <webkit.review.bot@gmail.com>

        Unreviewed, rolling out r83007.
        http://trac.webkit.org/changeset/83007
        https://bugs.webkit.org/show_bug.cgi?id=57920

        Broke WebFrameTest.FrameForEnteredContext on Chromium-win and
        Chromium-mac (Requested by tkent on #webkit).

        * WebKit.gyp:
        * WebKit.gypi:
        * public/WebFrame.h:
        * src/WebFrameImpl.cpp:
        * tests/WebFrameTest.cpp:
        (WebKit::WebFrameTest::WebFrameTest):
        (WebKit::WebFrameTest::registerMockedURLLoad):
        (WebKit::WebFrameTest::serveRequests):
        (WebKit::TEST_F):

git-svn-id: svn://svn.chromium.org/blink/trunk@83021 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1986512d
2011-04-05 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r83007.
http://trac.webkit.org/changeset/83007
https://bugs.webkit.org/show_bug.cgi?id=57920
Broke WebFrameTest.FrameForEnteredContext on Chromium-win and
Chromium-mac (Requested by tkent on #webkit).
* WebKit.gyp:
* WebKit.gypi:
* public/WebFrame.h:
* src/WebFrameImpl.cpp:
* tests/WebFrameTest.cpp:
(WebKit::WebFrameTest::WebFrameTest):
(WebKit::WebFrameTest::registerMockedURLLoad):
(WebKit::WebFrameTest::serveRequests):
(WebKit::TEST_F):
2011-04-05 James Kozianski <koz@chromium.org> 2011-04-05 James Kozianski <koz@chromium.org>
Unreviewed, rolling out r82976. Unreviewed, rolling out r82976.
......
...@@ -815,10 +815,11 @@ ...@@ -815,10 +815,11 @@
'conditions': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
'sources': [ 'sources': [
# FIXME: Port PopupMenuTest to Linux and Mac. # FIXME: Port PopupMenuTest and WebFrameTest to Linux and Mac.
'tests/PopupMenuTest.cpp', 'tests/PopupMenuTest.cpp',
'tests/TransparencyWinTest.cpp', 'tests/TransparencyWinTest.cpp',
'tests/UniscribeHelperTest.cpp', 'tests/UniscribeHelperTest.cpp',
'tests/WebFrameTest.cpp',
'tests/WebPageSerializerTest.cpp', 'tests/WebPageSerializerTest.cpp',
], ],
}], }],
......
...@@ -64,7 +64,6 @@ ...@@ -64,7 +64,6 @@
'tests/TilingDataTest.cpp', 'tests/TilingDataTest.cpp',
'tests/TreeTestHelpers.cpp', 'tests/TreeTestHelpers.cpp',
'tests/TreeTestHelpers.h', 'tests/TreeTestHelpers.h',
'tests/WebFrameTest.cpp',
], ],
}, },
} }
......
...@@ -97,13 +97,6 @@ public: ...@@ -97,13 +97,6 @@ public:
WEBKIT_API static WebFrame* frameForEnteredContext(); WEBKIT_API static WebFrame* frameForEnteredContext();
WEBKIT_API static WebFrame* frameForCurrentContext(); WEBKIT_API static WebFrame* frameForCurrentContext();
#if WEBKIT_USING_V8
// Returns the frame corresponding to the given context. This can return 0
// if the context is detached from the frame, or if the context doesn't
// correspond to a frame (e.g., workers).
WEBKIT_API static WebFrame* frameForContext(v8::Handle<v8::Context>);
#endif
// Returns the frame inside a given frame or iframe element. Returns 0 if // Returns the frame inside a given frame or iframe element. Returns 0 if
// the given element is not a frame, iframe or if the frame is empty. // the given element is not a frame, iframe or if the frame is empty.
WEBKIT_API static WebFrame* fromFrameOwnerElement(const WebElement&); WEBKIT_API static WebFrame* fromFrameOwnerElement(const WebElement&);
......
...@@ -473,13 +473,6 @@ WebFrame* WebFrame::frameForCurrentContext() ...@@ -473,13 +473,6 @@ WebFrame* WebFrame::frameForCurrentContext()
return WebFrameImpl::fromFrame(frame); return WebFrameImpl::fromFrame(frame);
} }
#if WEBKIT_USING_V8
WebFrame* WebFrame::frameForContext(v8::Handle<v8::Context> context)
{
return WebFrameImpl::fromFrame(V8Proxy::retrieveFrame(context));
}
#endif
WebFrame* WebFrame::fromFrameOwnerElement(const WebElement& element) WebFrame* WebFrame::fromFrameOwnerElement(const WebElement& element)
{ {
return WebFrameImpl::fromFrameOwnerElement( return WebFrameImpl::fromFrameOwnerElement(
......
...@@ -35,13 +35,11 @@ ...@@ -35,13 +35,11 @@
#include <webkit/support/webkit_support.h> #include <webkit/support/webkit_support.h>
#include "WebFrame.h" #include "WebFrame.h"
#include "WebFrameClient.h" #include "WebFrameClient.h"
#include "WebSettings.h"
#include "WebString.h" #include "WebString.h"
#include "WebURL.h" #include "WebURL.h"
#include "WebURLRequest.h" #include "WebURLRequest.h"
#include "WebURLResponse.h" #include "WebURLResponse.h"
#include "WebView.h" #include "WebView.h"
#include "v8.h"
using namespace WebKit; using namespace WebKit;
...@@ -49,44 +47,25 @@ namespace { ...@@ -49,44 +47,25 @@ namespace {
class WebFrameTest : public testing::Test { class WebFrameTest : public testing::Test {
public: public:
WebFrameTest() WebFrameTest() {}
: baseURL("http://www.test.com/")
{
}
virtual void TearDown() virtual void TearDown()
{ {
webkit_support::UnregisterAllMockedURLs(); webkit_support::UnregisterAllMockedURLs();
} }
void registerMockedURLLoad(const std::string& fileName) void registerMockedURLLoad(const WebURL& url, const WebURLResponse& response, const WebString& fileName)
{ {
WebURLResponse response;
response.initialize();
response.setMIMEType("text/html");
std::string filePath = webkit_support::GetWebKitRootDir().utf8(); std::string filePath = webkit_support::GetWebKitRootDir().utf8();
filePath += "/Source/WebKit/chromium/tests/data/"; filePath.append("/Source/WebKit/chromium/tests/data/");
filePath += fileName; filePath.append(fileName.utf8());
webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath));
webkit_support::RegisterMockedURL(WebURL(GURL(baseURL + fileName)), response, WebString::fromUTF8(filePath));
} }
void serveRequests() void serveRequests()
{ {
webkit_support::ServeAsynchronousMockedRequests(); webkit_support::ServeAsynchronousMockedRequests();
} }
void loadFrame(WebFrame* frame, const std::string& fileName)
{
WebURLRequest urlRequest;
urlRequest.initialize();
urlRequest.setURL(WebURL(GURL(baseURL + fileName)));
frame->loadRequest(urlRequest);
}
protected:
std::string baseURL;
}; };
class TestWebFrameClient : public WebFrameClient { class TestWebFrameClient : public WebFrameClient {
...@@ -94,17 +73,31 @@ class TestWebFrameClient : public WebFrameClient { ...@@ -94,17 +73,31 @@ class TestWebFrameClient : public WebFrameClient {
TEST_F(WebFrameTest, ContentText) TEST_F(WebFrameTest, ContentText)
{ {
registerMockedURLLoad("iframes_test.html"); // Register our resources.
registerMockedURLLoad("visible_iframe.html"); WebURLResponse response;
registerMockedURLLoad("invisible_iframe.html"); response.initialize();
registerMockedURLLoad("zero_sized_iframe.html"); response.setMIMEType("text/html");
std::string rootURL = "http://www.test.com/";
const char* files[] = { "iframes_test.html", "visible_iframe.html",
"invisible_iframe.html", "zero_sized_iframe.html" };
for (int i = 0; i < (sizeof(files) / sizeof(char*)); ++i) {
WebURL webURL = GURL(rootURL + files[i]);
registerMockedURLLoad(webURL, response, WebString::fromUTF8(files[i]));
}
// Create and initialize the WebView. // Create and initialize the WebView.
TestWebFrameClient webFrameClient; TestWebFrameClient webFrameClient;
WebView* webView = WebView::create(0); WebView* webView = WebView::create(0);
webView->initializeMainFrame(&webFrameClient); webView->initializeMainFrame(&webFrameClient);
loadFrame(webView->mainFrame(), "iframes_test.html"); // Load the main frame URL.
WebURL testURL(GURL(rootURL + files[0]));
WebURLRequest urlRequest;
urlRequest.initialize();
urlRequest.setURL(testURL);
webView->mainFrame()->loadRequest(urlRequest);
// Load all pending asynchronous requests.
serveRequests(); serveRequests();
// Now retrieve the frames text and test it only includes visible elements. // Now retrieve the frames text and test it only includes visible elements.
...@@ -118,31 +111,4 @@ TEST_F(WebFrameTest, ContentText) ...@@ -118,31 +111,4 @@ TEST_F(WebFrameTest, ContentText)
webView->close(); webView->close();
} }
TEST_F(WebFrameTest, FrameForEnteredContext)
{
registerMockedURLLoad("iframes_test.html");
registerMockedURLLoad("visible_iframe.html");
registerMockedURLLoad("invisible_iframe.html");
registerMockedURLLoad("zero_sized_iframe.html");
// Create and initialize the WebView.
TestWebFrameClient webFrameClient;
WebView* webView = WebView::create(0);
webView->settings()->setJavaScriptEnabled(true);
webView->initializeMainFrame(&webFrameClient);
loadFrame(webView->mainFrame(), "iframes_test.html");
serveRequests();
v8::HandleScope scope;
EXPECT_EQ(webView->mainFrame(),
WebFrame::frameForContext(
webView->mainFrame()->mainWorldScriptContext()));
EXPECT_EQ(webView->mainFrame()->firstChild(),
WebFrame::frameForContext(
webView->mainFrame()->firstChild()->mainWorldScriptContext()));
webView->close();
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment