| OLD | NEW |
| 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/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 std::string WrapForJavascriptAndExtract(const char* javascript_expression) { | 37 std::string WrapForJavascriptAndExtract(const char* javascript_expression) { |
| 38 return std::string("window.domAutomationController.send(") + | 38 return std::string("window.domAutomationController.send(") + |
| 39 javascript_expression + ")"; | 39 javascript_expression + ")"; |
| 40 } | 40 } |
| 41 | 41 |
| 42 scoped_ptr<net::test_server::HttpResponse> HandleExpectAndSetCookieRequest( | 42 scoped_ptr<net::test_server::HttpResponse> HandleExpectAndSetCookieRequest( |
| 43 const net::test_server::EmbeddedTestServer* test_server, | 43 const net::test_server::EmbeddedTestServer* test_server, |
| 44 const net::test_server::HttpRequest& request) { | 44 const net::test_server::HttpRequest& request) { |
| 45 if (!base::StartsWithASCII(request.relative_url, "/expect-and-set-cookie?", | 45 if (!base::StartsWith(request.relative_url, "/expect-and-set-cookie?", |
| 46 true)) | 46 base::CompareCase::SENSITIVE)) |
| 47 return scoped_ptr<net::test_server::HttpResponse>(); | 47 return scoped_ptr<net::test_server::HttpResponse>(); |
| 48 | 48 |
| 49 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 49 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
| 50 new net::test_server::BasicHttpResponse); | 50 new net::test_server::BasicHttpResponse); |
| 51 http_response->set_code(net::HTTP_OK); | 51 http_response->set_code(net::HTTP_OK); |
| 52 | 52 |
| 53 std::string request_cookies; | 53 std::string request_cookies; |
| 54 std::map<std::string, std::string>::const_iterator it = | 54 std::map<std::string, std::string>::const_iterator it = |
| 55 request.headers.find("Cookie"); | 55 request.headers.find("Cookie"); |
| 56 if (it != request.headers.end()) | 56 if (it != request.headers.end()) |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 browser(), base_url.Resolve("non_app/main.html")); | 558 browser(), base_url.Resolve("non_app/main.html")); |
| 559 ASSERT_TRUE(ExecuteScriptAndExtractString( | 559 ASSERT_TRUE(ExecuteScriptAndExtractString( |
| 560 browser()->tab_strip_model()->GetWebContentsAt(0), | 560 browser()->tab_strip_model()->GetWebContentsAt(0), |
| 561 kRetrieveSessionStorage.c_str(), &result)); | 561 kRetrieveSessionStorage.c_str(), &result)); |
| 562 EXPECT_EQ("ss_normal", result); | 562 EXPECT_EQ("ss_normal", result); |
| 563 } | 563 } |
| 564 | 564 |
| 565 } // namespace | 565 } // namespace |
| 566 | 566 |
| 567 } // namespace extensions | 567 } // namespace extensions |
| OLD | NEW |