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

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

Issue 1409163006: Migrating tests to use EmbeddedTestServer (/chrome/browser misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase bug. Created 5 years, 1 month 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 (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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 private: 83 private:
84 content::RenderFrameHost* GetIFrame() { 84 content::RenderFrameHost* GetIFrame() {
85 return content::FrameMatchingPredicate( 85 return content::FrameMatchingPredicate(
86 browser()->tab_strip_model()->GetActiveWebContents(), 86 browser()->tab_strip_model()->GetActiveWebContents(),
87 base::Bind(&content::FrameIsChildOfMainFrame)); 87 base::Bind(&content::FrameIsChildOfMainFrame));
88 } 88 }
89 }; 89 };
90 90
91 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, IsInstalled) { 91 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, IsInstalled) {
92 host_resolver()->AddRule("*", "127.0.0.1"); 92 host_resolver()->AddRule("*", "127.0.0.1");
93 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 93 ASSERT_TRUE(embedded_test_server()->Start());
94 GURL app_url = 94 GURL app_url =
95 embedded_test_server()->GetURL("app.com", "/extensions/test_file.html"); 95 embedded_test_server()->GetURL("app.com", "/extensions/test_file.html");
96 GURL non_app_url = embedded_test_server()->GetURL( 96 GURL non_app_url = embedded_test_server()->GetURL(
97 "nonapp.com", "/extensions/test_file.html"); 97 "nonapp.com", "/extensions/test_file.html");
98 98
99 // Before the app is installed, app.com does not think that it is installed 99 // Before the app is installed, app.com does not think that it is installed
100 ui_test_utils::NavigateToURL(browser(), app_url); 100 ui_test_utils::NavigateToURL(browser(), app_url);
101 EXPECT_FALSE(IsAppInstalledInMainFrame()); 101 EXPECT_FALSE(IsAppInstalledInMainFrame());
102 102
103 // Load an app which includes app.com in its extent. 103 // Load an app which includes app.com in its extent.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 " }()" 162 " }()"
163 ");", 163 ");",
164 &result)); 164 &result));
165 165
166 // Should not be able to alter window.chrome.app.isInstalled from javascript"; 166 // Should not be able to alter window.chrome.app.isInstalled from javascript";
167 EXPECT_EQ("true", result); 167 EXPECT_EQ("true", result);
168 } 168 }
169 169
170 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, InstallAndRunningState) { 170 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, InstallAndRunningState) {
171 host_resolver()->AddRule("*", "127.0.0.1"); 171 host_resolver()->AddRule("*", "127.0.0.1");
172 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 172 ASSERT_TRUE(embedded_test_server()->Start());
173 GURL app_url = embedded_test_server()->GetURL( 173 GURL app_url = embedded_test_server()->GetURL(
174 "app.com", "/extensions/get_app_details_for_frame.html"); 174 "app.com", "/extensions/get_app_details_for_frame.html");
175 GURL non_app_url = embedded_test_server()->GetURL( 175 GURL non_app_url = embedded_test_server()->GetURL(
176 "nonapp.com", "/extensions/get_app_details_for_frame.html"); 176 "nonapp.com", "/extensions/get_app_details_for_frame.html");
177 177
178 // Before the app is installed, app.com does not think that it is installed 178 // Before the app is installed, app.com does not think that it is installed
179 ui_test_utils::NavigateToURL(browser(), app_url); 179 ui_test_utils::NavigateToURL(browser(), app_url);
180 180
181 EXPECT_EQ("not_installed", InstallStateInMainFrame()); 181 EXPECT_EQ("not_installed", InstallStateInMainFrame());
182 EXPECT_EQ("cannot_run", RunningStateInMainFrame()); 182 EXPECT_EQ("cannot_run", RunningStateInMainFrame());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 EXPECT_EQ("cannot_run", RunningStateInMainFrame()); 219 EXPECT_EQ("cannot_run", RunningStateInMainFrame());
220 EXPECT_FALSE(IsAppInstalledInMainFrame()); 220 EXPECT_FALSE(IsAppInstalledInMainFrame());
221 221
222 EXPECT_EQ("installed", InstallStateInIFrame()); 222 EXPECT_EQ("installed", InstallStateInIFrame());
223 EXPECT_EQ("cannot_run", RunningStateInIFrame()); 223 EXPECT_EQ("cannot_run", RunningStateInIFrame());
224 EXPECT_FALSE(IsAppInstalledInIFrame()); 224 EXPECT_FALSE(IsAppInstalledInIFrame());
225 } 225 }
226 226
227 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, InstallAndRunningStateFrame) { 227 IN_PROC_BROWSER_TEST_F(ChromeAppAPITest, InstallAndRunningStateFrame) {
228 host_resolver()->AddRule("*", "127.0.0.1"); 228 host_resolver()->AddRule("*", "127.0.0.1");
229 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 229 ASSERT_TRUE(embedded_test_server()->Start());
230 GURL app_url = embedded_test_server()->GetURL( 230 GURL app_url = embedded_test_server()->GetURL(
231 "app.com", "/extensions/get_app_details_for_frame_reversed.html"); 231 "app.com", "/extensions/get_app_details_for_frame_reversed.html");
232 232
233 // Check the install and running state of a non-app iframe running 233 // Check the install and running state of a non-app iframe running
234 // within an app. 234 // within an app.
235 ui_test_utils::NavigateToURL(browser(), app_url); 235 ui_test_utils::NavigateToURL(browser(), app_url);
236 236
237 EXPECT_EQ("not_installed", InstallStateInIFrame()); 237 EXPECT_EQ("not_installed", InstallStateInIFrame());
238 EXPECT_EQ("cannot_run", RunningStateInIFrame()); 238 EXPECT_EQ("cannot_run", RunningStateInIFrame());
239 EXPECT_FALSE(IsAppInstalledInIFrame()); 239 EXPECT_FALSE(IsAppInstalledInIFrame());
240 } 240 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698