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" |
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 "base/time.h" | 15 #include "base/time.h" |
16 #include "chrome/browser/visitedlink/visitedlink_delegate.h" | |
17 #include "chrome/browser/visitedlink/visitedlink_event_listener.h" | |
18 #include "chrome/browser/visitedlink/visitedlink_master.h" | |
19 #include "chrome/common/render_messages.h" | |
20 #include "chrome/renderer/visitedlink_slave.h" | |
21 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
22 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 18 #include "components/visitedlink/browser/visitedlink_delegate.h" |
| 19 #include "components/visitedlink/browser/visitedlink_event_listener.h" |
| 20 #include "components/visitedlink/browser/visitedlink_master.h" |
| 21 #include "components/visitedlink/common/visitedlink_messages.h" |
| 22 #include "components/visitedlink/renderer/visitedlink_slave.h" |
23 #include "content/public/browser/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 "content/public/test/mock_render_process_host.h" | 25 #include "content/public/test/mock_render_process_host.h" |
26 #include "content/public/test/test_browser_context.h" | 26 #include "content/public/test/test_browser_context.h" |
27 #include "content/public/test/test_browser_thread.h" | 27 #include "content/public/test/test_browser_thread.h" |
28 #include "content/public/test/test_renderer_host.h" | 28 #include "content/public/test/test_renderer_host.h" |
29 #include "googleurl/src/gurl.h" | 29 #include "googleurl/src/gurl.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 | 31 |
32 using content::BrowserThread; | 32 using content::BrowserThread; |
33 using content::MockRenderProcessHost; | 33 using content::MockRenderProcessHost; |
34 using content::RenderViewHostTester; | 34 using content::RenderViewHostTester; |
35 | 35 |
| 36 namespace components { |
| 37 |
36 namespace { | 38 namespace { |
37 | 39 |
38 typedef std::vector<GURL> URLs; | 40 typedef std::vector<GURL> URLs; |
39 | 41 |
40 // a nice long URL that we can append numbers to to get new URLs | 42 // a nice long URL that we can append numbers to to get new URLs |
41 const char g_test_prefix[] = | 43 const char g_test_prefix[] = |
42 "http://www.google.com/products/foo/index.html?id=45028640526508376&seq="; | 44 "http://www.google.com/products/foo/index.html?id=45028640526508376&seq="; |
43 const int g_test_count = 1000; | 45 const int g_test_count = 1000; |
44 | 46 |
45 // Returns a test URL for index |i| | 47 // Returns a test URL for index |i| |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 EXPECT_EQ(1, profile()->add_event_count()); | 752 EXPECT_EQ(1, profile()->add_event_count()); |
751 EXPECT_EQ(0, profile()->reset_event_count()); | 753 EXPECT_EQ(0, profile()->reset_event_count()); |
752 | 754 |
753 // Activate the tab. | 755 // Activate the tab. |
754 RenderViewHostTester::For(rvh())->SimulateWasShown(); | 756 RenderViewHostTester::For(rvh())->SimulateWasShown(); |
755 | 757 |
756 // We should have only one more reset event. | 758 // We should have only one more reset event. |
757 EXPECT_EQ(1, profile()->add_event_count()); | 759 EXPECT_EQ(1, profile()->add_event_count()); |
758 EXPECT_EQ(1, profile()->reset_event_count()); | 760 EXPECT_EQ(1, profile()->reset_event_count()); |
759 } | 761 } |
| 762 |
| 763 } // namespace components |
OLD | NEW |