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/testing_browser_process_test.h" | |
20 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
21 #include "content/browser/browser_thread.h" | 20 #include "content/browser/browser_thread.h" |
22 #include "content/browser/renderer_host/browser_render_process_host.h" | 21 #include "content/browser/renderer_host/browser_render_process_host.h" |
23 #include "content/browser/renderer_host/test_render_view_host.h" | 22 #include "content/browser/renderer_host/test_render_view_host.h" |
24 #include "content/common/notification_service.h" | 23 #include "content/common/notification_service.h" |
25 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
27 | 26 |
28 namespace { | 27 namespace { |
29 | 28 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 65 } |
67 | 66 |
68 int reset_count() const { return reset_count_; } | 67 int reset_count() const { return reset_count_; } |
69 int add_count() const { return add_count_; } | 68 int add_count() const { return add_count_; } |
70 | 69 |
71 private: | 70 private: |
72 int reset_count_; | 71 int reset_count_; |
73 int add_count_; | 72 int add_count_; |
74 }; | 73 }; |
75 | 74 |
76 class VisitedLinkTest : public TestingBrowserProcessTest { | 75 class VisitedLinkTest : public testing::Test { |
77 protected: | 76 protected: |
78 VisitedLinkTest() | 77 VisitedLinkTest() |
79 : ui_thread_(BrowserThread::UI, &message_loop_), | 78 : ui_thread_(BrowserThread::UI, &message_loop_), |
80 file_thread_(BrowserThread::FILE, &message_loop_) {} | 79 file_thread_(BrowserThread::FILE, &message_loop_) {} |
81 // Initialize the history system. This should be called before InitVisited(). | 80 // Initialize the history system. This should be called before InitVisited(). |
82 bool InitHistory() { | 81 bool InitHistory() { |
83 history_service_ = new HistoryService; | 82 history_service_ = new HistoryService; |
84 return history_service_->Init(history_dir_, NULL); | 83 return history_service_->Init(history_dir_, NULL); |
85 } | 84 } |
86 | 85 |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 EXPECT_EQ(1, profile()->add_event_count()); | 720 EXPECT_EQ(1, profile()->add_event_count()); |
722 EXPECT_EQ(0, profile()->reset_event_count()); | 721 EXPECT_EQ(0, profile()->reset_event_count()); |
723 | 722 |
724 // Activate the tab. | 723 // Activate the tab. |
725 rvh()->WasRestored(); | 724 rvh()->WasRestored(); |
726 | 725 |
727 // We should have only one more reset event. | 726 // We should have only one more reset event. |
728 EXPECT_EQ(1, profile()->add_event_count()); | 727 EXPECT_EQ(1, profile()->add_event_count()); |
729 EXPECT_EQ(1, profile()->reset_event_count()); | 728 EXPECT_EQ(1, profile()->reset_event_count()); |
730 } | 729 } |
OLD | NEW |