Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "core/loader/modulescript/ModuleTreeLinker.h" | 5 #include "core/loader/modulescript/ModuleTreeLinker.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptModule.h" | 7 #include "bindings/core/v8/ScriptModule.h" |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
| 10 #include "bindings/core/v8/V8BindingForTesting.h" | 10 #include "bindings/core/v8/V8BindingForTesting.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 : script_state_(std::move(script_state)) {} | 55 : script_state_(std::move(script_state)) {} |
| 56 ~ModuleTreeLinkerTestModulator() override {} | 56 ~ModuleTreeLinkerTestModulator() override {} |
| 57 | 57 |
| 58 DECLARE_TRACE(); | 58 DECLARE_TRACE(); |
| 59 | 59 |
| 60 enum class ResolveResult { kFailure, kSuccess }; | 60 enum class ResolveResult { kFailure, kSuccess }; |
| 61 | 61 |
| 62 // Resolve last |Modulator::FetchSingle()| call. | 62 // Resolve last |Modulator::FetchSingle()| call. |
| 63 ModuleScript* ResolveSingleModuleScriptFetch( | 63 ModuleScript* ResolveSingleModuleScriptFetch( |
| 64 const KURL& url, | 64 const KURL& url, |
| 65 const Vector<String>& dependency_module_requests) { | 65 const Vector<String>& dependency_module_requests, |
| 66 ModuleInstantiationState state) { | |
| 66 ScriptState::Scope scope(script_state_.Get()); | 67 ScriptState::Scope scope(script_state_.Get()); |
| 67 | 68 |
| 68 StringBuilder source_text; | 69 StringBuilder source_text; |
| 69 for (const auto& request : dependency_module_requests) { | 70 for (const auto& request : dependency_module_requests) { |
| 70 source_text.Append("import '"); | 71 source_text.Append("import '"); |
| 71 source_text.Append(request); | 72 source_text.Append(request); |
| 72 source_text.Append("';\n"); | 73 source_text.Append("';\n"); |
| 73 } | 74 } |
| 74 source_text.Append("export default 'grapes';"); | 75 source_text.Append("export default 'grapes';"); |
| 75 | 76 |
| 76 ScriptModule script_module = ScriptModule::Compile( | 77 ScriptModule script_module = ScriptModule::Compile( |
| 77 script_state_->GetIsolate(), source_text.ToString(), url.GetString(), | 78 script_state_->GetIsolate(), source_text.ToString(), url.GetString(), |
| 78 kSharableCrossOrigin); | 79 kSharableCrossOrigin); |
| 79 ModuleScript* module_script = | 80 ModuleScript* module_script = |
| 80 ModuleScript::Create(this, script_module, url, "", kParserInserted, | 81 ModuleScript::Create(this, script_module, url, "", kParserInserted, |
| 81 WebURLRequest::kFetchCredentialsModeOmit); | 82 WebURLRequest::kFetchCredentialsModeOmit); |
| 82 auto result_request = dependency_module_requests_map_.insert( | 83 auto result_request = dependency_module_requests_map_.insert( |
| 83 script_module, dependency_module_requests); | 84 script_module, dependency_module_requests); |
| 84 EXPECT_TRUE(result_request.is_new_entry); | 85 EXPECT_TRUE(result_request.is_new_entry); |
| 85 auto result_map = module_map_.insert(url, module_script); | 86 auto result_map = module_map_.insert(url, module_script); |
| 86 EXPECT_TRUE(result_map.is_new_entry); | 87 EXPECT_TRUE(result_map.is_new_entry); |
| 87 | 88 |
| 89 if (state == ModuleInstantiationState::kErrored) { | |
| 90 v8::Local<v8::Value> error = V8ThrowException::CreateError( | |
| 91 script_state_->GetIsolate(), "Instantiation failure."); | |
| 92 module_script->SetInstantiationErrorAndClearRecord( | |
| 93 ScriptValue(script_state_.Get(), error)); | |
| 94 } | |
| 95 | |
| 88 EXPECT_EQ(url, pending_request_url_); | 96 EXPECT_EQ(url, pending_request_url_); |
|
hiroshige
2017/04/27 22:56:40
EXPECT_EQ(state, module_script->InstantiationState
kouhei (in TOK)
2017/04/28 00:55:09
Done.
| |
| 89 EXPECT_TRUE(pending_client_); | 97 EXPECT_TRUE(pending_client_); |
| 90 pending_client_->NotifyModuleLoadFinished(module_script); | 98 pending_client_->NotifyModuleLoadFinished(module_script); |
| 91 pending_client_.Clear(); | 99 pending_client_.Clear(); |
| 92 | 100 |
| 93 return module_script; | 101 return module_script; |
| 94 } | 102 } |
| 95 | 103 |
| 96 // Get AncestorList specified in |Modulator::FetchTreeInternal()| call for | 104 // Get AncestorList specified in |Modulator::FetchTreeInternal()| call for |
| 97 // request matching |url|. | 105 // request matching |url|. |
| 98 AncestorList GetAncestorListForTreeFetch(const KURL& url) const { | 106 AncestorList GetAncestorListForTreeFetch(const KURL& url) const { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 ScriptValue InstantiateModule(ScriptModule) override { | 177 ScriptValue InstantiateModule(ScriptModule) override { |
| 170 if (instantiate_should_fail_) { | 178 if (instantiate_should_fail_) { |
| 171 ScriptState::Scope scope(script_state_.Get()); | 179 ScriptState::Scope scope(script_state_.Get()); |
| 172 v8::Local<v8::Value> error = V8ThrowException::CreateError( | 180 v8::Local<v8::Value> error = V8ThrowException::CreateError( |
| 173 script_state_->GetIsolate(), "Instantiation failure."); | 181 script_state_->GetIsolate(), "Instantiation failure."); |
| 174 return ScriptValue(script_state_.Get(), error); | 182 return ScriptValue(script_state_.Get(), error); |
| 175 } | 183 } |
| 176 return ScriptValue(); | 184 return ScriptValue(); |
| 177 } | 185 } |
| 178 | 186 |
| 187 ScriptValue GetInstantiationError(const ModuleScript*) override { | |
| 188 ScriptState::Scope scope(script_state_.Get()); | |
|
hiroshige
2017/04/27 22:56:40
Can we make this just the same as ModulatorImpl's
kouhei (in TOK)
2017/04/28 00:55:09
Done.
| |
| 189 v8::Local<v8::Value> error = V8ThrowException::CreateError( | |
| 190 script_state_->GetIsolate(), "Previous instantiation failure."); | |
| 191 return ScriptValue(script_state_.Get(), error); | |
| 192 } | |
| 193 | |
| 179 Vector<String> ModuleRequestsFromScriptModule( | 194 Vector<String> ModuleRequestsFromScriptModule( |
| 180 ScriptModule script_module) override { | 195 ScriptModule script_module) override { |
| 196 if (script_module.IsNull()) | |
| 197 return Vector<String>(); | |
| 198 | |
| 181 const auto& it = dependency_module_requests_map_.Find(script_module); | 199 const auto& it = dependency_module_requests_map_.Find(script_module); |
| 182 if (it == dependency_module_requests_map_.end()) | 200 if (it == dependency_module_requests_map_.end()) |
| 183 return Vector<String>(); | 201 return Vector<String>(); |
| 184 | 202 |
| 185 return it->value; | 203 return it->value; |
| 186 } | 204 } |
| 187 | 205 |
| 188 RefPtr<ScriptState> script_state_; | 206 RefPtr<ScriptState> script_state_; |
| 189 KURL pending_request_url_; | 207 KURL pending_request_url_; |
| 190 Member<SingleModuleClient> pending_client_; | 208 Member<SingleModuleClient> pending_client_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 url, String(), kParserInserted, WebURLRequest::kFetchCredentialsModeOmit); | 251 url, String(), kParserInserted, WebURLRequest::kFetchCredentialsModeOmit); |
| 234 TestModuleTreeClient* client = new TestModuleTreeClient; | 252 TestModuleTreeClient* client = new TestModuleTreeClient; |
| 235 registry->Fetch(module_request, AncestorList(), | 253 registry->Fetch(module_request, AncestorList(), |
| 236 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), | 254 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), |
| 237 client); | 255 client); |
| 238 | 256 |
| 239 EXPECT_FALSE(client->WasNotifyFinished()) | 257 EXPECT_FALSE(client->WasNotifyFinished()) |
| 240 << "ModuleTreeLinker should always finish asynchronously."; | 258 << "ModuleTreeLinker should always finish asynchronously."; |
| 241 EXPECT_FALSE(client->GetModuleScript()); | 259 EXPECT_FALSE(client->GetModuleScript()); |
| 242 | 260 |
| 243 GetModulator()->ResolveSingleModuleScriptFetch(url, {}); | 261 GetModulator()->ResolveSingleModuleScriptFetch( |
| 262 url, {}, ModuleInstantiationState::kUninstantiated); | |
| 244 EXPECT_TRUE(client->WasNotifyFinished()); | 263 EXPECT_TRUE(client->WasNotifyFinished()); |
| 245 ASSERT_TRUE(client->GetModuleScript()); | 264 ASSERT_TRUE(client->GetModuleScript()); |
| 246 EXPECT_EQ(client->GetModuleScript()->InstantiationState(), | 265 EXPECT_EQ(client->GetModuleScript()->InstantiationState(), |
| 247 ModuleInstantiationState::kInstantiated); | 266 ModuleInstantiationState::kInstantiated); |
| 248 } | 267 } |
| 249 | 268 |
| 250 TEST_F(ModuleTreeLinkerTest, FetchTreeInstantiationFailure) { | 269 TEST_F(ModuleTreeLinkerTest, FetchTreeInstantiationFailure) { |
| 251 GetModulator()->SetInstantiateShouldFail(true); | 270 GetModulator()->SetInstantiateShouldFail(true); |
| 252 | 271 |
| 253 ModuleTreeLinkerRegistry* registry = ModuleTreeLinkerRegistry::Create(); | 272 ModuleTreeLinkerRegistry* registry = ModuleTreeLinkerRegistry::Create(); |
| 254 | 273 |
| 255 KURL url(kParsedURLString, "http://example.com/root.js"); | 274 KURL url(kParsedURLString, "http://example.com/root.js"); |
| 256 ModuleScriptFetchRequest module_request( | 275 ModuleScriptFetchRequest module_request( |
| 257 url, String(), kParserInserted, WebURLRequest::kFetchCredentialsModeOmit); | 276 url, String(), kParserInserted, WebURLRequest::kFetchCredentialsModeOmit); |
| 258 TestModuleTreeClient* client = new TestModuleTreeClient; | 277 TestModuleTreeClient* client = new TestModuleTreeClient; |
| 259 registry->Fetch(module_request, AncestorList(), | 278 registry->Fetch(module_request, AncestorList(), |
| 260 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), | 279 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), |
| 261 client); | 280 client); |
| 262 | 281 |
| 263 EXPECT_FALSE(client->WasNotifyFinished()) | 282 EXPECT_FALSE(client->WasNotifyFinished()) |
| 264 << "ModuleTreeLinker should always finish asynchronously."; | 283 << "ModuleTreeLinker should always finish asynchronously."; |
| 265 EXPECT_FALSE(client->GetModuleScript()); | 284 EXPECT_FALSE(client->GetModuleScript()); |
| 266 | 285 |
| 267 GetModulator()->ResolveSingleModuleScriptFetch(url, {}); | 286 GetModulator()->ResolveSingleModuleScriptFetch( |
| 287 url, {}, ModuleInstantiationState::kUninstantiated); | |
| 268 EXPECT_TRUE(client->WasNotifyFinished()); | 288 EXPECT_TRUE(client->WasNotifyFinished()); |
| 269 ASSERT_TRUE(client->GetModuleScript()); | 289 ASSERT_TRUE(client->GetModuleScript()); |
| 270 EXPECT_EQ(client->GetModuleScript()->InstantiationState(), | 290 EXPECT_EQ(client->GetModuleScript()->InstantiationState(), |
| 271 ModuleInstantiationState::kErrored); | 291 ModuleInstantiationState::kErrored); |
| 272 } | 292 } |
| 273 | 293 |
| 294 TEST_F(ModuleTreeLinkerTest, FetchTreePreviousInstantiationFailure) { | |
|
hiroshige
2017/04/27 22:56:40
This looks almost the same as FetchTreeInstantiati
kouhei (in TOK)
2017/04/28 00:55:09
It is similar, but I'd like to keep them separate.
hiroshige
2017/04/28 01:28:35
Oh, understood.
So
| |
| 295 ModuleTreeLinkerRegistry* registry = ModuleTreeLinkerRegistry::Create(); | |
| 296 | |
| 297 KURL url(kParsedURLString, "http://example.com/root.js"); | |
| 298 ModuleScriptFetchRequest module_request( | |
| 299 url, String(), kParserInserted, WebURLRequest::kFetchCredentialsModeOmit); | |
| 300 TestModuleTreeClient* client = new TestModuleTreeClient; | |
| 301 registry->Fetch(module_request, AncestorList(), | |
| 302 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), | |
| 303 client); | |
| 304 | |
| 305 EXPECT_FALSE(client->WasNotifyFinished()) | |
| 306 << "ModuleTreeLinker should always finish asynchronously."; | |
| 307 EXPECT_FALSE(client->GetModuleScript()); | |
| 308 | |
| 309 GetModulator()->ResolveSingleModuleScriptFetch( | |
| 310 url, {}, ModuleInstantiationState::kErrored); | |
| 311 EXPECT_TRUE(client->WasNotifyFinished()); | |
| 312 ASSERT_TRUE(client->GetModuleScript()); | |
| 313 EXPECT_EQ(ModuleInstantiationState::kErrored, | |
| 314 client->GetModuleScript()->InstantiationState()); | |
| 315 } | |
| 316 | |
| 274 TEST_F(ModuleTreeLinkerTest, FetchTreeWithSingleDependency) { | 317 TEST_F(ModuleTreeLinkerTest, FetchTreeWithSingleDependency) { |
| 275 ModuleTreeLinkerRegistry* registry = ModuleTreeLinkerRegistry::Create(); | 318 ModuleTreeLinkerRegistry* registry = ModuleTreeLinkerRegistry::Create(); |
| 276 | 319 |
| 277 KURL url(kParsedURLString, "http://example.com/root.js"); | 320 KURL url(kParsedURLString, "http://example.com/root.js"); |
| 278 ModuleScriptFetchRequest module_request( | 321 ModuleScriptFetchRequest module_request( |
| 279 url, String(), kParserInserted, WebURLRequest::kFetchCredentialsModeOmit); | 322 url, String(), kParserInserted, WebURLRequest::kFetchCredentialsModeOmit); |
| 280 TestModuleTreeClient* client = new TestModuleTreeClient; | 323 TestModuleTreeClient* client = new TestModuleTreeClient; |
| 281 registry->Fetch(module_request, AncestorList(), | 324 registry->Fetch(module_request, AncestorList(), |
| 282 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), | 325 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), |
| 283 client); | 326 client); |
| 284 | 327 |
| 285 EXPECT_FALSE(client->WasNotifyFinished()) | 328 EXPECT_FALSE(client->WasNotifyFinished()) |
| 286 << "ModuleTreeLinker should always finish asynchronously."; | 329 << "ModuleTreeLinker should always finish asynchronously."; |
| 287 EXPECT_FALSE(client->GetModuleScript()); | 330 EXPECT_FALSE(client->GetModuleScript()); |
| 288 | 331 |
| 289 GetModulator()->ResolveSingleModuleScriptFetch(url, {"./dep1.js"}); | 332 GetModulator()->ResolveSingleModuleScriptFetch( |
| 333 url, {"./dep1.js"}, ModuleInstantiationState::kUninstantiated); | |
| 290 EXPECT_FALSE(client->WasNotifyFinished()); | 334 EXPECT_FALSE(client->WasNotifyFinished()); |
| 291 | 335 |
| 292 KURL url_dep1(kParsedURLString, "http://example.com/dep1.js"); | 336 KURL url_dep1(kParsedURLString, "http://example.com/dep1.js"); |
| 293 auto ancestor_list = GetModulator()->GetAncestorListForTreeFetch(url_dep1); | 337 auto ancestor_list = GetModulator()->GetAncestorListForTreeFetch(url_dep1); |
| 294 EXPECT_EQ(1u, ancestor_list.size()); | 338 EXPECT_EQ(1u, ancestor_list.size()); |
| 295 EXPECT_TRUE(ancestor_list.Contains( | 339 EXPECT_TRUE(ancestor_list.Contains( |
| 296 KURL(kParsedURLString, "http://example.com/root.js"))); | 340 KURL(kParsedURLString, "http://example.com/root.js"))); |
| 297 | 341 |
| 298 GetModulator()->ResolveDependentTreeFetch( | 342 GetModulator()->ResolveDependentTreeFetch( |
| 299 url_dep1, ModuleTreeLinkerTestModulator::ResolveResult::kSuccess); | 343 url_dep1, ModuleTreeLinkerTestModulator::ResolveResult::kSuccess); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 313 TestModuleTreeClient* client = new TestModuleTreeClient; | 357 TestModuleTreeClient* client = new TestModuleTreeClient; |
| 314 registry->Fetch(module_request, AncestorList(), | 358 registry->Fetch(module_request, AncestorList(), |
| 315 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), | 359 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), |
| 316 client); | 360 client); |
| 317 | 361 |
| 318 EXPECT_FALSE(client->WasNotifyFinished()) | 362 EXPECT_FALSE(client->WasNotifyFinished()) |
| 319 << "ModuleTreeLinker should always finish asynchronously."; | 363 << "ModuleTreeLinker should always finish asynchronously."; |
| 320 EXPECT_FALSE(client->GetModuleScript()); | 364 EXPECT_FALSE(client->GetModuleScript()); |
| 321 | 365 |
| 322 GetModulator()->ResolveSingleModuleScriptFetch( | 366 GetModulator()->ResolveSingleModuleScriptFetch( |
| 323 url, {"./dep1.js", "./dep2.js", "./dep3.js"}); | 367 url, {"./dep1.js", "./dep2.js", "./dep3.js"}, |
| 368 ModuleInstantiationState::kUninstantiated); | |
| 324 EXPECT_FALSE(client->WasNotifyFinished()); | 369 EXPECT_FALSE(client->WasNotifyFinished()); |
| 325 | 370 |
| 326 Vector<KURL> url_deps; | 371 Vector<KURL> url_deps; |
| 327 for (int i = 1; i <= 3; ++i) { | 372 for (int i = 1; i <= 3; ++i) { |
| 328 StringBuilder url_dep_str; | 373 StringBuilder url_dep_str; |
| 329 url_dep_str.Append("http://example.com/dep"); | 374 url_dep_str.Append("http://example.com/dep"); |
| 330 url_dep_str.AppendNumber(i); | 375 url_dep_str.AppendNumber(i); |
| 331 url_dep_str.Append(".js"); | 376 url_dep_str.Append(".js"); |
| 332 | 377 |
| 333 KURL url_dep(kParsedURLString, url_dep_str.ToString()); | 378 KURL url_dep(kParsedURLString, url_dep_str.ToString()); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 363 TestModuleTreeClient* client = new TestModuleTreeClient; | 408 TestModuleTreeClient* client = new TestModuleTreeClient; |
| 364 registry->Fetch(module_request, AncestorList(), | 409 registry->Fetch(module_request, AncestorList(), |
| 365 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), | 410 ModuleGraphLevel::kTopLevelModuleFetch, GetModulator(), |
| 366 client); | 411 client); |
| 367 | 412 |
| 368 EXPECT_FALSE(client->WasNotifyFinished()) | 413 EXPECT_FALSE(client->WasNotifyFinished()) |
| 369 << "ModuleTreeLinker should always finish asynchronously."; | 414 << "ModuleTreeLinker should always finish asynchronously."; |
| 370 EXPECT_FALSE(client->GetModuleScript()); | 415 EXPECT_FALSE(client->GetModuleScript()); |
| 371 | 416 |
| 372 GetModulator()->ResolveSingleModuleScriptFetch( | 417 GetModulator()->ResolveSingleModuleScriptFetch( |
| 373 url, {"./dep1.js", "./dep2.js", "./dep3.js"}); | 418 url, {"./dep1.js", "./dep2.js", "./dep3.js"}, |
| 419 ModuleInstantiationState::kUninstantiated); | |
| 374 EXPECT_FALSE(client->WasNotifyFinished()); | 420 EXPECT_FALSE(client->WasNotifyFinished()); |
| 375 | 421 |
| 376 Vector<KURL> url_deps; | 422 Vector<KURL> url_deps; |
| 377 for (int i = 1; i <= 3; ++i) { | 423 for (int i = 1; i <= 3; ++i) { |
| 378 StringBuilder url_dep_str; | 424 StringBuilder url_dep_str; |
| 379 url_dep_str.Append("http://example.com/dep"); | 425 url_dep_str.Append("http://example.com/dep"); |
| 380 url_dep_str.AppendNumber(i); | 426 url_dep_str.AppendNumber(i); |
| 381 url_dep_str.Append(".js"); | 427 url_dep_str.Append(".js"); |
| 382 | 428 |
| 383 KURL url_dep(kParsedURLString, url_dep_str.ToString()); | 429 KURL url_dep(kParsedURLString, url_dep_str.ToString()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 TestModuleTreeClient* client = new TestModuleTreeClient; | 468 TestModuleTreeClient* client = new TestModuleTreeClient; |
| 423 registry->Fetch( | 469 registry->Fetch( |
| 424 module_request, | 470 module_request, |
| 425 AncestorList{KURL(kParsedURLString, "http://example.com/root.js")}, | 471 AncestorList{KURL(kParsedURLString, "http://example.com/root.js")}, |
| 426 ModuleGraphLevel::kDependentModuleFetch, GetModulator(), client); | 472 ModuleGraphLevel::kDependentModuleFetch, GetModulator(), client); |
| 427 | 473 |
| 428 EXPECT_FALSE(client->WasNotifyFinished()) | 474 EXPECT_FALSE(client->WasNotifyFinished()) |
| 429 << "ModuleTreeLinker should always finish asynchronously."; | 475 << "ModuleTreeLinker should always finish asynchronously."; |
| 430 EXPECT_FALSE(client->GetModuleScript()); | 476 EXPECT_FALSE(client->GetModuleScript()); |
| 431 | 477 |
| 432 GetModulator()->ResolveSingleModuleScriptFetch(url, {"./depth2.js"}); | 478 GetModulator()->ResolveSingleModuleScriptFetch( |
| 479 url, {"./depth2.js"}, ModuleInstantiationState::kUninstantiated); | |
| 433 | 480 |
| 434 KURL url_dep2(kParsedURLString, "http://example.com/depth2.js"); | 481 KURL url_dep2(kParsedURLString, "http://example.com/depth2.js"); |
| 435 auto ancestor_list = GetModulator()->GetAncestorListForTreeFetch(url_dep2); | 482 auto ancestor_list = GetModulator()->GetAncestorListForTreeFetch(url_dep2); |
| 436 EXPECT_EQ(2u, ancestor_list.size()); | 483 EXPECT_EQ(2u, ancestor_list.size()); |
| 437 EXPECT_TRUE(ancestor_list.Contains( | 484 EXPECT_TRUE(ancestor_list.Contains( |
| 438 KURL(kParsedURLString, "http://example.com/root.js"))); | 485 KURL(kParsedURLString, "http://example.com/root.js"))); |
| 439 EXPECT_TRUE(ancestor_list.Contains( | 486 EXPECT_TRUE(ancestor_list.Contains( |
| 440 KURL(kParsedURLString, "http://example.com/depth1.js"))); | 487 KURL(kParsedURLString, "http://example.com/depth1.js"))); |
| 441 | 488 |
| 442 GetModulator()->ResolveDependentTreeFetch( | 489 GetModulator()->ResolveDependentTreeFetch( |
| 443 url_dep2, ModuleTreeLinkerTestModulator::ResolveResult::kSuccess); | 490 url_dep2, ModuleTreeLinkerTestModulator::ResolveResult::kSuccess); |
| 444 | 491 |
| 445 EXPECT_TRUE(client->WasNotifyFinished()); | 492 EXPECT_TRUE(client->WasNotifyFinished()); |
| 446 ASSERT_TRUE(client->GetModuleScript()); | 493 ASSERT_TRUE(client->GetModuleScript()); |
| 447 EXPECT_EQ(client->GetModuleScript()->InstantiationState(), | 494 EXPECT_EQ(client->GetModuleScript()->InstantiationState(), |
| 448 ModuleInstantiationState::kInstantiated); | 495 ModuleInstantiationState::kInstantiated); |
| 449 } | 496 } |
| 450 | 497 |
| 451 } // namespace blink | 498 } // namespace blink |
| OLD | NEW |