| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 5 #include <vector> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <cstdio> | 7 #include <cstdio> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 int add_count_; | 486 int add_count_; |
| 487 int add_event_count_; | 487 int add_event_count_; |
| 488 int reset_event_count_; | 488 int reset_event_count_; |
| 489 VisitedLinkEventListener* event_listener_; | 489 VisitedLinkEventListener* event_listener_; |
| 490 scoped_ptr<VisitedLinkMaster> visited_link_master_; | 490 scoped_ptr<VisitedLinkMaster> visited_link_master_; |
| 491 }; | 491 }; |
| 492 | 492 |
| 493 // Stub out as little as possible, borrowing from BrowserRenderProcessHost. | 493 // Stub out as little as possible, borrowing from BrowserRenderProcessHost. |
| 494 class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { | 494 class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { |
| 495 public: | 495 public: |
| 496 explicit VisitRelayingRenderProcessHost(Profile* profile) | 496 explicit VisitRelayingRenderProcessHost( |
| 497 : BrowserRenderProcessHost(profile) { | 497 content::BrowserContext* browser_context) |
| 498 : BrowserRenderProcessHost(browser_context) { |
| 498 NotificationService::current()->Notify( | 499 NotificationService::current()->Notify( |
| 499 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 500 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 500 Source<RenderProcessHost>(this), NotificationService::NoDetails()); | 501 Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
| 501 } | 502 } |
| 502 virtual ~VisitRelayingRenderProcessHost() { | 503 virtual ~VisitRelayingRenderProcessHost() { |
| 503 NotificationService::current()->Notify( | 504 NotificationService::current()->Notify( |
| 504 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 505 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 505 Source<RenderProcessHost>(this), NotificationService::NoDetails()); | 506 Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
| 506 } | 507 } |
| 507 | 508 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 545 |
| 545 private: | 546 private: |
| 546 DISALLOW_COPY_AND_ASSIGN(VisitRelayingRenderProcessHost); | 547 DISALLOW_COPY_AND_ASSIGN(VisitRelayingRenderProcessHost); |
| 547 }; | 548 }; |
| 548 | 549 |
| 549 class VisitedLinkRenderProcessHostFactory | 550 class VisitedLinkRenderProcessHostFactory |
| 550 : public RenderProcessHostFactory { | 551 : public RenderProcessHostFactory { |
| 551 public: | 552 public: |
| 552 VisitedLinkRenderProcessHostFactory() | 553 VisitedLinkRenderProcessHostFactory() |
| 553 : RenderProcessHostFactory() {} | 554 : RenderProcessHostFactory() {} |
| 554 virtual RenderProcessHost* CreateRenderProcessHost(Profile* profile) const { | 555 virtual RenderProcessHost* CreateRenderProcessHost( |
| 555 return new VisitRelayingRenderProcessHost(profile); | 556 content::BrowserContext* browser_context) const OVERRIDE { |
| 557 return new VisitRelayingRenderProcessHost(browser_context); |
| 556 } | 558 } |
| 557 | 559 |
| 558 private: | 560 private: |
| 559 | 561 |
| 560 DISALLOW_COPY_AND_ASSIGN(VisitedLinkRenderProcessHostFactory); | 562 DISALLOW_COPY_AND_ASSIGN(VisitedLinkRenderProcessHostFactory); |
| 561 }; | 563 }; |
| 562 | 564 |
| 563 class VisitedLinkEventsTest : public RenderViewHostTestHarness { | 565 class VisitedLinkEventsTest : public RenderViewHostTestHarness { |
| 564 public: | 566 public: |
| 565 VisitedLinkEventsTest() | 567 VisitedLinkEventsTest() |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 EXPECT_EQ(1, profile()->add_event_count()); | 719 EXPECT_EQ(1, profile()->add_event_count()); |
| 718 EXPECT_EQ(0, profile()->reset_event_count()); | 720 EXPECT_EQ(0, profile()->reset_event_count()); |
| 719 | 721 |
| 720 // Activate the tab. | 722 // Activate the tab. |
| 721 rvh()->WasRestored(); | 723 rvh()->WasRestored(); |
| 722 | 724 |
| 723 // We should have only one more reset event. | 725 // We should have only one more reset event. |
| 724 EXPECT_EQ(1, profile()->add_event_count()); | 726 EXPECT_EQ(1, profile()->add_event_count()); |
| 725 EXPECT_EQ(1, profile()->reset_event_count()); | 727 EXPECT_EQ(1, profile()->reset_event_count()); |
| 726 } | 728 } |
| OLD | NEW |