OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Tests the cross platform BlockedPopupContainer model/controller object. | 5 // Tests the cross platform BlockedPopupContainer model/controller object. |
6 // | 6 // |
7 // TODO(erg): The unit tests on BlockedPopupContainer need to be greatly | 7 // TODO(erg): The unit tests on BlockedPopupContainer need to be greatly |
8 // expanded. | 8 // expanded. |
9 | 9 |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 FilePath filename; | 46 FilePath filename; |
47 PathService::Get(app::DIR_TEST_DATA, &filename); | 47 PathService::Get(app::DIR_TEST_DATA, &filename); |
48 filename = filename.AppendASCII("constrained_files"); | 48 filename = filename.AppendASCII("constrained_files"); |
49 filename = filename.AppendASCII(file); | 49 filename = filename.AppendASCII(file); |
50 return net::FilePathToFileURL(filename); | 50 return net::FilePathToFileURL(filename); |
51 } | 51 } |
52 | 52 |
53 protected: | 53 protected: |
54 virtual void SetUp() { | 54 virtual void SetUp() { |
55 RenderViewHostTestHarness::SetUp(); | 55 RenderViewHostTestHarness::SetUp(); |
56 container_ = new BlockedPopupContainer(contents(), profile()->GetPrefs()); | 56 container_ = new BlockedPopupContainer(contents(), profile()); |
57 container_->set_view(&mock); | 57 container_->set_view(&mock); |
58 | 58 |
59 contents_->set_blocked_popup_container(container_); | 59 contents_->set_blocked_popup_container(container_); |
60 } | 60 } |
61 | 61 |
62 // Our blocked popup container that we are testing. WARNING: If you are | 62 // Our blocked popup container that we are testing. WARNING: If you are |
63 // trying to test destruction issues, make sure to remove |container_| from | 63 // trying to test destruction issues, make sure to remove |container_| from |
64 // |contents_|. | 64 // |contents_|. |
65 BlockedPopupContainer* container_; | 65 BlockedPopupContainer* container_; |
66 | 66 |
(...skipping 26 matching lines...) Expand all Loading... |
93 popup->controller().LoadURLLazily(GetTestCase("error"), GURL(), | 93 popup->controller().LoadURLLazily(GetTestCase("error"), GURL(), |
94 PageTransition::LINK, | 94 PageTransition::LINK, |
95 L"", NULL); | 95 L"", NULL); |
96 container_->AddTabContents(popup, gfx::Rect(), host1); | 96 container_->AddTabContents(popup, gfx::Rect(), host1); |
97 | 97 |
98 EXPECT_EQ(container_->GetBlockedPopupCount(), static_cast<size_t>(1)); | 98 EXPECT_EQ(container_->GetBlockedPopupCount(), static_cast<size_t>(1)); |
99 EXPECT_EQ(container_->GetTabContentsAt(0), popup); | 99 EXPECT_EQ(container_->GetTabContentsAt(0), popup); |
100 EXPECT_FALSE(container_->IsHostWhitelisted(0)); | 100 EXPECT_FALSE(container_->IsHostWhitelisted(0)); |
101 EXPECT_THAT(container_->GetHosts(), testing::Contains(host1)); | 101 EXPECT_THAT(container_->GetHosts(), testing::Contains(host1)); |
102 } | 102 } |
OLD | NEW |