| 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 <cstdio> | 5 #include <cstdio> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/location.h" |
| 10 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 11 #include "base/message_loop/message_loop.h" | |
| 12 #include "base/process/process_handle.h" | 12 #include "base/process/process_handle.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/single_thread_task_runner.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 16 #include "components/visitedlink/browser/visitedlink_delegate.h" | 18 #include "components/visitedlink/browser/visitedlink_delegate.h" |
| 17 #include "components/visitedlink/browser/visitedlink_event_listener.h" | 19 #include "components/visitedlink/browser/visitedlink_event_listener.h" |
| 18 #include "components/visitedlink/browser/visitedlink_master.h" | 20 #include "components/visitedlink/browser/visitedlink_master.h" |
| 19 #include "components/visitedlink/common/visitedlink_messages.h" | 21 #include "components/visitedlink/common/visitedlink_messages.h" |
| 20 #include "components/visitedlink/renderer/visitedlink_slave.h" | 22 #include "components/visitedlink/renderer/visitedlink_slave.h" |
| 21 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/notification_types.h" | 25 #include "content/public/browser/notification_types.h" |
| 24 #include "content/public/test/mock_render_process_host.h" | 26 #include "content/public/test/mock_render_process_host.h" |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 606 |
| 605 VisitedLinkMaster* master() const { | 607 VisitedLinkMaster* master() const { |
| 606 return master_.get(); | 608 return master_.get(); |
| 607 } | 609 } |
| 608 | 610 |
| 609 void WaitForCoalescense() { | 611 void WaitForCoalescense() { |
| 610 // Let the timer fire. | 612 // Let the timer fire. |
| 611 // | 613 // |
| 612 // TODO(ajwong): This is horrid! What is the right synchronization method? | 614 // TODO(ajwong): This is horrid! What is the right synchronization method? |
| 613 base::RunLoop run_loop; | 615 base::RunLoop run_loop; |
| 614 base::MessageLoop::current()->PostDelayedTask( | 616 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 615 FROM_HERE, | 617 FROM_HERE, run_loop.QuitClosure(), |
| 616 run_loop.QuitClosure(), | |
| 617 base::TimeDelta::FromMilliseconds(110)); | 618 base::TimeDelta::FromMilliseconds(110)); |
| 618 run_loop.Run(); | 619 run_loop.Run(); |
| 619 } | 620 } |
| 620 | 621 |
| 621 protected: | 622 protected: |
| 622 VisitedLinkRenderProcessHostFactory vc_rph_factory_; | 623 VisitedLinkRenderProcessHostFactory vc_rph_factory_; |
| 623 | 624 |
| 624 private: | 625 private: |
| 625 TestVisitedLinkDelegate delegate_; | 626 TestVisitedLinkDelegate delegate_; |
| 626 scoped_ptr<VisitedLinkMaster> master_; | 627 scoped_ptr<VisitedLinkMaster> master_; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 content::NotificationService::current()->Notify( | 758 content::NotificationService::current()->Notify( |
| 758 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 759 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 759 content::Source<content::RenderProcessHost>(&different_process_host), | 760 content::Source<content::RenderProcessHost>(&different_process_host), |
| 760 content::NotificationService::NoDetails()); | 761 content::NotificationService::NoDetails()); |
| 761 WaitForCoalescense(); | 762 WaitForCoalescense(); |
| 762 | 763 |
| 763 EXPECT_EQ(0, different_context.new_table_count()); | 764 EXPECT_EQ(0, different_context.new_table_count()); |
| 764 } | 765 } |
| 765 | 766 |
| 766 } // namespace visitedlink | 767 } // namespace visitedlink |
| OLD | NEW |