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 "components/content_settings/core/common/content_settings.h" | 5 #include "components/content_settings/core/common/content_settings.h" |
6 #include "chrome/common/render_messages.h" | 6 #include "chrome/common/render_messages.h" |
7 #include "chrome/renderer/content_settings_observer.h" | 7 #include "chrome/renderer/content_settings_observer.h" |
8 #include "chrome/test/base/chrome_render_view_test.h" | 8 #include "chrome/test/base/chrome_render_view_test.h" |
9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
10 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 void(ContentSettingsType, const base::string16&)); | 27 void(ContentSettingsType, const base::string16&)); |
28 | 28 |
29 MOCK_METHOD5(OnAllowDOMStorage, | 29 MOCK_METHOD5(OnAllowDOMStorage, |
30 void(int, const GURL&, const GURL&, bool, IPC::Message*)); | 30 void(int, const GURL&, const GURL&, bool, IPC::Message*)); |
31 GURL image_url_; | 31 GURL image_url_; |
32 std::string image_origin_; | 32 std::string image_origin_; |
33 }; | 33 }; |
34 | 34 |
35 MockContentSettingsObserver::MockContentSettingsObserver( | 35 MockContentSettingsObserver::MockContentSettingsObserver( |
36 content::RenderFrame* render_frame) | 36 content::RenderFrame* render_frame) |
37 : ContentSettingsObserver(render_frame, NULL), | 37 : ContentSettingsObserver(render_frame, NULL, false), |
38 image_url_("http://www.foo.com/image.jpg"), | 38 image_url_("http://www.foo.com/image.jpg"), |
39 image_origin_("http://www.foo.com") { | 39 image_origin_("http://www.foo.com") { |
40 } | 40 } |
41 | 41 |
42 bool MockContentSettingsObserver::Send(IPC::Message* message) { | 42 bool MockContentSettingsObserver::Send(IPC::Message* message) { |
43 IPC_BEGIN_MESSAGE_MAP(MockContentSettingsObserver, *message) | 43 IPC_BEGIN_MESSAGE_MAP(MockContentSettingsObserver, *message) |
44 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, OnContentBlocked) | 44 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ContentBlocked, OnContentBlocked) |
45 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_AllowDOMStorage, | 45 IPC_MESSAGE_HANDLER_DELAY_REPLY(ChromeViewHostMsg_AllowDOMStorage, |
46 OnAllowDOMStorage) | 46 OnAllowDOMStorage) |
47 IPC_MESSAGE_UNHANDLED(ADD_FAILURE()) | 47 IPC_MESSAGE_UNHANDLED(ADD_FAILURE()) |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 was_blocked = true; | 366 was_blocked = true; |
367 } | 367 } |
368 EXPECT_FALSE(was_blocked); | 368 EXPECT_FALSE(was_blocked); |
369 | 369 |
370 // Verify that images are allowed. | 370 // Verify that images are allowed. |
371 EXPECT_CALL(mock_observer, OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES, | 371 EXPECT_CALL(mock_observer, OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES, |
372 base::string16())).Times(0); | 372 base::string16())).Times(0); |
373 EXPECT_TRUE(observer->allowImage(true, mock_observer.image_url_)); | 373 EXPECT_TRUE(observer->allowImage(true, mock_observer.image_url_)); |
374 ::testing::Mock::VerifyAndClearExpectations(&observer); | 374 ::testing::Mock::VerifyAndClearExpectations(&observer); |
375 } | 375 } |
OLD | NEW |