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" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 #include "app/app_paths.h" | 13 #include "app/app_paths.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "chrome/browser/blocked_popup_container.h" | 15 #include "chrome/browser/blocked_popup_container.h" |
16 #include "chrome/browser/tab_contents/test_web_contents.h" | 16 #include "chrome/browser/tab_contents/test_web_contents.h" |
17 #include "chrome/browser/renderer_host/test_render_view_host.h" | 17 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
18 #include "chrome/test/testing_profile.h" | 18 #include "chrome/test/testing_profile.h" |
19 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 const std::string host1 = "host1"; | 22 const std::string host1 = "host1"; |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 // Mock for our view. | 25 // Mock for our view. |
26 class MockBlockedPopupContainerView : public BlockedPopupContainerView { | 26 class MockBlockedPopupContainerView : public BlockedPopupContainerView { |
27 public: | 27 public: |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |