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

Side by Side Diff: chrome/browser/net/websocket_browsertest.cc

Issue 1176583003: Move EqualsASCII to the base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util2
Patch Set: Created 5 years, 6 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
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/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 content::WebContents* new_tab = content::WebContents::Create( 178 content::WebContents* new_tab = content::WebContents::Create(
179 content::WebContents::CreateParams(tab->GetBrowserContext())); 179 content::WebContents::CreateParams(tab->GetBrowserContext()));
180 browser()->tab_strip_model()->AppendWebContents(new_tab, true); 180 browser()->tab_strip_model()->AppendWebContents(new_tab, true);
181 ASSERT_EQ(new_tab, browser()->tab_strip_model()->GetWebContentsAt(1)); 181 ASSERT_EQ(new_tab, browser()->tab_strip_model()->GetWebContentsAt(1));
182 182
183 content::TitleWatcher connected_title_watcher( 183 content::TitleWatcher connected_title_watcher(
184 new_tab, base::ASCIIToUTF16("CONNECTED")); 184 new_tab, base::ASCIIToUTF16("CONNECTED"));
185 connected_title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("CLOSED")); 185 connected_title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16("CLOSED"));
186 NavigateToHTTP("counted_connection.html"); 186 NavigateToHTTP("counted_connection.html");
187 const base::string16 result = connected_title_watcher.WaitAndGetTitle(); 187 const base::string16 result = connected_title_watcher.WaitAndGetTitle();
188 EXPECT_TRUE(EqualsASCII(result, "CONNECTED")); 188 EXPECT_TRUE(base::EqualsASCII(result, "CONNECTED"));
189 189
190 content::WebContentsDestroyedWatcher destroyed_watcher(new_tab); 190 content::WebContentsDestroyedWatcher destroyed_watcher(new_tab);
191 browser()->tab_strip_model()->CloseWebContentsAt(1, 0); 191 browser()->tab_strip_model()->CloseWebContentsAt(1, 0);
192 destroyed_watcher.Wait(); 192 destroyed_watcher.Wait();
193 } 193 }
194 194
195 NavigateToHTTP("count_connection.html"); 195 NavigateToHTTP("count_connection.html");
196 EXPECT_EQ("PASS", WaitAndGetTitle()); 196 EXPECT_EQ("PASS", WaitAndGetTitle());
197 } 197 }
198 198
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 ASSERT_TRUE(wss_server.StartInBackground()); 318 ASSERT_TRUE(wss_server.StartInBackground());
319 ASSERT_TRUE(https_server.BlockUntilStarted()); 319 ASSERT_TRUE(https_server.BlockUntilStarted());
320 320
321 // Set HSTS on localhost. 321 // Set HSTS on localhost.
322 content::TitleWatcher title_watcher( 322 content::TitleWatcher title_watcher(
323 browser()->tab_strip_model()->GetActiveWebContents(), 323 browser()->tab_strip_model()->GetActiveWebContents(),
324 base::ASCIIToUTF16("SET")); 324 base::ASCIIToUTF16("SET"));
325 ui_test_utils::NavigateToURL( 325 ui_test_utils::NavigateToURL(
326 browser(), https_server.GetURL("files/websocket/set-hsts.html")); 326 browser(), https_server.GetURL("files/websocket/set-hsts.html"));
327 const base::string16 result = title_watcher.WaitAndGetTitle(); 327 const base::string16 result = title_watcher.WaitAndGetTitle();
328 EXPECT_TRUE(EqualsASCII(result, "SET")); 328 EXPECT_TRUE(base::EqualsASCII(result, "SET"));
329 329
330 // Verify that it applies to WebSockets. 330 // Verify that it applies to WebSockets.
331 ASSERT_TRUE(wss_server.BlockUntilStarted()); 331 ASSERT_TRUE(wss_server.BlockUntilStarted());
332 GURL wss_url = wss_server.GetURL("echo-with-no-extension"); 332 GURL wss_url = wss_server.GetURL("echo-with-no-extension");
333 std::string scheme("ws"); 333 std::string scheme("ws");
334 GURL::Replacements scheme_replacement; 334 GURL::Replacements scheme_replacement;
335 scheme_replacement.SetSchemeStr(scheme); 335 scheme_replacement.SetSchemeStr(scheme);
336 GURL ws_url = wss_url.ReplaceComponents(scheme_replacement); 336 GURL ws_url = wss_url.ReplaceComponents(scheme_replacement);
337 337
338 // An https: URL won't work here here because the mixed content policy 338 // An https: URL won't work here here because the mixed content policy
339 // disallows connections to unencrypted WebSockets from encrypted pages. 339 // disallows connections to unencrypted WebSockets from encrypted pages.
340 ASSERT_TRUE(http_server.BlockUntilStarted()); 340 ASSERT_TRUE(http_server.BlockUntilStarted());
341 GURL http_url = 341 GURL http_url =
342 http_server.GetURL("files/websocket/check-hsts.html#" + ws_url.spec()); 342 http_server.GetURL("files/websocket/check-hsts.html#" + ws_url.spec());
343 343
344 ui_test_utils::NavigateToURL(browser(), http_url); 344 ui_test_utils::NavigateToURL(browser(), http_url);
345 345
346 EXPECT_EQ("PASS", WaitAndGetTitle()); 346 EXPECT_EQ("PASS", WaitAndGetTitle());
347 } 347 }
348 348
349 } // namespace 349 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/net/proxy_browsertest.cc ('k') | chrome/browser/password_manager/password_store_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698