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 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2630 url_from_ipc, 1, base::string16(), false); | 2630 url_from_ipc, 1, base::string16(), false); |
2631 EXPECT_EQ(url_normalized, other_observer.last_url()); | 2631 EXPECT_EQ(url_normalized, other_observer.last_url()); |
2632 } | 2632 } |
2633 | 2633 |
2634 // Test that if a pending contents is deleted before it is shown, we don't | 2634 // Test that if a pending contents is deleted before it is shown, we don't |
2635 // crash. | 2635 // crash. |
2636 TEST_F(WebContentsImplTest, PendingContents) { | 2636 TEST_F(WebContentsImplTest, PendingContents) { |
2637 std::unique_ptr<TestWebContents> other_contents( | 2637 std::unique_ptr<TestWebContents> other_contents( |
2638 static_cast<TestWebContents*>(CreateTestWebContents())); | 2638 static_cast<TestWebContents*>(CreateTestWebContents())); |
2639 contents()->AddPendingContents(other_contents.get()); | 2639 contents()->AddPendingContents(other_contents.get()); |
| 2640 int process_id = other_contents->GetRenderViewHost()->GetProcess()->GetID(); |
2640 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); | 2641 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); |
2641 other_contents.reset(); | 2642 other_contents.reset(); |
2642 EXPECT_EQ(nullptr, contents()->GetCreatedWindow(route_id)); | 2643 EXPECT_EQ(nullptr, contents()->GetCreatedWindow(process_id, route_id)); |
2643 } | 2644 } |
2644 | 2645 |
2645 TEST_F(WebContentsImplTest, CapturerOverridesPreferredSize) { | 2646 TEST_F(WebContentsImplTest, CapturerOverridesPreferredSize) { |
2646 const gfx::Size original_preferred_size(1024, 768); | 2647 const gfx::Size original_preferred_size(1024, 768); |
2647 contents()->UpdatePreferredSize(original_preferred_size); | 2648 contents()->UpdatePreferredSize(original_preferred_size); |
2648 | 2649 |
2649 // With no capturers, expect the preferred size to be the one propagated into | 2650 // With no capturers, expect the preferred size to be the one propagated into |
2650 // WebContentsImpl via the RenderViewHostDelegate interface. | 2651 // WebContentsImpl via the RenderViewHostDelegate interface. |
2651 EXPECT_EQ(contents()->GetCapturerCount(), 0); | 2652 EXPECT_EQ(contents()->GetCapturerCount(), 0); |
2652 EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize()); | 2653 EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize()); |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3453 // An automatic navigation. | 3454 // An automatic navigation. |
3454 contents()->GetMainFrame()->SendNavigateWithModificationCallback( | 3455 contents()->GetMainFrame()->SendNavigateWithModificationCallback( |
3455 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); | 3456 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); |
3456 | 3457 |
3457 EXPECT_EQ(1u, dialog_manager.reset_count()); | 3458 EXPECT_EQ(1u, dialog_manager.reset_count()); |
3458 | 3459 |
3459 contents()->SetJavaScriptDialogManagerForTesting(nullptr); | 3460 contents()->SetJavaScriptDialogManagerForTesting(nullptr); |
3460 } | 3461 } |
3461 | 3462 |
3462 } // namespace content | 3463 } // namespace content |
OLD | NEW |