OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <cstdio> | 5 #include <cstdio> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 master->AddURL(GURL("http://google.com/")); | 694 master->AddURL(GURL("http://google.com/")); |
695 master->AddURL(GURL("http://chromium.org/")); | 695 master->AddURL(GURL("http://chromium.org/")); |
696 | 696 |
697 WaitForCoalescense(); | 697 WaitForCoalescense(); |
698 | 698 |
699 // We shouldn't have any events. | 699 // We shouldn't have any events. |
700 EXPECT_EQ(0, profile()->add_event_count()); | 700 EXPECT_EQ(0, profile()->add_event_count()); |
701 EXPECT_EQ(0, profile()->reset_event_count()); | 701 EXPECT_EQ(0, profile()->reset_event_count()); |
702 | 702 |
703 // Simulate the tab becoming active. | 703 // Simulate the tab becoming active. |
704 rvh_tester()->SimulateWasRestored(); | 704 rvh_tester()->SimulateWasShown(); |
705 | 705 |
706 // We should now have 3 add events, still no reset events. | 706 // We should now have 3 add events, still no reset events. |
707 EXPECT_EQ(1, profile()->add_event_count()); | 707 EXPECT_EQ(1, profile()->add_event_count()); |
708 EXPECT_EQ(0, profile()->reset_event_count()); | 708 EXPECT_EQ(0, profile()->reset_event_count()); |
709 | 709 |
710 // Deactivate the tab again. | 710 // Deactivate the tab again. |
711 rvh_tester()->SimulateWasHidden(); | 711 rvh_tester()->SimulateWasHidden(); |
712 | 712 |
713 // Add a bunch of URLs (over 50) to exhaust the link event buffer. | 713 // Add a bunch of URLs (over 50) to exhaust the link event buffer. |
714 for (int i = 0; i < 100; i++) | 714 for (int i = 0; i < 100; i++) |
715 master->AddURL(TestURL(i)); | 715 master->AddURL(TestURL(i)); |
716 | 716 |
717 WaitForCoalescense(); | 717 WaitForCoalescense(); |
718 | 718 |
719 // Again, no change in events until tab is active. | 719 // Again, no change in events until tab is active. |
720 EXPECT_EQ(1, profile()->add_event_count()); | 720 EXPECT_EQ(1, profile()->add_event_count()); |
721 EXPECT_EQ(0, profile()->reset_event_count()); | 721 EXPECT_EQ(0, profile()->reset_event_count()); |
722 | 722 |
723 // Activate the tab. | 723 // Activate the tab. |
724 rvh_tester()->SimulateWasRestored(); | 724 rvh_tester()->SimulateWasShown(); |
725 | 725 |
726 // We should have only one more reset event. | 726 // We should have only one more reset event. |
727 EXPECT_EQ(1, profile()->add_event_count()); | 727 EXPECT_EQ(1, profile()->add_event_count()); |
728 EXPECT_EQ(1, profile()->reset_event_count()); | 728 EXPECT_EQ(1, profile()->reset_event_count()); |
729 } | 729 } |
OLD | NEW |