| 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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 ASSERT_FALSE(found); | 198 ASSERT_FALSE(found); |
| 199 found = slave.IsVisited(GURL("http://unfound.site/")); | 199 found = slave.IsVisited(GURL("http://unfound.site/")); |
| 200 ASSERT_FALSE(found); | 200 ASSERT_FALSE(found); |
| 201 | 201 |
| 202 master_->DebugValidate(); | 202 master_->DebugValidate(); |
| 203 | 203 |
| 204 g_slaves.clear(); | 204 g_slaves.clear(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 // testing::Test | 207 // testing::Test |
| 208 virtual void SetUp() { | 208 void SetUp() override { |
| 209 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 209 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 210 | 210 |
| 211 history_dir_ = temp_dir_.path().AppendASCII("VisitedLinkTest"); | 211 history_dir_ = temp_dir_.path().AppendASCII("VisitedLinkTest"); |
| 212 ASSERT_TRUE(base::CreateDirectory(history_dir_)); | 212 ASSERT_TRUE(base::CreateDirectory(history_dir_)); |
| 213 | 213 |
| 214 visited_file_ = history_dir_.Append(FILE_PATH_LITERAL("VisitedLinks")); | 214 visited_file_ = history_dir_.Append(FILE_PATH_LITERAL("VisitedLinks")); |
| 215 } | 215 } |
| 216 | 216 |
| 217 virtual void TearDown() { | 217 void TearDown() override { ClearDB(); } |
| 218 ClearDB(); | |
| 219 } | |
| 220 | 218 |
| 221 base::ScopedTempDir temp_dir_; | 219 base::ScopedTempDir temp_dir_; |
| 222 | 220 |
| 223 // Filenames for the services; | 221 // Filenames for the services; |
| 224 base::FilePath history_dir_; | 222 base::FilePath history_dir_; |
| 225 base::FilePath visited_file_; | 223 base::FilePath visited_file_; |
| 226 | 224 |
| 227 scoped_ptr<VisitedLinkMaster> master_; | 225 scoped_ptr<VisitedLinkMaster> master_; |
| 228 TestVisitedLinkDelegate delegate_; | 226 TestVisitedLinkDelegate delegate_; |
| 229 content::TestBrowserThreadBundle thread_bundle_; | 227 content::TestBrowserThreadBundle thread_bundle_; |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 content::SiteInstance* site_instance) const override { | 580 content::SiteInstance* site_instance) const override { |
| 583 return new VisitRelayingRenderProcessHost(browser_context); | 581 return new VisitRelayingRenderProcessHost(browser_context); |
| 584 } | 582 } |
| 585 | 583 |
| 586 private: | 584 private: |
| 587 DISALLOW_COPY_AND_ASSIGN(VisitedLinkRenderProcessHostFactory); | 585 DISALLOW_COPY_AND_ASSIGN(VisitedLinkRenderProcessHostFactory); |
| 588 }; | 586 }; |
| 589 | 587 |
| 590 class VisitedLinkEventsTest : public content::RenderViewHostTestHarness { | 588 class VisitedLinkEventsTest : public content::RenderViewHostTestHarness { |
| 591 public: | 589 public: |
| 592 virtual void SetUp() { | 590 void SetUp() override { |
| 593 SetRenderProcessHostFactory(&vc_rph_factory_); | 591 SetRenderProcessHostFactory(&vc_rph_factory_); |
| 594 content::RenderViewHostTestHarness::SetUp(); | 592 content::RenderViewHostTestHarness::SetUp(); |
| 595 } | 593 } |
| 596 | 594 |
| 597 content::BrowserContext* CreateBrowserContext() override { | 595 content::BrowserContext* CreateBrowserContext() override { |
| 598 VisitCountingContext* context = new VisitCountingContext(); | 596 VisitCountingContext* context = new VisitCountingContext(); |
| 599 master_.reset(new VisitedLinkMaster(context, &delegate_, true)); | 597 master_.reset(new VisitedLinkMaster(context, &delegate_, true)); |
| 600 master_->Init(); | 598 master_->Init(); |
| 601 return context; | 599 return context; |
| 602 } | 600 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 content::NotificationService::current()->Notify( | 758 content::NotificationService::current()->Notify( |
| 761 content::NOTIFICATION_RENDERER_PROCESS_CREATED, | 759 content::NOTIFICATION_RENDERER_PROCESS_CREATED, |
| 762 content::Source<content::RenderProcessHost>(&different_process_host), | 760 content::Source<content::RenderProcessHost>(&different_process_host), |
| 763 content::NotificationService::NoDetails()); | 761 content::NotificationService::NoDetails()); |
| 764 WaitForCoalescense(); | 762 WaitForCoalescense(); |
| 765 | 763 |
| 766 EXPECT_EQ(0, different_context.new_table_count()); | 764 EXPECT_EQ(0, different_context.new_table_count()); |
| 767 } | 765 } |
| 768 | 766 |
| 769 } // namespace visitedlink | 767 } // namespace visitedlink |
| OLD | NEW |