当前位置: 首页>>代码示例>>C++>>正文


C++ V8TestingScope类代码示例

本文整理汇总了C++中V8TestingScope的典型用法代码示例。如果您正苦于以下问题:C++ V8TestingScope类的具体用法?C++ V8TestingScope怎么用?C++ V8TestingScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了V8TestingScope类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST

TEST(AnimationTimingInputTest, TimingInputEndDelay)
{
    V8TestingScope scope;
    bool ignoredSuccess;
    EXPECT_EQ(10, applyTimingInputNumber(scope.isolate(), "endDelay", 10000, ignoredSuccess).endDelay);
    EXPECT_EQ(-2.5, applyTimingInputNumber(scope.isolate(), "endDelay", -2500, ignoredSuccess).endDelay);
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,代码来源:TimingInputTest.cpp

示例2: TEST_F

TEST_F(PerformanceObserverTest, Enqueue) {
  V8TestingScope scope;
  initialize(scope.getScriptState());

  Persistent<PerformanceEntry> entry = PerformanceMark::create("m", 1234);
  EXPECT_EQ(0, numPerformanceEntries());

  m_observer->enqueuePerformanceEntry(*entry);
  EXPECT_EQ(1, numPerformanceEntries());
}
开发者ID:mirror,项目名称:chromium,代码行数:10,代码来源:PerformanceObserverTest.cpp

示例3: TEST_F

TEST_F(PerformanceBaseTest, Register) {
  V8TestingScope scope;
  initialize(scope.getScriptState());

  EXPECT_EQ(0, m_base->numObservers());
  EXPECT_EQ(0, m_base->numActiveObservers());

  m_base->registerPerformanceObserver(*m_observer.get());
  EXPECT_EQ(1, m_base->numObservers());
  EXPECT_EQ(0, m_base->numActiveObservers());

  m_base->unregisterPerformanceObserver(*m_observer.get());
  EXPECT_EQ(0, m_base->numObservers());
  EXPECT_EQ(0, m_base->numActiveObservers());
}
开发者ID:mirror,项目名称:chromium,代码行数:15,代码来源:PerformanceBaseTest.cpp

示例4: TEST

TEST(SerializedScriptValueTest, FileConstructorFile) {
    V8TestingScope scope;
    RefPtr<BlobDataHandle> blobDataHandle = BlobDataHandle::create();
    File* originalFile = File::create("hello.txt", 12345678.0, blobDataHandle);
    ASSERT_FALSE(originalFile->hasBackingFile());
    ASSERT_EQ(File::IsNotUserVisible, originalFile->getUserVisibility());
    ASSERT_EQ("hello.txt", originalFile->name());

    v8::Local<v8::Value> v8OriginalFile =
        toV8(originalFile, scope.context()->Global(), scope.isolate());
    RefPtr<SerializedScriptValue> serializedScriptValue =
        SerializedScriptValue::serialize(scope.isolate(), v8OriginalFile, nullptr,
                                         nullptr, ASSERT_NO_EXCEPTION);
    v8::Local<v8::Value> v8File =
        serializedScriptValue->deserialize(scope.isolate());

    ASSERT_TRUE(V8File::hasInstance(v8File, scope.isolate()));
    File* file = V8File::toImpl(v8::Local<v8::Object>::Cast(v8File));
    EXPECT_FALSE(file->hasBackingFile());
    EXPECT_EQ(File::IsNotUserVisible, file->getUserVisibility());
    EXPECT_EQ("hello.txt", file->name());
}
开发者ID:mirror,项目名称:chromium,代码行数:22,代码来源:SerializedScriptValueTest.cpp

示例5: TEST

TEST(AnimationEffectInputTest, LooslySorted) {
  V8TestingScope scope;
  Vector<Dictionary> jsKeyframes;
  v8::Local<v8::Object> keyframe1 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe2 = v8::Object::New(scope.isolate());
  v8::Local<v8::Object> keyframe3 = v8::Object::New(scope.isolate());

  setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "width", "100px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe1, "offset", "0");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe2, "width", "200px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe3, "width", "0px");
  setV8ObjectPropertyAsString(scope.isolate(), keyframe3, "offset", "1");

  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe1, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe2, scope.getExceptionState()));
  jsKeyframes.push_back(
      Dictionary(scope.isolate(), keyframe3, scope.getExceptionState()));

  Element* element = appendElement(scope.document());
  EffectModel* animationEffect = EffectInput::convert(
      element,
      DictionarySequenceOrDictionary::fromDictionarySequence(jsKeyframes),
      nullptr, scope.getExceptionState());
  EXPECT_FALSE(scope.getExceptionState().hadException());
  const KeyframeEffectModelBase& keyframeEffect =
      *toKeyframeEffectModelBase(animationEffect);
  EXPECT_EQ(1, keyframeEffect.getFrames()[2]->offset());
}
开发者ID:,项目名称:,代码行数:30,代码来源:


注:本文中的V8TestingScope类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。