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

Side by Side Diff: chrome/browser/extensions/extension_webnavigation_apitest.cc

Issue 8864002: Mark WebNavigation tests as using legacy extension manifests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 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 "chrome/app/chrome_command_ids.h" 5 #include "chrome/app/chrome_command_ids.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_webnavigation_api.h" 8 #include "chrome/browser/extensions/extension_webnavigation_api.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/tab_contents/render_view_context_menu.h" 10 #include "chrome/browser/tab_contents/render_view_context_menu.h"
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu); 37 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu);
38 }; 38 };
39 39
40 } // namespace 40 } // namespace
41 41
42 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigation) { 42 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigation) {
43 FrameNavigationState::set_allow_extension_scheme(true); 43 FrameNavigationState::set_allow_extension_scheme(true);
44 44
45 CommandLine::ForCurrentProcess()->AppendSwitch(
46 switches::kAllowLegacyExtensionManifests);
47
45 ASSERT_TRUE( 48 ASSERT_TRUE(
46 RunExtensionSubtest("webnavigation", "test_api.html")) << message_; 49 RunExtensionSubtest("webnavigation", "test_api.html")) << message_;
47 } 50 }
48 51
49 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationGetFrame) { 52 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationGetFrame) {
50 FrameNavigationState::set_allow_extension_scheme(true); 53 FrameNavigationState::set_allow_extension_scheme(true);
51 54
55 CommandLine::ForCurrentProcess()->AppendSwitch(
56 switches::kAllowLegacyExtensionManifests);
57
52 ASSERT_TRUE( 58 ASSERT_TRUE(
53 RunExtensionSubtest("webnavigation", "test_getFrame.html")) << message_; 59 RunExtensionSubtest("webnavigation", "test_getFrame.html")) << message_;
54 } 60 }
55 61
56 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationClientRedirect) { 62 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationClientRedirect) {
57 FrameNavigationState::set_allow_extension_scheme(true); 63 FrameNavigationState::set_allow_extension_scheme(true);
58 64
65 CommandLine::ForCurrentProcess()->AppendSwitch(
66 switches::kAllowLegacyExtensionManifests);
67
59 ASSERT_TRUE( 68 ASSERT_TRUE(
60 RunExtensionSubtest("webnavigation", "test_clientRedirect.html")) 69 RunExtensionSubtest("webnavigation", "test_clientRedirect.html"))
61 << message_; 70 << message_;
62 } 71 }
63 72
64 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationServerRedirect) { 73 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationServerRedirect) {
65 FrameNavigationState::set_allow_extension_scheme(true); 74 FrameNavigationState::set_allow_extension_scheme(true);
66 host_resolver()->AddRule("*", "127.0.0.1"); 75 host_resolver()->AddRule("*", "127.0.0.1");
67 ASSERT_TRUE(StartTestServer()); 76 ASSERT_TRUE(StartTestServer());
68 77
78 CommandLine::ForCurrentProcess()->AppendSwitch(
79 switches::kAllowLegacyExtensionManifests);
80
69 ASSERT_TRUE( 81 ASSERT_TRUE(
70 RunExtensionSubtest("webnavigation", "test_serverRedirect.html")) 82 RunExtensionSubtest("webnavigation", "test_serverRedirect.html"))
71 << message_; 83 << message_;
72 } 84 }
73 85
74 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationForwardBack) { 86 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationForwardBack) {
75 FrameNavigationState::set_allow_extension_scheme(true); 87 FrameNavigationState::set_allow_extension_scheme(true);
76 88
89 CommandLine::ForCurrentProcess()->AppendSwitch(
90 switches::kAllowLegacyExtensionManifests);
91
77 ASSERT_TRUE( 92 ASSERT_TRUE(
78 RunExtensionSubtest("webnavigation", "test_forwardBack.html")) 93 RunExtensionSubtest("webnavigation", "test_forwardBack.html"))
79 << message_; 94 << message_;
80 } 95 }
81 96
82 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationIFrame) { 97 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationIFrame) {
83 FrameNavigationState::set_allow_extension_scheme(true); 98 FrameNavigationState::set_allow_extension_scheme(true);
84 99
100 CommandLine::ForCurrentProcess()->AppendSwitch(
101 switches::kAllowLegacyExtensionManifests);
102
85 ASSERT_TRUE( 103 ASSERT_TRUE(
86 RunExtensionSubtest("webnavigation", "test_iframe.html")) << message_; 104 RunExtensionSubtest("webnavigation", "test_iframe.html")) << message_;
87 } 105 }
88 106
89 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationOpenTab) { 107 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationOpenTab) {
90 FrameNavigationState::set_allow_extension_scheme(true); 108 FrameNavigationState::set_allow_extension_scheme(true);
91 109
110 CommandLine::ForCurrentProcess()->AppendSwitch(
111 switches::kAllowLegacyExtensionManifests);
112
92 ASSERT_TRUE( 113 ASSERT_TRUE(
93 RunExtensionSubtest("webnavigation", "test_openTab.html")) << message_; 114 RunExtensionSubtest("webnavigation", "test_openTab.html")) << message_;
94 } 115 }
95 116
96 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationReferenceFragment) { 117 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationReferenceFragment) {
97 FrameNavigationState::set_allow_extension_scheme(true); 118 FrameNavigationState::set_allow_extension_scheme(true);
98 119
120 CommandLine::ForCurrentProcess()->AppendSwitch(
121 switches::kAllowLegacyExtensionManifests);
122
99 ASSERT_TRUE( 123 ASSERT_TRUE(
100 RunExtensionSubtest("webnavigation", "test_referenceFragment.html")) 124 RunExtensionSubtest("webnavigation", "test_referenceFragment.html"))
101 << message_; 125 << message_;
102 } 126 }
103 127
104 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationSimpleLoad) { 128 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationSimpleLoad) {
105 FrameNavigationState::set_allow_extension_scheme(true); 129 FrameNavigationState::set_allow_extension_scheme(true);
106 130
131 CommandLine::ForCurrentProcess()->AppendSwitch(
132 switches::kAllowLegacyExtensionManifests);
133
107 ASSERT_TRUE( 134 ASSERT_TRUE(
108 RunExtensionSubtest("webnavigation", "test_simpleLoad.html")) << message_; 135 RunExtensionSubtest("webnavigation", "test_simpleLoad.html")) << message_;
109 } 136 }
110 137
111 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationFailures) { 138 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationFailures) {
112 FrameNavigationState::set_allow_extension_scheme(true); 139 FrameNavigationState::set_allow_extension_scheme(true);
113 140
141 CommandLine::ForCurrentProcess()->AppendSwitch(
142 switches::kAllowLegacyExtensionManifests);
143
114 ASSERT_TRUE( 144 ASSERT_TRUE(
115 RunExtensionSubtest("webnavigation", "test_failures.html")) << message_; 145 RunExtensionSubtest("webnavigation", "test_failures.html")) << message_;
116 } 146 }
117 147
118 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationUserAction) { 148 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationUserAction) {
119 FrameNavigationState::set_allow_extension_scheme(true); 149 FrameNavigationState::set_allow_extension_scheme(true);
120 150
151 CommandLine::ForCurrentProcess()->AppendSwitch(
152 switches::kAllowLegacyExtensionManifests);
153
121 // Wait for the extension to set itself up and return control to us. 154 // Wait for the extension to set itself up and return control to us.
122 ASSERT_TRUE( 155 ASSERT_TRUE(
123 RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; 156 RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_;
124 157
125 TabContents* tab = browser()->GetSelectedTabContents(); 158 TabContents* tab = browser()->GetSelectedTabContents();
126 ui_test_utils::WaitForLoadStop(tab); 159 ui_test_utils::WaitForLoadStop(tab);
127 160
128 ResultCatcher catcher; 161 ResultCatcher catcher;
129 162
130 ExtensionService* service = browser()->profile()->GetExtensionService(); 163 ExtensionService* service = browser()->profile()->GetExtensionService();
(...skipping 16 matching lines...) Expand all
147 TestRenderViewContextMenu menu(tab, params); 180 TestRenderViewContextMenu menu(tab, params);
148 menu.Init(); 181 menu.Init();
149 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB); 182 menu.ExecuteCommand(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB);
150 183
151 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 184 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
152 } 185 }
153 186
154 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationRequestOpenTab) { 187 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationRequestOpenTab) {
155 FrameNavigationState::set_allow_extension_scheme(true); 188 FrameNavigationState::set_allow_extension_scheme(true);
156 189
190 CommandLine::ForCurrentProcess()->AppendSwitch(
191 switches::kAllowLegacyExtensionManifests);
192
157 // Wait for the extension to set itself up and return control to us. 193 // Wait for the extension to set itself up and return control to us.
158 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) 194 ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html"))
159 << message_; 195 << message_;
160 196
161 TabContents* tab = browser()->GetSelectedTabContents(); 197 TabContents* tab = browser()->GetSelectedTabContents();
162 ui_test_utils::WaitForLoadStop(tab); 198 ui_test_utils::WaitForLoadStop(tab);
163 199
164 ResultCatcher catcher; 200 ResultCatcher catcher;
165 201
166 ExtensionService* service = browser()->profile()->GetExtensionService(); 202 ExtensionService* service = browser()->profile()->GetExtensionService();
167 const Extension* extension = 203 const Extension* extension =
168 service->GetExtensionById(last_loaded_extension_id_, false); 204 service->GetExtensionById(last_loaded_extension_id_, false);
169 GURL url = extension->GetResourceURL("requestOpenTab/a.html"); 205 GURL url = extension->GetResourceURL("requestOpenTab/a.html");
170 206
171 ui_test_utils::NavigateToURL(browser(), url); 207 ui_test_utils::NavigateToURL(browser(), url);
172 208
173 // There's a link on a.html. Middle-click on it to open it in a new tab. 209 // There's a link on a.html. Middle-click on it to open it in a new tab.
174 WebKit::WebMouseEvent mouse_event; 210 WebKit::WebMouseEvent mouse_event;
175 mouse_event.type = WebKit::WebInputEvent::MouseDown; 211 mouse_event.type = WebKit::WebInputEvent::MouseDown;
176 mouse_event.button = WebKit::WebMouseEvent::ButtonMiddle; 212 mouse_event.button = WebKit::WebMouseEvent::ButtonMiddle;
177 mouse_event.x = 7; 213 mouse_event.x = 7;
178 mouse_event.y = 7; 214 mouse_event.y = 7;
179 mouse_event.clickCount = 1; 215 mouse_event.clickCount = 1;
180 tab->render_view_host()->ForwardMouseEvent(mouse_event); 216 tab->render_view_host()->ForwardMouseEvent(mouse_event);
181 mouse_event.type = WebKit::WebInputEvent::MouseUp; 217 mouse_event.type = WebKit::WebInputEvent::MouseUp;
182 tab->render_view_host()->ForwardMouseEvent(mouse_event); 218 tab->render_view_host()->ForwardMouseEvent(mouse_event);
183 219
184 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 220 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
185 } 221 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698