| 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 // 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/api/web_navigation/web_navigation_api.h" |
| 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace extensions { |
| 14 | 15 |
| 15 class FrameNavigationStateTest : public ChromeRenderViewHostTestHarness { | 16 class FrameNavigationStateTest : public ChromeRenderViewHostTestHarness { |
| 16 }; | 17 }; |
| 17 | 18 |
| 18 // 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 |
| 19 // goes away. | 20 // goes away. |
| 20 TEST_F(FrameNavigationStateTest, TrackFrame) { | 21 TEST_F(FrameNavigationStateTest, TrackFrame) { |
| 21 FrameNavigationState navigation_state; | 22 FrameNavigationState navigation_state; |
| 22 const int64 frame_id1 = 23; | 23 const int64 frame_id1 = 23; |
| 23 const int64 frame_id2 = 42; | 24 const int64 frame_id2 = 42; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 // 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. |
| 106 TEST_F(FrameNavigationStateTest, WebSafeScheme) { | 107 TEST_F(FrameNavigationStateTest, WebSafeScheme) { |
| 107 FrameNavigationState navigation_state; | 108 FrameNavigationState navigation_state; |
| 108 const int64 frame_id = 23; | 109 const int64 frame_id = 23; |
| 109 const GURL url("unsafe://www.google.com/"); | 110 const GURL url("unsafe://www.google.com/"); |
| 110 | 111 |
| 111 navigation_state.TrackFrame(frame_id, url, true, false); | 112 navigation_state.TrackFrame(frame_id, url, true, false); |
| 112 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id)); | 113 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id)); |
| 113 } | 114 } |
| 115 |
| 116 } // namespace extensions |
| OLD | NEW |