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 <stdint.h> | 5 #include <stdint.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "content/public/test/test_utils.h" | 44 #include "content/public/test/test_utils.h" |
45 #include "content/test/test_content_browser_client.h" | 45 #include "content/test/test_content_browser_client.h" |
46 #include "content/test/test_content_client.h" | 46 #include "content/test/test_content_client.h" |
47 #include "content/test/test_render_frame_host.h" | 47 #include "content/test/test_render_frame_host.h" |
48 #include "content/test/test_render_view_host.h" | 48 #include "content/test/test_render_view_host.h" |
49 #include "content/test/test_web_contents.h" | 49 #include "content/test/test_web_contents.h" |
50 #include "net/base/test_data_directory.h" | 50 #include "net/base/test_data_directory.h" |
51 #include "net/test/cert_test_util.h" | 51 #include "net/test/cert_test_util.h" |
52 #include "testing/gtest/include/gtest/gtest.h" | 52 #include "testing/gtest/include/gtest/gtest.h" |
53 #include "third_party/skia/include/core/SkColor.h" | 53 #include "third_party/skia/include/core/SkColor.h" |
54 #include "url/url_constants.h" | |
55 | 54 |
56 namespace content { | 55 namespace content { |
57 namespace { | 56 namespace { |
58 | 57 |
59 class TestInterstitialPage; | 58 class TestInterstitialPage; |
60 | 59 |
61 class TestInterstitialPageDelegate : public InterstitialPageDelegate { | 60 class TestInterstitialPageDelegate : public InterstitialPageDelegate { |
62 public: | 61 public: |
63 explicit TestInterstitialPageDelegate(TestInterstitialPage* interstitial_page) | 62 explicit TestInterstitialPageDelegate(TestInterstitialPage* interstitial_page) |
64 : interstitial_page_(interstitial_page) {} | 63 : interstitial_page_(interstitial_page) {} |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 EXPECT_EQ( | 481 EXPECT_EQ( |
483 instance1, | 482 instance1, |
484 NavigationEntryImpl::FromNavigationEntry(controller().GetVisibleEntry())-> | 483 NavigationEntryImpl::FromNavigationEntry(controller().GetVisibleEntry())-> |
485 site_instance()); | 484 site_instance()); |
486 } | 485 } |
487 | 486 |
488 // Test that we reject NavigateToEntry if the url is over kMaxURLChars. | 487 // Test that we reject NavigateToEntry if the url is over kMaxURLChars. |
489 TEST_F(WebContentsImplTest, NavigateToExcessivelyLongURL) { | 488 TEST_F(WebContentsImplTest, NavigateToExcessivelyLongURL) { |
490 // Construct a URL that's kMaxURLChars + 1 long of all 'a's. | 489 // Construct a URL that's kMaxURLChars + 1 long of all 'a's. |
491 const GURL url(std::string("http://example.org/").append( | 490 const GURL url(std::string("http://example.org/").append( |
492 url::kMaxURLChars + 1, 'a')); | 491 kMaxURLChars + 1, 'a')); |
493 | 492 |
494 controller().LoadURL( | 493 controller().LoadURL( |
495 url, Referrer(), ui::PAGE_TRANSITION_GENERATED, std::string()); | 494 url, Referrer(), ui::PAGE_TRANSITION_GENERATED, std::string()); |
496 EXPECT_EQ(nullptr, controller().GetPendingEntry()); | 495 EXPECT_EQ(nullptr, controller().GetPendingEntry()); |
497 } | 496 } |
498 | 497 |
499 // Test that we reject NavigateToEntry if the url is invalid. | 498 // Test that we reject NavigateToEntry if the url is invalid. |
500 TEST_F(WebContentsImplTest, NavigateToInvalidURL) { | 499 TEST_F(WebContentsImplTest, NavigateToInvalidURL) { |
501 // Invalid URLs should not trigger a navigation. | 500 // Invalid URLs should not trigger a navigation. |
502 const GURL invalid_url("view-source:http://example.org/%00"); | 501 const GURL invalid_url("view-source:http://example.org/%00"); |
(...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3446 contents()->GetMainFrame()->PrepareForCommit(); | 3445 contents()->GetMainFrame()->PrepareForCommit(); |
3447 contents()->GetMainFrame()->SendNavigateWithModificationCallback( | 3446 contents()->GetMainFrame()->SendNavigateWithModificationCallback( |
3448 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); | 3447 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); |
3449 | 3448 |
3450 EXPECT_EQ(1u, delegate->reset_count()); | 3449 EXPECT_EQ(1u, delegate->reset_count()); |
3451 | 3450 |
3452 contents()->SetJavaScriptDialogManagerForTesting(nullptr); | 3451 contents()->SetJavaScriptDialogManagerForTesting(nullptr); |
3453 } | 3452 } |
3454 | 3453 |
3455 } // namespace content | 3454 } // namespace content |
OLD | NEW |