| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 517 } |
| 518 | 518 |
| 519 virtual bool WaitForPaintMsg(int render_widget_id, | 519 virtual bool WaitForPaintMsg(int render_widget_id, |
| 520 const base::TimeDelta& max_delay, | 520 const base::TimeDelta& max_delay, |
| 521 IPC::Message* msg) { | 521 IPC::Message* msg) { |
| 522 return false; | 522 return false; |
| 523 } | 523 } |
| 524 | 524 |
| 525 virtual bool Send(IPC::Message* msg) { | 525 virtual bool Send(IPC::Message* msg) { |
| 526 VisitCountingProfile* counting_profile = | 526 VisitCountingProfile* counting_profile = |
| 527 static_cast<VisitCountingProfile*>(profile()); | 527 static_cast<VisitCountingProfile*>( |
| 528 Profile::FromBrowserContext(browser_context())); |
| 528 | 529 |
| 529 if (msg->type() == ViewMsg_VisitedLink_Add::ID) { | 530 if (msg->type() == ViewMsg_VisitedLink_Add::ID) { |
| 530 void* iter = NULL; | 531 void* iter = NULL; |
| 531 std::vector<uint64> fingerprints; | 532 std::vector<uint64> fingerprints; |
| 532 CHECK(IPC::ReadParam(msg, &iter, &fingerprints)); | 533 CHECK(IPC::ReadParam(msg, &iter, &fingerprints)); |
| 533 counting_profile->CountAddEvent(fingerprints.size()); | 534 counting_profile->CountAddEvent(fingerprints.size()); |
| 534 } else if (msg->type() == ViewMsg_VisitedLink_Reset::ID) { | 535 } else if (msg->type() == ViewMsg_VisitedLink_Reset::ID) { |
| 535 counting_profile->CountResetEvent(); | 536 counting_profile->CountResetEvent(); |
| 536 } | 537 } |
| 537 | 538 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 EXPECT_EQ(1, profile()->add_event_count()); | 720 EXPECT_EQ(1, profile()->add_event_count()); |
| 720 EXPECT_EQ(0, profile()->reset_event_count()); | 721 EXPECT_EQ(0, profile()->reset_event_count()); |
| 721 | 722 |
| 722 // Activate the tab. | 723 // Activate the tab. |
| 723 rvh()->WasRestored(); | 724 rvh()->WasRestored(); |
| 724 | 725 |
| 725 // We should have only one more reset event. | 726 // We should have only one more reset event. |
| 726 EXPECT_EQ(1, profile()->add_event_count()); | 727 EXPECT_EQ(1, profile()->add_event_count()); |
| 727 EXPECT_EQ(1, profile()->reset_event_count()); | 728 EXPECT_EQ(1, profile()->reset_event_count()); |
| 728 } | 729 } |
| OLD | NEW |