OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "content/browser/devtools/devtools_manager.h" | 8 #include "content/browser/devtools/devtools_manager.h" |
9 #include "content/browser/devtools/embedded_worker_devtools_manager.h" | |
10 #include "content/browser/devtools/render_view_devtools_agent_host.h" | 9 #include "content/browser/devtools/render_view_devtools_agent_host.h" |
| 10 #include "content/browser/devtools/shared_worker_devtools_manager.h" |
11 #include "content/browser/shared_worker/shared_worker_instance.h" | 11 #include "content/browser/shared_worker/shared_worker_instance.h" |
12 #include "content/browser/shared_worker/worker_storage_partition.h" | 12 #include "content/browser/shared_worker/worker_storage_partition.h" |
13 #include "content/common/view_messages.h" | 13 #include "content/common/view_messages.h" |
14 #include "content/public/browser/browser_context.h" | 14 #include "content/public/browser/browser_context.h" |
15 #include "content/public/browser/content_browser_client.h" | 15 #include "content/public/browser/content_browser_client.h" |
16 #include "content/public/browser/devtools_agent_host.h" | 16 #include "content/public/browser/devtools_agent_host.h" |
17 #include "content/public/browser/devtools_external_agent_proxy.h" | 17 #include "content/public/browser/devtools_external_agent_proxy.h" |
18 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" | 18 #include "content/public/browser/devtools_external_agent_proxy_delegate.h" |
19 #include "content/public/browser/devtools_target.h" | 19 #include "content/public/browser/devtools_target.h" |
20 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 WorkerStoragePartitionId partition_id(*partition.get()); | 422 WorkerStoragePartitionId partition_id(*partition.get()); |
423 | 423 |
424 GURL shared_worker_url("http://example.com/shared_worker.js"); | 424 GURL shared_worker_url("http://example.com/shared_worker.js"); |
425 SharedWorkerInstance shared_worker( | 425 SharedWorkerInstance shared_worker( |
426 shared_worker_url, | 426 shared_worker_url, |
427 base::string16(), | 427 base::string16(), |
428 base::string16(), | 428 base::string16(), |
429 blink::WebContentSecurityPolicyTypeReport, | 429 blink::WebContentSecurityPolicyTypeReport, |
430 browser_context()->GetResourceContext(), | 430 browser_context()->GetResourceContext(), |
431 partition_id); | 431 partition_id); |
432 EmbeddedWorkerDevToolsManager::GetInstance()->SharedWorkerCreated( | 432 SharedWorkerDevToolsManager::GetInstance()->WorkerCreated( |
433 1, 1, shared_worker); | 433 1, 1, shared_worker); |
434 contents()->NavigateAndCommit(url2); | 434 contents()->NavigateAndCommit(url2); |
435 | 435 |
436 EXPECT_EQ(3, observer->updates_count()); | 436 EXPECT_EQ(3, observer->updates_count()); |
437 ASSERT_EQ(2u, observer->hosts().size()); | 437 ASSERT_EQ(2u, observer->hosts().size()); |
438 EXPECT_EQ(contents(), observer->hosts()[0]->GetWebContents()); | 438 EXPECT_EQ(contents(), observer->hosts()[0]->GetWebContents()); |
439 EXPECT_EQ(url2.spec(), observer->hosts()[0]->GetURL().spec()); | 439 EXPECT_EQ(url2.spec(), observer->hosts()[0]->GetURL().spec()); |
440 EXPECT_EQ(DevToolsAgentHost::TYPE_SHARED_WORKER, | 440 EXPECT_EQ(DevToolsAgentHost::TYPE_SHARED_WORKER, |
441 observer->hosts()[1]->GetType()); | 441 observer->hosts()[1]->GetType()); |
442 EXPECT_EQ(shared_worker_url.spec(), observer->hosts()[1]->GetURL().spec()); | 442 EXPECT_EQ(shared_worker_url.spec(), observer->hosts()[1]->GetURL().spec()); |
443 | 443 |
444 EmbeddedWorkerDevToolsManager::GetInstance()->WorkerDestroyed(1, 1); | 444 SharedWorkerDevToolsManager::GetInstance()->WorkerDestroyed(1, 1); |
445 scheduler.Run(); | 445 scheduler.Run(); |
446 EXPECT_EQ(4, observer->updates_count()); | 446 EXPECT_EQ(4, observer->updates_count()); |
447 ASSERT_EQ(1u, observer->hosts().size()); | 447 ASSERT_EQ(1u, observer->hosts().size()); |
448 EXPECT_EQ(contents(), observer->hosts()[0]->GetWebContents()); | 448 EXPECT_EQ(contents(), observer->hosts()[0]->GetWebContents()); |
449 EXPECT_EQ(url2.spec(), observer->hosts()[0]->GetURL().spec()); | 449 EXPECT_EQ(url2.spec(), observer->hosts()[0]->GetURL().spec()); |
450 | 450 |
451 // Check there were no extra updates. | 451 // Check there were no extra updates. |
452 scheduler.Run(); | 452 scheduler.Run(); |
453 EXPECT_TRUE(scheduler.IsEmpty()); | 453 EXPECT_TRUE(scheduler.IsEmpty()); |
454 EXPECT_EQ(4, observer->updates_count()); | 454 EXPECT_EQ(4, observer->updates_count()); |
455 | 455 |
456 manager->RemoveObserver(observer.get()); | 456 manager->RemoveObserver(observer.get()); |
457 | 457 |
458 EXPECT_TRUE(scheduler.IsEmpty()); | 458 EXPECT_TRUE(scheduler.IsEmpty()); |
459 } | 459 } |
460 | 460 |
461 } // namespace content | 461 } // namespace content |
OLD | NEW |