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

Side by Side Diff: third_party/WebKit/Source/core/testing/PrivateScriptTestTest.cpp

Issue 2571063002: Remove Blink-in-JS (Closed)
Patch Set: Created 4 years 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/testing/PrivateScriptTest.h"
6
7 #include "bindings/core/v8/PrivateScriptRunner.h"
8 #include "bindings/core/v8/V8Binding.h"
9 #include "bindings/core/v8/V8BindingForTesting.h"
10 #include "bindings/core/v8/V8PrivateScriptTest.h"
11 #include "core/testing/DummyPageHolder.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13 #include <memory>
14
15 // PrivateScriptTest.js is available only in debug builds.
16 #ifndef NDEBUG
17 namespace blink {
18
19 namespace {
20
21 TEST(PrivateScriptTestTest, invokePrivateScriptMethodFromCPP) {
22 V8TestingScope scope;
23 PrivateScriptTest* privateScriptTest =
24 PrivateScriptTest::create(&scope.document());
25 bool success;
26 int result;
27 success =
28 V8PrivateScriptTest::PrivateScript::addIntegerForPrivateScriptOnlyMethod(
29 &scope.frame(), privateScriptTest, 100, 200, &result);
30 EXPECT_TRUE(success);
31 EXPECT_EQ(result, 300);
32 }
33
34 TEST(PrivateScriptTestTest, invokePrivateScriptAttributeFromCPP) {
35 V8TestingScope scope;
36 PrivateScriptTest* privateScriptTest =
37 PrivateScriptTest::create(&scope.document());
38 bool success;
39 String result;
40 success = V8PrivateScriptTest::PrivateScript::
41 stringAttributeForPrivateScriptOnlyAttributeGetter(
42 &scope.frame(), privateScriptTest, &result);
43 EXPECT_TRUE(success);
44 EXPECT_EQ(result, "yyy");
45 success = V8PrivateScriptTest::PrivateScript::
46 stringAttributeForPrivateScriptOnlyAttributeSetter(
47 &scope.frame(), privateScriptTest, "foo");
48 EXPECT_TRUE(success);
49 success = V8PrivateScriptTest::PrivateScript::
50 stringAttributeForPrivateScriptOnlyAttributeGetter(
51 &scope.frame(), privateScriptTest, &result);
52 EXPECT_TRUE(success);
53 EXPECT_EQ(result, "foo");
54 }
55
56 } // namespace
57
58 } // namespace blink
59 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/PrivateScriptTest.js ('k') | third_party/WebKit/public/blink_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698