OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/test_extension_dir.h" | 8 #include "chrome/browser/extensions/test_extension_dir.h" |
9 #include "chrome/browser/ui/browser_navigator_params.h" | 9 #include "chrome/browser/ui/browser_navigator_params.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // and |path|. | 57 // and |path|. |
58 std::string GetQuotedTestServerURL(const std::string& host, | 58 std::string GetQuotedTestServerURL(const std::string& host, |
59 const std::string& path) { | 59 const std::string& path) { |
60 return GetQuotedURL(embedded_test_server()->GetURL(host, path)); | 60 return GetQuotedURL(embedded_test_server()->GetURL(host, path)); |
61 } | 61 } |
62 | 62 |
63 // Opens a tab, puts it in the foreground, navigates it to |url| then returns | 63 // Opens a tab, puts it in the foreground, navigates it to |url| then returns |
64 // its WebContents. | 64 // its WebContents. |
65 content::WebContents* CreateAndNavigateTab(const GURL& url) { | 65 content::WebContents* CreateAndNavigateTab(const GURL& url) { |
66 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); | 66 chrome::NavigateParams params(browser(), url, ui::PAGE_TRANSITION_LINK); |
67 params.disposition = NEW_FOREGROUND_TAB; | 67 params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
68 ui_test_utils::NavigateToURL(¶ms); | 68 ui_test_utils::NavigateToURL(¶ms); |
69 return browser()->tab_strip_model()->GetActiveWebContents(); | 69 return browser()->tab_strip_model()->GetActiveWebContents(); |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 void SetUpOnMainThread() override { | 73 void SetUpOnMainThread() override { |
74 ExtensionApiTest::SetUpOnMainThread(); | 74 ExtensionApiTest::SetUpOnMainThread(); |
75 host_resolver()->AddRule("*", "127.0.0.1"); | 75 host_resolver()->AddRule("*", "127.0.0.1"); |
76 ASSERT_TRUE(StartEmbeddedTestServer()); | 76 ASSERT_TRUE(StartEmbeddedTestServer()); |
77 } | 77 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 185 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
186 empty_tab, | 186 empty_tab, |
187 GetFetchScript(GetQuotedURL(extension->GetResourceURL("text"))), | 187 GetFetchScript(GetQuotedURL(extension->GetResourceURL("text"))), |
188 &fetch_result)); | 188 &fetch_result)); |
189 EXPECT_EQ("TypeError: Failed to fetch", fetch_result); | 189 EXPECT_EQ("TypeError: Failed to fetch", fetch_result); |
190 } | 190 } |
191 | 191 |
192 } // namespace | 192 } // namespace |
193 | 193 |
194 } // namespace extensions | 194 } // namespace extensions |
OLD | NEW |