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 "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 if (!LoadExtension(test_data_dir_.AppendASCII("clipboard") | 39 if (!LoadExtension(test_data_dir_.AppendASCII("clipboard") |
40 .AppendASCII(app_name))) { | 40 .AppendASCII(app_name))) { |
41 message_ = "Failed to load hosted app."; | 41 message_ = "Failed to load hosted app."; |
42 return false; | 42 return false; |
43 } | 43 } |
44 | 44 |
45 GURL base_url = embedded_test_server()->GetURL( | 45 GURL base_url = embedded_test_server()->GetURL( |
46 "/extensions/api_test/clipboard/"); | 46 "/extensions/api_test/clipboard/"); |
47 GURL::Replacements replace_host; | 47 GURL::Replacements replace_host; |
48 std::string host_str("localhost"); // Must stay in scope with replace_host. | 48 replace_host.SetHostStr("localhost"); |
49 replace_host.SetHostStr(host_str); | |
50 base_url = base_url.ReplaceComponents(replace_host); | 49 base_url = base_url.ReplaceComponents(replace_host); |
51 | 50 |
52 std::string launch_page_path = | 51 std::string launch_page_path = |
53 base::StringPrintf("%s/%s", app_name.c_str(), launch_page.c_str()); | 52 base::StringPrintf("%s/%s", app_name.c_str(), launch_page.c_str()); |
54 ui_test_utils::NavigateToURL(browser(), base_url.Resolve(launch_page_path)); | 53 ui_test_utils::NavigateToURL(browser(), base_url.Resolve(launch_page_path)); |
55 | 54 |
56 return true; | 55 return true; |
57 } | 56 } |
58 | 57 |
59 bool ClipboardApiTest::ExecuteCopyInSelectedTab() { | 58 bool ClipboardApiTest::ExecuteCopyInSelectedTab() { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 IN_PROC_BROWSER_TEST_F(ClipboardApiTest, HostedAppNoPermission) { | 111 IN_PROC_BROWSER_TEST_F(ClipboardApiTest, HostedAppNoPermission) { |
113 ASSERT_TRUE(LoadHostedApp("hosted_app_no_permission", "main.html")) | 112 ASSERT_TRUE(LoadHostedApp("hosted_app_no_permission", "main.html")) |
114 << message_; | 113 << message_; |
115 | 114 |
116 EXPECT_FALSE(ExecuteCopyInSelectedTab()) << message_; | 115 EXPECT_FALSE(ExecuteCopyInSelectedTab()) << message_; |
117 EXPECT_FALSE(ExecutePasteInSelectedTab()) << message_; | 116 EXPECT_FALSE(ExecutePasteInSelectedTab()) << message_; |
118 EXPECT_FALSE(ExecuteCommandInIframeInSelectedTab("copy")) << message_; | 117 EXPECT_FALSE(ExecuteCommandInIframeInSelectedTab("copy")) << message_; |
119 EXPECT_FALSE(ExecuteCommandInIframeInSelectedTab("paste")) << message_; | 118 EXPECT_FALSE(ExecuteCommandInIframeInSelectedTab("paste")) << message_; |
120 } | 119 } |
121 | 120 |
OLD | NEW |