OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 WaitForCoalescense(); | 669 WaitForCoalescense(); |
670 | 670 |
671 // We should have no change in results except for one new reset event. | 671 // We should have no change in results except for one new reset event. |
672 EXPECT_EQ(6, profile()->add_count()); | 672 EXPECT_EQ(6, profile()->add_count()); |
673 EXPECT_EQ(2, profile()->add_event_count()); | 673 EXPECT_EQ(2, profile()->add_event_count()); |
674 EXPECT_EQ(1, profile()->reset_event_count()); | 674 EXPECT_EQ(1, profile()->reset_event_count()); |
675 } | 675 } |
676 | 676 |
677 TEST_F(VisitedLinkRelayTest, Basics) { | 677 TEST_F(VisitedLinkRelayTest, Basics) { |
678 VisitedLinkMaster* master = profile_->GetVisitedLinkMaster(); | 678 VisitedLinkMaster* master = profile_->GetVisitedLinkMaster(); |
679 rvh()->CreateRenderView(profile_->GetRequestContext(), string16()); | 679 rvh()->CreateRenderView(string16()); |
680 | 680 |
681 // Add a few URLs. | 681 // Add a few URLs. |
682 master->AddURL(GURL("http://acidtests.org/")); | 682 master->AddURL(GURL("http://acidtests.org/")); |
683 master->AddURL(GURL("http://google.com/")); | 683 master->AddURL(GURL("http://google.com/")); |
684 master->AddURL(GURL("http://chromium.org/")); | 684 master->AddURL(GURL("http://chromium.org/")); |
685 | 685 |
686 WaitForCoalescense(); | 686 WaitForCoalescense(); |
687 | 687 |
688 // We now should have 1 add event. | 688 // We now should have 1 add event. |
689 EXPECT_EQ(1, profile()->add_event_count()); | 689 EXPECT_EQ(1, profile()->add_event_count()); |
690 EXPECT_EQ(0, profile()->reset_event_count()); | 690 EXPECT_EQ(0, profile()->reset_event_count()); |
691 | 691 |
692 master->DeleteAllURLs(); | 692 master->DeleteAllURLs(); |
693 | 693 |
694 WaitForCoalescense(); | 694 WaitForCoalescense(); |
695 | 695 |
696 // We should have no change in add results, plus one new reset event. | 696 // We should have no change in add results, plus one new reset event. |
697 EXPECT_EQ(1, profile()->add_event_count()); | 697 EXPECT_EQ(1, profile()->add_event_count()); |
698 EXPECT_EQ(1, profile()->reset_event_count()); | 698 EXPECT_EQ(1, profile()->reset_event_count()); |
699 } | 699 } |
700 | 700 |
701 TEST_F(VisitedLinkRelayTest, TabVisibility) { | 701 TEST_F(VisitedLinkRelayTest, TabVisibility) { |
702 VisitedLinkMaster* master = profile_->GetVisitedLinkMaster(); | 702 VisitedLinkMaster* master = profile_->GetVisitedLinkMaster(); |
703 rvh()->CreateRenderView(profile_->GetRequestContext(), string16()); | 703 rvh()->CreateRenderView(string16()); |
704 | 704 |
705 // Simulate tab becoming inactive. | 705 // Simulate tab becoming inactive. |
706 rvh()->WasHidden(); | 706 rvh()->WasHidden(); |
707 | 707 |
708 // Add a few URLs. | 708 // Add a few URLs. |
709 master->AddURL(GURL("http://acidtests.org/")); | 709 master->AddURL(GURL("http://acidtests.org/")); |
710 master->AddURL(GURL("http://google.com/")); | 710 master->AddURL(GURL("http://google.com/")); |
711 master->AddURL(GURL("http://chromium.org/")); | 711 master->AddURL(GURL("http://chromium.org/")); |
712 | 712 |
713 WaitForCoalescense(); | 713 WaitForCoalescense(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 756 |
757 std::set<GURL> deleted_urls; | 757 std::set<GURL> deleted_urls; |
758 deleted_urls.insert(GURL("http://acidtests.org/")); | 758 deleted_urls.insert(GURL("http://acidtests.org/")); |
759 master->DeleteURLs(deleted_urls); | 759 master->DeleteURLs(deleted_urls); |
760 | 760 |
761 // We shouldn't have any events, because RenderView hasn't been created, | 761 // We shouldn't have any events, because RenderView hasn't been created, |
762 // and we ensure that updates are sent until it is. | 762 // and we ensure that updates are sent until it is. |
763 EXPECT_EQ(0, profile()->add_event_count()); | 763 EXPECT_EQ(0, profile()->add_event_count()); |
764 EXPECT_EQ(0, profile()->reset_event_count()); | 764 EXPECT_EQ(0, profile()->reset_event_count()); |
765 | 765 |
766 rvh()->CreateRenderView(profile_->GetRequestContext(), string16()); | 766 rvh()->CreateRenderView(string16()); |
767 | 767 |
768 // We should now have just a reset event: adds are eaten up by a reset | 768 // We should now have just a reset event: adds are eaten up by a reset |
769 // that followed. | 769 // that followed. |
770 EXPECT_EQ(0, profile()->add_event_count()); | 770 EXPECT_EQ(0, profile()->add_event_count()); |
771 EXPECT_EQ(1, profile()->reset_event_count()); | 771 EXPECT_EQ(1, profile()->reset_event_count()); |
772 } | 772 } |
OLD | NEW |