| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bindings/core/v8/V8ScriptRunner.h" | 5 #include "bindings/core/v8/V8ScriptRunner.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
| 8 #include "bindings/core/v8/V8BindingForTesting.h" | 8 #include "bindings/core/v8/V8BindingForTesting.h" |
| 9 #include "core/fetch/CachedMetadataHandler.h" | 9 #include "core/fetch/CachedMetadataHandler.h" |
| 10 #include "core/fetch/ScriptResource.h" | 10 #include "core/fetch/ScriptResource.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 TEST_F(V8ScriptRunnerTest, parseOption) | 113 TEST_F(V8ScriptRunnerTest, parseOption) |
| 114 { | 114 { |
| 115 setResource(); | 115 setResource(); |
| 116 EXPECT_TRUE(compileScript(V8CacheOptionsParse)); | 116 EXPECT_TRUE(compileScript(V8CacheOptionsParse)); |
| 117 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler())
)); | 117 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler())
)); |
| 118 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler()))
); | 118 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler()))
); |
| 119 // The cached data is associated with the encoding. | 119 // The cached data is associated with the encoding. |
| 120 ResourceRequest request(url()); | 120 ResourceRequest request(url()); |
| 121 RawPtr<ScriptResource> anotherResource = ScriptResource::create(request, "UT
F-16"); | 121 ScriptResource* anotherResource = ScriptResource::create(request, "UTF-16"); |
| 122 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(anotherResourc
e->cacheHandler()))); | 122 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(anotherResourc
e->cacheHandler()))); |
| 123 } | 123 } |
| 124 | 124 |
| 125 TEST_F(V8ScriptRunnerTest, codeOption) | 125 TEST_F(V8ScriptRunnerTest, codeOption) |
| 126 { | 126 { |
| 127 setResource(); | 127 setResource(); |
| 128 | 128 |
| 129 // Compile twice, since 'code' has a probation period before it caches. | 129 // Compile twice, since 'code' has a probation period before it caches. |
| 130 EXPECT_TRUE(compileScript(V8CacheOptionsCode)); | 130 EXPECT_TRUE(compileScript(V8CacheOptionsCode)); |
| 131 EXPECT_TRUE(compileScript(V8CacheOptionsCode)); | 131 EXPECT_TRUE(compileScript(V8CacheOptionsCode)); |
| 132 | 132 |
| 133 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler()
))); | 133 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler()
))); |
| 134 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler())))
; | 134 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler())))
; |
| 135 // The cached data is associated with the encoding. | 135 // The cached data is associated with the encoding. |
| 136 ResourceRequest request(url()); | 136 ResourceRequest request(url()); |
| 137 RawPtr<ScriptResource> anotherResource = ScriptResource::create(request, "UT
F-16"); | 137 ScriptResource* anotherResource = ScriptResource::create(request, "UTF-16"); |
| 138 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(anotherResource-
>cacheHandler()))); | 138 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(anotherResource-
>cacheHandler()))); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace | 141 } // namespace |
| 142 | 142 |
| 143 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |