Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1382)

Side by Side Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 12210048: Prevent bindings escalation on an existing NavigationEntry (attempt 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change URL in test. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/web_contents/navigation_controller_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/defaults.h" 10 #include "chrome/browser/defaults.h"
(...skipping 17 matching lines...) Expand all
28 #include "chrome/common/chrome_notification_types.h" 28 #include "chrome/common/chrome_notification_types.h"
29 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
31 #include "chrome/test/base/in_process_browser_test.h" 31 #include "chrome/test/base/in_process_browser_test.h"
32 #include "chrome/test/base/ui_test_utils.h" 32 #include "chrome/test/base/ui_test_utils.h"
33 #include "content/public/browser/navigation_controller.h" 33 #include "content/public/browser/navigation_controller.h"
34 #include "content/public/browser/navigation_entry.h" 34 #include "content/public/browser/navigation_entry.h"
35 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
36 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
37 #include "content/public/browser/render_process_host.h" 37 #include "content/public/browser/render_process_host.h"
38 #include "content/public/browser/render_view_host.h"
38 #include "content/public/browser/web_contents.h" 39 #include "content/public/browser/web_contents.h"
40 #include "content/public/common/bindings_policy.h"
39 #include "content/public/common/page_transition_types.h" 41 #include "content/public/common/page_transition_types.h"
40 #include "content/public/test/test_navigation_observer.h" 42 #include "content/public/test/test_navigation_observer.h"
41 #include "sync/protocol/session_specifics.pb.h" 43 #include "sync/protocol/session_specifics.pb.h"
42 44
43 #if defined(OS_MACOSX) 45 #if defined(OS_MACOSX)
44 #include "base/mac/scoped_nsautorelease_pool.h" 46 #include "base/mac/scoped_nsautorelease_pool.h"
45 #endif 47 #endif
46 48
47 class SessionRestoreTest : public InProcessBrowserTest { 49 class SessionRestoreTest : public InProcessBrowserTest {
48 public: 50 public:
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 578
577 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 579 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
578 ASSERT_EQ(1u, native_browser_list->size()); 580 ASSERT_EQ(1u, native_browser_list->size());
579 ASSERT_EQ(url2_, 581 ASSERT_EQ(url2_,
580 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); 582 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL());
581 GoBack(new_browser); 583 GoBack(new_browser);
582 ASSERT_EQ(url1_, 584 ASSERT_EQ(url1_,
583 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); 585 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL());
584 } 586 }
585 587
588 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWebUI) {
589 const GURL webui_url("chrome://newtab");
590 ui_test_utils::NavigateToURL(browser(), webui_url);
591 const content::WebContents* old_tab =
592 browser()->tab_strip_model()->GetActiveWebContents();
593 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI,
594 old_tab->GetRenderViewHost()->GetEnabledBindings());
595
596 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
597 ASSERT_EQ(1u, native_browser_list->size());
598 const content::WebContents* new_tab =
599 new_browser->tab_strip_model()->GetActiveWebContents();
600 EXPECT_EQ(webui_url, new_tab->GetURL());
601 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI,
602 new_tab->GetRenderViewHost()->GetEnabledBindings());
603 }
604
586 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoresForwardAndBackwardNavs) { 605 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoresForwardAndBackwardNavs) {
587 ui_test_utils::NavigateToURL(browser(), url1_); 606 ui_test_utils::NavigateToURL(browser(), url1_);
588 ui_test_utils::NavigateToURL(browser(), url2_); 607 ui_test_utils::NavigateToURL(browser(), url2_);
589 ui_test_utils::NavigateToURL(browser(), url3_); 608 ui_test_utils::NavigateToURL(browser(), url3_);
590 609
591 GoBack(browser()); 610 GoBack(browser());
592 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 611 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
593 ASSERT_EQ(1u, native_browser_list->size()); 612 ASSERT_EQ(1u, native_browser_list->size());
594 ASSERT_EQ(url2_, 613 ASSERT_EQ(url2_,
595 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL()); 614 new_browser->tab_strip_model()->GetActiveWebContents()->GetURL());
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 content::NavigationController* controller = 962 content::NavigationController* controller =
944 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); 963 &browser()->tab_strip_model()->GetActiveWebContents()->GetController();
945 EXPECT_TRUE( 964 EXPECT_TRUE(
946 controller->GetDefaultSessionStorageNamespace()->should_persist()); 965 controller->GetDefaultSessionStorageNamespace()->should_persist());
947 966
948 // Quit and restore. Check that no extra tabs were created. 967 // Quit and restore. Check that no extra tabs were created.
949 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 968 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
950 ASSERT_EQ(1u, native_browser_list->size()); 969 ASSERT_EQ(1u, native_browser_list->size());
951 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); 970 EXPECT_EQ(1, new_browser->tab_strip_model()->count());
952 } 971 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/navigation_controller_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698