Movatterモバイル変換


[0]ホーム

URL:


Google Git
Sign in
chromium /chromium /src /refs/heads/main /. /gin /shell_runner_unittest.cc
blob: 11996ef12e0100544914b98e04a2bf381f4f46ae [file] [log] [blame]
Avi Drissman468e51b62022-09-13 20:47:01[diff] [blame]1// Copyright 2014 The Chromium Authors
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
sky@chromium.org1771610d2014-02-27 06:08:24[diff] [blame]5#include"gin/shell_runner.h"
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]6
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]7#include"gin/converter.h"
jochen@chromium.orgf04b0e92013-11-22 14:20:55[diff] [blame]8#include"gin/public/isolate_holder.h"
Jochen Eisingerc6fb8762022-09-26 07:56:19[diff] [blame]9#include"gin/test/v8_test.h"
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]10
11namespace gin{
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]12
Jochen Eisingerc6fb8762022-09-26 07:56:19[diff] [blame]13typedef V8TestRunnerTest;
14
15TEST_F(RunnerTest,Run){
abarth@chromium.org97f21ca2013-11-17 17:46:07[diff] [blame]16 std::string source="this.result = 'PASS';\n";
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]17
sky@chromium.org1771610d2014-02-27 06:08:24[diff] [blame]18ShellRunnerDelegatedelegate;
Jochen Eisingerc6fb8762022-09-26 07:56:19[diff] [blame]19 v8::Isolate* isolate= instance_->isolate();
sky@chromium.org1771610d2014-02-27 06:08:24[diff] [blame]20ShellRunner runner(&delegate, isolate);
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]21Runner::Scope scope(&runner);
abarth@chromium.org2f703422013-11-25 21:26:15[diff] [blame]22 runner.Run(source,"test_data.js");
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]23
24 std::string result;
Dan Elphickd7eeb4a2019-02-01 17:55:56[diff] [blame]25 EXPECT_TRUE(Converter<std::string>::FromV8(
26 isolate,
27 runner.global()
28->Get(isolate->GetCurrentContext(),StringToV8(isolate,"result"))
29.ToLocalChecked(),
abarth@chromium.orga22998a2013-11-10 05:00:50[diff] [blame]30&result));
31 EXPECT_EQ("PASS", result);
32}
33
34}// namespace gin

[8]ページ先頭

©2009-2025 Movatter.jp