| 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" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
| 13 #include "base/shared_memory.h" | 13 #include "base/shared_memory.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "chrome/browser/visitedlink/visitedlink_master.h" | 15 #include "chrome/browser/visitedlink/visitedlink_master.h" |
| 16 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" | 16 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" |
| 17 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
| 18 #include "chrome/renderer/visitedlink_slave.h" | 18 #include "chrome/renderer/visitedlink_slave.h" |
| 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 21 #include "content/browser/browser_thread.h" | 21 #include "content/browser/browser_thread.h" |
| 22 #include "content/browser/renderer_host/browser_render_process_host.h" | 22 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 23 #include "content/common/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 24 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
| 25 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 // a nice long URL that we can append numbers to to get new URLs | 30 // a nice long URL that we can append numbers to to get new URLs |
| 31 const char g_test_prefix[] = | 31 const char g_test_prefix[] = |
| 32 "http://www.google.com/products/foo/index.html?id=45028640526508376&seq="; | 32 "http://www.google.com/products/foo/index.html?id=45028640526508376&seq="; |
| 33 const int g_test_count = 1000; | 33 const int g_test_count = 1000; |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 scoped_ptr<VisitedLinkEventListener> event_listener_; | 492 scoped_ptr<VisitedLinkEventListener> event_listener_; |
| 493 scoped_ptr<VisitedLinkMaster> visited_link_master_; | 493 scoped_ptr<VisitedLinkMaster> visited_link_master_; |
| 494 }; | 494 }; |
| 495 | 495 |
| 496 // Stub out as little as possible, borrowing from BrowserRenderProcessHost. | 496 // Stub out as little as possible, borrowing from BrowserRenderProcessHost. |
| 497 class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { | 497 class VisitRelayingRenderProcessHost : public BrowserRenderProcessHost { |
| 498 public: | 498 public: |
| 499 explicit VisitRelayingRenderProcessHost( | 499 explicit VisitRelayingRenderProcessHost( |
| 500 content::BrowserContext* browser_context) | 500 content::BrowserContext* browser_context) |
| 501 : BrowserRenderProcessHost(browser_context) { | 501 : BrowserRenderProcessHost(browser_context) { |
| 502 NotificationService::current()->Notify( | 502 content::NotificationService::current()->Notify( |
| 503 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 503 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 504 content::Source<RenderProcessHost>(this), | 504 content::Source<RenderProcessHost>(this), |
| 505 NotificationService::NoDetails()); | 505 content::NotificationService::NoDetails()); |
| 506 } | 506 } |
| 507 virtual ~VisitRelayingRenderProcessHost() { | 507 virtual ~VisitRelayingRenderProcessHost() { |
| 508 NotificationService::current()->Notify( | 508 content::NotificationService::current()->Notify( |
| 509 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 509 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 510 content::Source<RenderProcessHost>(this), | 510 content::Source<RenderProcessHost>(this), |
| 511 NotificationService::NoDetails()); | 511 content::NotificationService::NoDetails()); |
| 512 } | 512 } |
| 513 | 513 |
| 514 virtual bool Init(bool is_accessibility_enabled) { | 514 virtual bool Init(bool is_accessibility_enabled) { |
| 515 return true; | 515 return true; |
| 516 } | 516 } |
| 517 | 517 |
| 518 virtual void CancelResourceRequests(int render_widget_id) { | 518 virtual void CancelResourceRequests(int render_widget_id) { |
| 519 } | 519 } |
| 520 | 520 |
| 521 virtual void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params) { | 521 virtual void CrossSiteSwapOutACK(const ViewMsg_SwapOut_Params& params) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 EXPECT_EQ(1, profile()->add_event_count()); | 718 EXPECT_EQ(1, profile()->add_event_count()); |
| 719 EXPECT_EQ(0, profile()->reset_event_count()); | 719 EXPECT_EQ(0, profile()->reset_event_count()); |
| 720 | 720 |
| 721 // Activate the tab. | 721 // Activate the tab. |
| 722 rvh()->WasRestored(); | 722 rvh()->WasRestored(); |
| 723 | 723 |
| 724 // We should have only one more reset event. | 724 // We should have only one more reset event. |
| 725 EXPECT_EQ(1, profile()->add_event_count()); | 725 EXPECT_EQ(1, profile()->add_event_count()); |
| 726 EXPECT_EQ(1, profile()->reset_event_count()); | 726 EXPECT_EQ(1, profile()->reset_event_count()); |
| 727 } | 727 } |
| OLD | NEW |