mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-18 05:00:48 +01:00
Fix Mac compile errors.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@189 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
06a6f0ce7c
commit
0c0da498d0
@ -7,6 +7,8 @@
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "test_handler.h"
|
||||
|
||||
namespace {
|
||||
|
||||
bool g_V8TestV8HandlerExecuteCalled;
|
||||
bool g_V8TestV8HandlerExecute2Called;
|
||||
|
||||
@ -312,6 +314,8 @@ public:
|
||||
bool binding_test_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// Verify window binding
|
||||
TEST(V8Test, Binding)
|
||||
{
|
||||
@ -354,6 +358,8 @@ TEST(V8Test, Extension)
|
||||
ASSERT_TRUE(g_V8TestV8HandlerExecute2Called);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
// Using a delegate so that the code below can remain inline.
|
||||
class CefV8HandlerDelegate
|
||||
{
|
||||
@ -365,9 +371,6 @@ public:
|
||||
CefString& exception) = 0;
|
||||
};
|
||||
|
||||
// Verify context works to allow async v8 callbacks
|
||||
TEST(V8Test, Context)
|
||||
{
|
||||
class DelegatingV8Handler : public CefThreadSafeBase<CefV8Handler>
|
||||
{
|
||||
public:
|
||||
@ -530,8 +533,8 @@ TEST(V8Test, Context)
|
||||
CefRefPtr<CefV8Value> rv;
|
||||
CefString exception;
|
||||
CefRefPtr<CefV8Value> empty;
|
||||
ASSERT_TRUE(funcIFrame_->ExecuteFunctionWithContext(
|
||||
contextIFrame_, empty, args, rv, exception));
|
||||
ASSERT_TRUE(funcIFrame_->ExecuteFunctionWithContext(contextIFrame_, empty,
|
||||
args, rv, exception));
|
||||
}
|
||||
|
||||
void AsyncTestContext(CefRefPtr<CefV8Context> ec,
|
||||
@ -564,22 +567,20 @@ TEST(V8Test, Context)
|
||||
currentMainFrame->LoadURL("http://tests/begin.html");
|
||||
}
|
||||
|
||||
void AsyncTestException(
|
||||
CefRefPtr<CefV8Context> context,
|
||||
void AsyncTestException(CefRefPtr<CefV8Context> context,
|
||||
CefRefPtr<CefV8Value> func)
|
||||
{
|
||||
CefV8ValueList args;
|
||||
CefRefPtr<CefV8Value> rv;
|
||||
CefString exception;
|
||||
CefRefPtr<CefV8Value> empty;
|
||||
ASSERT_TRUE(func->ExecuteFunctionWithContext(
|
||||
context, empty, args, rv, exception));
|
||||
ASSERT_TRUE(func->ExecuteFunctionWithContext(context, empty, args, rv,
|
||||
exception));
|
||||
if(exception == "Uncaught My Exception")
|
||||
got_exception_.yes();
|
||||
}
|
||||
|
||||
void AsyncTestNavigation(
|
||||
CefRefPtr<CefV8Context> context,
|
||||
void AsyncTestNavigation(CefRefPtr<CefV8Context> context,
|
||||
CefRefPtr<CefV8Value> func)
|
||||
{
|
||||
CefV8ValueList args;
|
||||
@ -587,8 +588,8 @@ TEST(V8Test, Context)
|
||||
CefRefPtr<CefV8Value> rv;
|
||||
CefString exception;
|
||||
CefRefPtr<CefV8Value> global = context->GetGlobal();
|
||||
ASSERT_TRUE(func->ExecuteFunctionWithContext(
|
||||
context, global, args, rv, exception));
|
||||
ASSERT_TRUE(func->ExecuteFunctionWithContext(context, global, args, rv,
|
||||
exception));
|
||||
if(exception.empty())
|
||||
got_navigation_.yes();
|
||||
}
|
||||
@ -635,8 +636,7 @@ TEST(V8Test, Context)
|
||||
else
|
||||
return false;
|
||||
|
||||
if(got_hello_main_ && got_hello_iframe_ && funcIFrame_->IsFunction())
|
||||
{
|
||||
if(got_hello_main_ && got_hello_iframe_ && funcIFrame_->IsFunction()) {
|
||||
// NB: At this point, enteredURL == http://tests/iframe.html which is
|
||||
// expected since the iframe made the call on its own. The unexpected
|
||||
// behavior is that in the call to fromIFrame (below) the enteredURL
|
||||
@ -663,11 +663,9 @@ TEST(V8Test, Context)
|
||||
CefRefPtr<CefV8Value> funcException = arguments[0];
|
||||
CefRefPtr<CefV8Value> funcNavigate = arguments[1];
|
||||
CefPostTask(TID_UI, NewCefRunnableMethod(this,
|
||||
&TestContextHandler::AsyncTestException,
|
||||
cc, funcException));
|
||||
&TestContextHandler::AsyncTestException, cc, funcException));
|
||||
CefPostTask(TID_UI, NewCefRunnableMethod(this,
|
||||
&TestContextHandler::AsyncTestNavigation,
|
||||
cc, funcNavigate));
|
||||
&TestContextHandler::AsyncTestNavigation, cc, funcNavigate));
|
||||
return true;
|
||||
}
|
||||
} else if (name == "end") {
|
||||
@ -695,6 +693,11 @@ TEST(V8Test, Context)
|
||||
TrackCallback got_testcomplete_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// Verify context works to allow async v8 callbacks
|
||||
TEST(V8Test, Context)
|
||||
{
|
||||
CefRefPtr<TestContextHandler> handler = new TestContextHandler();
|
||||
handler->ExecuteTest();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user