| 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(content::BrowserContext* context) |
| 497 : BrowserRenderProcessHost(profile) { | 497 : BrowserRenderProcessHost(context) { |
| 498 NotificationService::current()->Notify( | 498 NotificationService::current()->Notify( |
| 499 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 499 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 500 Source<RenderProcessHost>(this), NotificationService::NoDetails()); | 500 Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
| 501 } | 501 } |
| 502 virtual ~VisitRelayingRenderProcessHost() { | 502 virtual ~VisitRelayingRenderProcessHost() { |
| 503 NotificationService::current()->Notify( | 503 NotificationService::current()->Notify( |
| 504 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 504 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 505 Source<RenderProcessHost>(this), NotificationService::NoDetails()); | 505 Source<RenderProcessHost>(this), NotificationService::NoDetails()); |
| 506 } | 506 } |
| 507 | 507 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 544 |
| 545 private: | 545 private: |
| 546 DISALLOW_COPY_AND_ASSIGN(VisitRelayingRenderProcessHost); | 546 DISALLOW_COPY_AND_ASSIGN(VisitRelayingRenderProcessHost); |
| 547 }; | 547 }; |
| 548 | 548 |
| 549 class VisitedLinkRenderProcessHostFactory | 549 class VisitedLinkRenderProcessHostFactory |
| 550 : public RenderProcessHostFactory { | 550 : public RenderProcessHostFactory { |
| 551 public: | 551 public: |
| 552 VisitedLinkRenderProcessHostFactory() | 552 VisitedLinkRenderProcessHostFactory() |
| 553 : RenderProcessHostFactory() {} | 553 : RenderProcessHostFactory() {} |
| 554 virtual RenderProcessHost* CreateRenderProcessHost(Profile* profile) const { | 554 virtual RenderProcessHost* CreateRenderProcessHost( |
| 555 return new VisitRelayingRenderProcessHost(profile); | 555 content::BrowserContext* context) const { |
| 556 return new VisitRelayingRenderProcessHost(context); |
| 556 } | 557 } |
| 557 | 558 |
| 558 private: | 559 private: |
| 559 | 560 |
| 560 DISALLOW_COPY_AND_ASSIGN(VisitedLinkRenderProcessHostFactory); | 561 DISALLOW_COPY_AND_ASSIGN(VisitedLinkRenderProcessHostFactory); |
| 561 }; | 562 }; |
| 562 | 563 |
| 563 class VisitedLinkEventsTest : public RenderViewHostTestHarness { | 564 class VisitedLinkEventsTest : public RenderViewHostTestHarness { |
| 564 public: | 565 public: |
| 565 VisitedLinkEventsTest() | 566 VisitedLinkEventsTest() |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 EXPECT_EQ(1, profile()->add_event_count()); | 718 EXPECT_EQ(1, profile()->add_event_count()); |
| 718 EXPECT_EQ(0, profile()->reset_event_count()); | 719 EXPECT_EQ(0, profile()->reset_event_count()); |
| 719 | 720 |
| 720 // Activate the tab. | 721 // Activate the tab. |
| 721 rvh()->WasRestored(); | 722 rvh()->WasRestored(); |
| 722 | 723 |
| 723 // We should have only one more reset event. | 724 // We should have only one more reset event. |
| 724 EXPECT_EQ(1, profile()->add_event_count()); | 725 EXPECT_EQ(1, profile()->add_event_count()); |
| 725 EXPECT_EQ(1, profile()->reset_event_count()); | 726 EXPECT_EQ(1, profile()->reset_event_count()); |
| 726 } | 727 } |
| OLD | NEW |