OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" | |
9 | |
10 #include "base/values.h" | 8 #include "base/values.h" |
11 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 9 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
12 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | |
13 #include "chrome/browser/tab_contents/test_tab_contents.h" | |
14 #include "chrome/test/testing_profile.h" | 10 #include "chrome/test/testing_profile.h" |
| 11 #include "content/browser/renderer_host/test_render_view_host.h" |
| 12 #include "content/browser/tab_contents/test_tab_contents.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" |
15 | 14 |
16 | 15 |
17 class FrameNavigationStateTest : public RenderViewHostTestHarness { | 16 class FrameNavigationStateTest : public RenderViewHostTestHarness { |
18 }; | 17 }; |
19 | 18 |
20 // 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 |
21 // goes away. | 20 // goes away. |
22 TEST_F(FrameNavigationStateTest, TrackFrame) { | 21 TEST_F(FrameNavigationStateTest, TrackFrame) { |
23 FrameNavigationState navigation_state; | 22 FrameNavigationState navigation_state; |
24 const int64 frame_id1 = 23; | 23 const int64 frame_id1 = 23; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Navigations to a network error page should be ignored. | 92 // Navigations to a network error page should be ignored. |
94 navigation_state.TrackFrame(frame_id2, GURL(), false, true, contents()); | 93 navigation_state.TrackFrame(frame_id2, GURL(), false, true, contents()); |
95 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id1)); | 94 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id1)); |
96 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id2)); | 95 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id2)); |
97 | 96 |
98 // However, when the frame navigates again, it should send events again. | 97 // However, when the frame navigates again, it should send events again. |
99 navigation_state.TrackFrame(frame_id2, url, false, false, contents()); | 98 navigation_state.TrackFrame(frame_id2, url, false, false, contents()); |
100 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id1)); | 99 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id1)); |
101 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id2)); | 100 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id2)); |
102 } | 101 } |
OLD | NEW |