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 "base/values.h" | 5 #include "base/values.h" |
6 #include "chrome/browser/extensions/api/web_navigation/frame_navigation_state.h" | 6 #include "chrome/browser/extensions/api/web_navigation/frame_navigation_state.h" |
7 #include "chrome/test/base/testing_profile.h" | 7 #include "chrome/test/base/testing_profile.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
(...skipping 27 matching lines...) Expand all Loading... |
38 EXPECT_TRUE(navigation_state.IsValidFrame(frame_id2)); | 38 EXPECT_TRUE(navigation_state.IsValidFrame(frame_id2)); |
39 | 39 |
40 // Check frame state. | 40 // Check frame state. |
41 EXPECT_TRUE(navigation_state.IsMainFrame(frame_id1)); | 41 EXPECT_TRUE(navigation_state.IsMainFrame(frame_id1)); |
42 EXPECT_EQ(url1, navigation_state.GetUrl(frame_id1)); | 42 EXPECT_EQ(url1, navigation_state.GetUrl(frame_id1)); |
43 EXPECT_FALSE(navigation_state.IsMainFrame(frame_id2)); | 43 EXPECT_FALSE(navigation_state.IsMainFrame(frame_id2)); |
44 EXPECT_EQ(url2, navigation_state.GetUrl(frame_id2)); | 44 EXPECT_EQ(url2, navigation_state.GetUrl(frame_id2)); |
45 EXPECT_EQ(frame_id1, navigation_state.GetMainFrameID()); | 45 EXPECT_EQ(frame_id1, navigation_state.GetMainFrameID()); |
46 | 46 |
47 // Drop the frames. | 47 // Drop the frames. |
48 navigation_state.StopTrackingFramesInRVH(fake_rvh); | 48 navigation_state.StopTrackingFramesInRVH(fake_rvh, |
| 49 FrameNavigationState::FrameID()); |
49 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id1)); | 50 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id1)); |
50 EXPECT_FALSE(navigation_state.IsValidFrame(frame_id1)); | 51 EXPECT_FALSE(navigation_state.IsValidFrame(frame_id1)); |
51 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id2)); | 52 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id2)); |
52 EXPECT_FALSE(navigation_state.IsValidFrame(frame_id2)); | 53 EXPECT_FALSE(navigation_state.IsValidFrame(frame_id2)); |
53 } | 54 } |
54 | 55 |
55 // Test that no events can be sent for a frame after an error occurred, but | 56 // Test that no events can be sent for a frame after an error occurred, but |
56 // before a new navigation happened in this frame. | 57 // before a new navigation happened in this frame. |
57 TEST(FrameNavigationStateTest, ErrorState) { | 58 TEST(FrameNavigationStateTest, ErrorState) { |
58 FrameNavigationState navigation_state; | 59 FrameNavigationState navigation_state; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 TEST(FrameNavigationStateTest, WebSafeScheme) { | 113 TEST(FrameNavigationStateTest, WebSafeScheme) { |
113 FrameNavigationState navigation_state; | 114 FrameNavigationState navigation_state; |
114 const FrameNavigationState::FrameID frame_id(23, fake_rvh); | 115 const FrameNavigationState::FrameID frame_id(23, fake_rvh); |
115 const GURL url("unsafe://www.google.com/"); | 116 const GURL url("unsafe://www.google.com/"); |
116 | 117 |
117 navigation_state.TrackFrame(frame_id, url, true, false); | 118 navigation_state.TrackFrame(frame_id, url, true, false); |
118 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id)); | 119 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id)); |
119 } | 120 } |
120 | 121 |
121 } // namespace extensions | 122 } // namespace extensions |
OLD | NEW |