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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "chrome/browser/extensions/api/web_navigation/frame_navigation_state.h" | 7 #include "chrome/browser/extensions/api/web_navigation/frame_navigation_state.h" |
8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 | 13 |
14 class FrameNavigationStateTest : public ChromeRenderViewHostTestHarness { | 14 class FrameNavigationStateTest : public ChromeRenderViewHostTestHarness { |
| 15 public: |
| 16 void SetUp() override { |
| 17 ChromeRenderViewHostTestHarness::SetUp(); |
| 18 |
| 19 content::RenderFrameHostTester::For(main_rfh()) |
| 20 ->InitializeRenderFrameIfNeeded(); |
| 21 } |
| 22 |
15 protected: | 23 protected: |
16 FrameNavigationStateTest() {} | 24 FrameNavigationStateTest() {} |
17 ~FrameNavigationStateTest() override {} | 25 ~FrameNavigationStateTest() override {} |
18 | 26 |
19 FrameNavigationState navigation_state_; | 27 FrameNavigationState navigation_state_; |
20 | 28 |
21 private: | 29 private: |
22 DISALLOW_COPY_AND_ASSIGN(FrameNavigationStateTest); | 30 DISALLOW_COPY_AND_ASSIGN(FrameNavigationStateTest); |
23 }; | 31 }; |
24 | 32 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 EXPECT_EQ(url2, navigation_state_.GetUrl(sub_frame)); | 176 EXPECT_EQ(url2, navigation_state_.GetUrl(sub_frame)); |
169 | 177 |
170 // Drop one frame. | 178 // Drop one frame. |
171 navigation_state_.FrameHostDeleted(sub_frame); | 179 navigation_state_.FrameHostDeleted(sub_frame); |
172 EXPECT_EQ(url1, navigation_state_.GetUrl(main_rfh())); | 180 EXPECT_EQ(url1, navigation_state_.GetUrl(main_rfh())); |
173 EXPECT_FALSE(navigation_state_.CanSendEvents(sub_frame)); | 181 EXPECT_FALSE(navigation_state_.CanSendEvents(sub_frame)); |
174 EXPECT_FALSE(navigation_state_.IsValidFrame(sub_frame)); | 182 EXPECT_FALSE(navigation_state_.IsValidFrame(sub_frame)); |
175 } | 183 } |
176 | 184 |
177 } // namespace extensions | 185 } // namespace extensions |
OLD | NEW |