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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 for (size_t i = 0; i < cookies_to_set.size(); i++) | 95 for (size_t i = 0; i < cookies_to_set.size(); i++) |
96 http_response->AddCustomHeader("Set-Cookie", cookies_to_set[i]); | 96 http_response->AddCustomHeader("Set-Cookie", cookies_to_set[i]); |
97 } | 97 } |
98 | 98 |
99 return http_response.Pass(); | 99 return http_response.Pass(); |
100 } | 100 } |
101 | 101 |
102 class IsolatedAppTest : public ExtensionBrowserTest { | 102 class IsolatedAppTest : public ExtensionBrowserTest { |
103 public: | 103 public: |
104 // Returns whether the given tab's current URL has the given cookie. | 104 // Returns whether the given tab's current URL has the given cookie. |
105 bool WARN_UNUSED_RESULT HasCookie(WebContents* contents, std::string cookie) { | 105 bool WARN_UNUSED_RESULT HasCookie(WebContents* contents, |
| 106 const std::string& cookie) { |
106 int value_size; | 107 int value_size; |
107 std::string actual_cookie; | 108 std::string actual_cookie; |
108 ui_test_utils::GetCookies(contents->GetURL(), contents, &value_size, | 109 ui_test_utils::GetCookies(contents->GetURL(), contents, &value_size, |
109 &actual_cookie); | 110 &actual_cookie); |
110 return actual_cookie.find(cookie) != std::string::npos; | 111 return actual_cookie.find(cookie) != std::string::npos; |
111 } | 112 } |
112 | 113 |
113 const Extension* GetInstalledApp(WebContents* contents) { | 114 const Extension* GetInstalledApp(WebContents* contents) { |
114 content::BrowserContext* browser_context = contents->GetBrowserContext(); | 115 content::BrowserContext* browser_context = contents->GetBrowserContext(); |
115 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context); | 116 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 browser(), base_url.Resolve("non_app/main.html")); | 560 browser(), base_url.Resolve("non_app/main.html")); |
560 ASSERT_TRUE(ExecuteScriptAndExtractString( | 561 ASSERT_TRUE(ExecuteScriptAndExtractString( |
561 browser()->tab_strip_model()->GetWebContentsAt(0), | 562 browser()->tab_strip_model()->GetWebContentsAt(0), |
562 kRetrieveSessionStorage.c_str(), &result)); | 563 kRetrieveSessionStorage.c_str(), &result)); |
563 EXPECT_EQ("ss_normal", result); | 564 EXPECT_EQ("ss_normal", result); |
564 } | 565 } |
565 | 566 |
566 } // namespace | 567 } // namespace |
567 | 568 |
568 } // namespace extensions | 569 } // namespace extensions |
OLD | NEW |