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

Side by Side Diff: Source/bindings/core/v8/V8ScriptRunnerTest.cpp

Issue 1195763002: Cleanup: Remove experimental V8 cache strategies that we discarded. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add #if-guard for multi-CL change. Created 5 years, 6 months 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
« no previous file with comments | « Source/bindings/core/v8/V8ScriptRunner.cpp ('k') | Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "bindings/core/v8/V8ScriptRunner.h" 6 #include "bindings/core/v8/V8ScriptRunner.h"
7 7
8 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
9 #include "bindings/core/v8/V8BindingForTesting.h" 9 #include "bindings/core/v8/V8BindingForTesting.h"
10 #include "core/fetch/CachedMetadataHandler.h" 10 #include "core/fetch/CachedMetadataHandler.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 V8TestingScope m_scope; 94 V8TestingScope m_scope;
95 95
96 static int counter; 96 static int counter;
97 }; 97 };
98 98
99 int V8ScriptRunnerTest::counter = 0; 99 int V8ScriptRunnerTest::counter = 0;
100 100
101 TEST_F(V8ScriptRunnerTest, resourcelessShouldPass) 101 TEST_F(V8ScriptRunnerTest, resourcelessShouldPass)
102 { 102 {
103 EXPECT_TRUE(compileScript(V8CacheOptionsNone)); 103 EXPECT_TRUE(compileScript(V8CacheOptionsNone));
104 EXPECT_TRUE(compileScript(V8CacheOptionsParseMemory));
105 EXPECT_TRUE(compileScript(V8CacheOptionsParse)); 104 EXPECT_TRUE(compileScript(V8CacheOptionsParse));
106 EXPECT_TRUE(compileScript(V8CacheOptionsCode)); 105 EXPECT_TRUE(compileScript(V8CacheOptionsCode));
107 } 106 }
108 107
109 TEST_F(V8ScriptRunnerTest, emptyResourceDoesNotHaveCacheHandler) 108 TEST_F(V8ScriptRunnerTest, emptyResourceDoesNotHaveCacheHandler)
110 { 109 {
111 setEmptyResource(); 110 setEmptyResource();
112 EXPECT_FALSE(cacheHandler()); 111 EXPECT_FALSE(cacheHandler());
113 } 112 }
114 113
115 TEST_F(V8ScriptRunnerTest, parseMemoryOption)
116 {
117 setResource();
118 EXPECT_TRUE(compileScript(V8CacheOptionsParseMemory));
119 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler()) ));
120 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler())) );
121 // The cached data is associated with the encoding.
122 ResourceRequest request(url());
123 ResourcePtr<ScriptResource> anotherResource = new ScriptResource(request, "U TF-16");
124 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(anotherResourc e->cacheHandler())));
125 }
126
127 TEST_F(V8ScriptRunnerTest, parseOption) 114 TEST_F(V8ScriptRunnerTest, parseOption)
128 { 115 {
129 setResource(); 116 setResource();
130 EXPECT_TRUE(compileScript(V8CacheOptionsParse)); 117 EXPECT_TRUE(compileScript(V8CacheOptionsParse));
131 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler()) )); 118 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler()) ));
132 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler())) ); 119 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler())) );
133 // The cached data is associated with the encoding. 120 // The cached data is associated with the encoding.
134 ResourceRequest request(url()); 121 ResourceRequest request(url());
135 ResourcePtr<ScriptResource> anotherResource = new ScriptResource(request, "U TF-16"); 122 ResourcePtr<ScriptResource> anotherResource = new ScriptResource(request, "U TF-16");
136 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(anotherResourc e->cacheHandler()))); 123 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(anotherResourc e->cacheHandler())));
137 } 124 }
138 125
139 TEST_F(V8ScriptRunnerTest, codeOption) 126 TEST_F(V8ScriptRunnerTest, codeOption)
140 { 127 {
141 setResource(); 128 setResource();
129
130 // Compile twice, since 'code' has a probation period before it caches.
142 EXPECT_TRUE(compileScript(V8CacheOptionsCode)); 131 EXPECT_TRUE(compileScript(V8CacheOptionsCode));
132 EXPECT_TRUE(compileScript(V8CacheOptionsCode));
133
143 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler() ))); 134 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler() )));
144 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler()))) ; 135 EXPECT_TRUE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler()))) ;
145 // The cached data is associated with the encoding. 136 // The cached data is associated with the encoding.
146 ResourceRequest request(url()); 137 ResourceRequest request(url());
147 ResourcePtr<ScriptResource> anotherResource = new ScriptResource(request, "U TF-16"); 138 ResourcePtr<ScriptResource> anotherResource = new ScriptResource(request, "U TF-16");
148 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(anotherResource- >cacheHandler()))); 139 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(anotherResource- >cacheHandler())));
149 } 140 }
150 141
151 TEST_F(V8ScriptRunnerTest, codeCompressedOptions)
152 {
153 setResource();
154 EXPECT_TRUE(compileScript(V8CacheOptionsCodeCompressed));
155 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForParserCache(cacheHandler() )));
156 EXPECT_FALSE(cacheHandler()->cachedMetadata(tagForCodeCache(cacheHandler())) );
157 }
158
159 } // namespace 142 } // namespace
160 143
161 } // namespace blink 144 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8ScriptRunner.cpp ('k') | Source/web/AssertMatchingEnums.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698