| 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" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_thread.h" | |
| 12 #include "chrome/browser/extensions/extension_webnavigation_api.h" | 11 #include "chrome/browser/extensions/extension_webnavigation_api.h" |
| 13 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 12 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 14 #include "chrome/browser/tab_contents/test_tab_contents.h" | 13 #include "chrome/browser/tab_contents/test_tab_contents.h" |
| 15 #include "chrome/test/testing_profile.h" | 14 #include "chrome/test/testing_profile.h" |
| 16 | 15 |
| 17 | 16 |
| 18 class FrameNavigationStateTest : public RenderViewHostTestHarness { | 17 class FrameNavigationStateTest : public RenderViewHostTestHarness { |
| 19 }; | 18 }; |
| 20 | 19 |
| 21 // Test that a frame is correctly tracked, and removed once the tab contents | 20 // Test that a frame is correctly tracked, and removed once the tab contents |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // Navigations to a network error page should be ignored. | 93 // Navigations to a network error page should be ignored. |
| 95 navigation_state.TrackFrame(frame_id2, GURL(), false, true, contents()); | 94 navigation_state.TrackFrame(frame_id2, GURL(), false, true, contents()); |
| 96 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id1)); | 95 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id1)); |
| 97 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id2)); | 96 EXPECT_FALSE(navigation_state.CanSendEvents(frame_id2)); |
| 98 | 97 |
| 99 // However, when the frame navigates again, it should send events again. | 98 // However, when the frame navigates again, it should send events again. |
| 100 navigation_state.TrackFrame(frame_id2, url, false, false, contents()); | 99 navigation_state.TrackFrame(frame_id2, url, false, false, contents()); |
| 101 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id1)); | 100 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id1)); |
| 102 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id2)); | 101 EXPECT_TRUE(navigation_state.CanSendEvents(frame_id2)); |
| 103 } | 102 } |
| OLD | NEW |