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

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

Issue 2566583002: Change allowed bindings to be per RenderFrame instead of per RenderView. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "chrome/test/base/ui_test_utils.h" 42 #include "chrome/test/base/ui_test_utils.h"
43 #include "components/sessions/content/content_live_tab.h" 43 #include "components/sessions/content/content_live_tab.h"
44 #include "components/sessions/core/serialized_navigation_entry_test_helper.h" 44 #include "components/sessions/core/serialized_navigation_entry_test_helper.h"
45 #include "components/sessions/core/session_types.h" 45 #include "components/sessions/core/session_types.h"
46 #include "components/sessions/core/tab_restore_service.h" 46 #include "components/sessions/core/tab_restore_service.h"
47 #include "components/sync/protocol/session_specifics.pb.h" 47 #include "components/sync/protocol/session_specifics.pb.h"
48 #include "content/public/browser/navigation_controller.h" 48 #include "content/public/browser/navigation_controller.h"
49 #include "content/public/browser/navigation_entry.h" 49 #include "content/public/browser/navigation_entry.h"
50 #include "content/public/browser/notification_service.h" 50 #include "content/public/browser/notification_service.h"
51 #include "content/public/browser/notification_types.h" 51 #include "content/public/browser/notification_types.h"
52 #include "content/public/browser/render_frame_host.h"
52 #include "content/public/browser/render_process_host.h" 53 #include "content/public/browser/render_process_host.h"
53 #include "content/public/browser/render_view_host.h" 54 #include "content/public/browser/render_view_host.h"
54 #include "content/public/browser/web_contents.h" 55 #include "content/public/browser/web_contents.h"
55 #include "content/public/common/bindings_policy.h" 56 #include "content/public/common/bindings_policy.h"
56 #include "content/public/test/browser_test_utils.h" 57 #include "content/public/test/browser_test_utils.h"
57 #include "content/public/test/test_navigation_observer.h" 58 #include "content/public/test/test_navigation_observer.h"
58 #include "net/test/embedded_test_server/embedded_test_server.h" 59 #include "net/test/embedded_test_server/embedded_test_server.h"
59 #include "ui/base/page_transition_types.h" 60 #include "ui/base/page_transition_types.h"
60 61
61 #if defined(OS_MACOSX) 62 #if defined(OS_MACOSX)
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 // At least one of the render widgets should not be initialized yet. 904 // At least one of the render widgets should not be initialized yet.
904 ASSERT_FALSE( 905 ASSERT_FALSE(
905 tab_strip_model->GetWebContentsAt(0)->GetRenderWidgetHostView() && 906 tab_strip_model->GetWebContentsAt(0)->GetRenderWidgetHostView() &&
906 tab_strip_model->GetWebContentsAt(1)->GetRenderWidgetHostView() && 907 tab_strip_model->GetWebContentsAt(1)->GetRenderWidgetHostView() &&
907 tab_strip_model->GetWebContentsAt(2)->GetRenderWidgetHostView()); 908 tab_strip_model->GetWebContentsAt(2)->GetRenderWidgetHostView());
908 } 909 }
909 910
910 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWebUI) { 911 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWebUI) {
911 const GURL webui_url("chrome://omnibox"); 912 const GURL webui_url("chrome://omnibox");
912 ui_test_utils::NavigateToURL(browser(), webui_url); 913 ui_test_utils::NavigateToURL(browser(), webui_url);
913 const content::WebContents* old_tab = 914 content::WebContents* old_tab =
914 browser()->tab_strip_model()->GetActiveWebContents(); 915 browser()->tab_strip_model()->GetActiveWebContents();
915 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, 916 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI,
916 old_tab->GetRenderViewHost()->GetEnabledBindings()); 917 old_tab->GetMainFrame()->GetEnabledBindings());
917 918
918 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 919 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
919 ASSERT_EQ(1u, active_browser_list_->size()); 920 ASSERT_EQ(1u, active_browser_list_->size());
920 const content::WebContents* new_tab = 921 content::WebContents* new_tab =
921 new_browser->tab_strip_model()->GetActiveWebContents(); 922 new_browser->tab_strip_model()->GetActiveWebContents();
922 EXPECT_EQ(webui_url, new_tab->GetURL()); 923 EXPECT_EQ(webui_url, new_tab->GetURL());
923 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, 924 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI,
924 new_tab->GetRenderViewHost()->GetEnabledBindings()); 925 new_tab->GetMainFrame()->GetEnabledBindings());
925 } 926 }
926 927
927 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWebUISettings) { 928 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWebUISettings) {
928 const GURL webui_url("chrome://settings"); 929 const GURL webui_url("chrome://settings");
929 ui_test_utils::NavigateToURL(browser(), webui_url); 930 ui_test_utils::NavigateToURL(browser(), webui_url);
930 const content::WebContents* old_tab = 931 content::WebContents* old_tab =
931 browser()->tab_strip_model()->GetActiveWebContents(); 932 browser()->tab_strip_model()->GetActiveWebContents();
932 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, 933 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI,
933 old_tab->GetRenderViewHost()->GetEnabledBindings()); 934 old_tab->GetMainFrame()->GetEnabledBindings());
934 935
935 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 936 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
936 ASSERT_EQ(1u, active_browser_list_->size()); 937 ASSERT_EQ(1u, active_browser_list_->size());
937 const content::WebContents* new_tab = 938 content::WebContents* new_tab =
938 new_browser->tab_strip_model()->GetActiveWebContents(); 939 new_browser->tab_strip_model()->GetActiveWebContents();
939 EXPECT_EQ(webui_url, new_tab->GetURL()); 940 EXPECT_EQ(webui_url, new_tab->GetURL());
940 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI, 941 EXPECT_EQ(content::BINDINGS_POLICY_WEB_UI,
941 new_tab->GetRenderViewHost()->GetEnabledBindings()); 942 new_tab->GetMainFrame()->GetEnabledBindings());
942 } 943 }
943 944
944 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoresForwardAndBackwardNavs) { 945 IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoresForwardAndBackwardNavs) {
945 ui_test_utils::NavigateToURL(browser(), url1_); 946 ui_test_utils::NavigateToURL(browser(), url1_);
946 ui_test_utils::NavigateToURL(browser(), url2_); 947 ui_test_utils::NavigateToURL(browser(), url2_);
947 ui_test_utils::NavigateToURL(browser(), url3_); 948 ui_test_utils::NavigateToURL(browser(), url3_);
948 949
949 GoBack(browser()); 950 GoBack(browser());
950 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 951 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
951 ASSERT_EQ(1u, active_browser_list_->size()); 952 ASSERT_EQ(1u, active_browser_list_->size());
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 // automatically at the start of the test. 1504 // automatically at the start of the test.
1504 for (size_t i = 1; i < web_contents().size(); i++) { 1505 for (size_t i = 1; i < web_contents().size(); i++) {
1505 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]); 1506 GURL expected_url = GURL(kUrls[activation_order[kExpectedNumTabs - i]]);
1506 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL()); 1507 ASSERT_EQ(expected_url, web_contents()[i]->GetLastCommittedURL());
1507 if (i > 0) { 1508 if (i > 0) {
1508 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(), 1509 ASSERT_GT(web_contents()[i - 1]->GetLastActiveTime(),
1509 web_contents()[i]->GetLastActiveTime()); 1510 web_contents()[i]->GetLastActiveTime());
1510 } 1511 }
1511 } 1512 }
1512 } 1513 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698