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 // Tests common functionality used by the Chrome Extensions webNavigation API | 5 // Tests common functionality used by the Chrome Extensions webNavigation API |
6 // implementation. | 6 // implementation. |
7 | 7 |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 9 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
| 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
10 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
11 #include "content/browser/renderer_host/test_render_view_host.h" | |
12 #include "content/browser/tab_contents/test_tab_contents.h" | 12 #include "content/browser/tab_contents/test_tab_contents.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 | 15 |
16 class FrameNavigationStateTest : public RenderViewHostTestHarness { | 16 class FrameNavigationStateTest : public ChromeRenderViewHostTestHarness { |
17 }; | 17 }; |
18 | 18 |
19 // Test that a frame is correctly tracked, and removed once the tab contents | 19 // Test that a frame is correctly tracked, and removed once the tab contents |
20 // goes away. | 20 // goes away. |
21 TEST_F(FrameNavigationStateTest, TrackFrame) { | 21 TEST_F(FrameNavigationStateTest, TrackFrame) { |
22 FrameNavigationState navigation_state; | 22 FrameNavigationState navigation_state; |
23 const int64 frame_id1 = 23; | 23 const int64 frame_id1 = 23; |
24 const int64 frame_id2 = 42; | 24 const int64 frame_id2 = 42; |
25 const GURL url1("http://www.google.com/"); | 25 const GURL url1("http://www.google.com/"); |
26 const GURL url2("http://mail.google.com/"); | 26 const GURL url2("http://mail.google.com/"); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 // Tests that no events are send for a not web-safe scheme. | 106 // Tests that no events are send for a not web-safe scheme. |
107 TEST_F(FrameNavigationStateTest, WebSafeScheme) { | 107 TEST_F(FrameNavigationStateTest, WebSafeScheme) { |
108 FrameNavigationState navigation_state; | 108 FrameNavigationState navigation_state; |
109 const int64 frame_id = 23; | 109 const int64 frame_id = 23; |
110 const GURL url("unsafe://www.google.com/"); | 110 const GURL url("unsafe://www.google.com/"); |
111 | 111 |
112 navigation_state.TrackFrame(frame_id, url, true, false); | 112 navigation_state.TrackFrame(frame_id, url, true, false); |
113 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id)); | 113 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id)); |
114 } | 114 } |
OLD | NEW |