OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string16.h" | 5 #include "base/string16.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "content/browser/site_instance.h" | 8 #include "content/browser/site_instance.h" |
9 #include "content/browser/tab_contents/navigation_entry.h" | 9 #include "content/browser/tab_contents/navigation_entry.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 EXPECT_FALSE(entry2_.get()->has_post_data()); | 180 EXPECT_FALSE(entry2_.get()->has_post_data()); |
181 entry2_.get()->set_has_post_data(true); | 181 entry2_.get()->set_has_post_data(true); |
182 EXPECT_TRUE(entry2_.get()->has_post_data()); | 182 EXPECT_TRUE(entry2_.get()->has_post_data()); |
183 | 183 |
184 // Restored | 184 // Restored |
185 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); | 185 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); |
186 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); | 186 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); |
187 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); | 187 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); |
188 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); | 188 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); |
189 } | 189 } |
| 190 |
| 191 // Test whether entries are browser-initiated. |
| 192 TEST_F(NavigationEntryTest, NavigationEntryBrowserInitiated) { |
| 193 // Link clicks and form submissions are renderer-initiated. |
| 194 EXPECT_EQ(PageTransition::LINK, entry1_.get()->transition_type()); |
| 195 EXPECT_FALSE(entry1_.get()->IsBrowserInitiated()); |
| 196 entry1_.get()->set_transition_type(PageTransition::FORM_SUBMIT); |
| 197 EXPECT_FALSE(entry1_.get()->IsBrowserInitiated()); |
| 198 |
| 199 // Typed URLs are browser-initiated. |
| 200 EXPECT_EQ(PageTransition::TYPED, entry2_.get()->transition_type()); |
| 201 EXPECT_TRUE(entry2_.get()->IsBrowserInitiated()); |
| 202 } |
OLD | NEW |