| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stringprintf.h" | 5 #include "base/stringprintf.h" |
| 6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
| 7 #include "chrome/browser/extensions/extension_chrome_auth_private_api.h" | 7 #include "chrome/browser/extensions/extension_chrome_auth_private_api.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // Replace the host with 'www.cloudprintapp.com' so it matches the cloud | 39 // Replace the host with 'www.cloudprintapp.com' so it matches the cloud |
| 40 // print app's extent. | 40 // print app's extent. |
| 41 GURL::Replacements replace_host; | 41 GURL::Replacements replace_host; |
| 42 std::string host_str("www.cloudprintapp.com"); | 42 std::string host_str("www.cloudprintapp.com"); |
| 43 replace_host.SetHostStr(host_str); | 43 replace_host.SetHostStr(host_str); |
| 44 return url.ReplaceComponents(replace_host); | 44 return url.ReplaceComponents(replace_host); |
| 45 } | 45 } |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 #if !defined(OS_CHROMEOS) |
| 48 IN_PROC_BROWSER_TEST_F(ExtensionChromeAuthPrivateApiTest, | 49 IN_PROC_BROWSER_TEST_F(ExtensionChromeAuthPrivateApiTest, |
| 49 SetCloudPrintCredentialsSuccessHosted) { | 50 SetCloudPrintCredentialsSuccessHosted) { |
| 50 // Run this as a hosted app. Since we have overridden the cloud print service | 51 // Run this as a hosted app. Since we have overridden the cloud print service |
| 51 // URL in the command line, this URL should match the web extent for our | 52 // URL in the command line, this URL should match the web extent for our |
| 52 // cloud print component app and it should work. | 53 // cloud print component app and it should work. |
| 53 SetCloudPrintCredentialsFunction::SetTestMode(true); | 54 SetCloudPrintCredentialsFunction::SetTestMode(true); |
| 54 GURL page_url = GetTestServerURL( | 55 GURL page_url = GetTestServerURL( |
| 55 "enable_chrome_connector/cloud_print_success_tests.html"); | 56 "enable_chrome_connector/cloud_print_success_tests.html"); |
| 56 ASSERT_TRUE(RunPageTest(page_url.spec())); | 57 ASSERT_TRUE(RunPageTest(page_url.spec())); |
| 57 SetCloudPrintCredentialsFunction::SetTestMode(false); | 58 SetCloudPrintCredentialsFunction::SetTestMode(false); |
| 58 } | 59 } |
| 60 #endif // !defined(OS_CHROMEOS) |
| 59 | 61 |
| 60 IN_PROC_BROWSER_TEST_F(ExtensionChromeAuthPrivateApiTest, | 62 IN_PROC_BROWSER_TEST_F(ExtensionChromeAuthPrivateApiTest, |
| 61 SetCloudPrintCredentialsFailureInstalled) { | 63 SetCloudPrintCredentialsFailureInstalled) { |
| 62 // Run this as an installed app. Since this is not a component app, it | 64 // Run this as an installed app. Since this is not a component app, it |
| 63 // should fail. | 65 // should fail. |
| 64 ASSERT_TRUE(RunExtensionTest("chrome_auth_private/installed_app")); | 66 ASSERT_TRUE(RunExtensionTest("chrome_auth_private/installed_app")); |
| 65 } | 67 } |
| 66 | 68 |
| 67 IN_PROC_BROWSER_TEST_F(ExtensionChromeAuthPrivateApiTest, | 69 IN_PROC_BROWSER_TEST_F(ExtensionChromeAuthPrivateApiTest, |
| 68 SetCloudPrintCredentialsFailureInstalledComponent) { | 70 SetCloudPrintCredentialsFailureInstalledComponent) { |
| 69 // Run this as an installed component app. This should also fail because of | 71 // Run this as an installed component app. This should also fail because of |
| 70 // the explicit URL check in the API. | 72 // the explicit URL check in the API. |
| 71 ASSERT_TRUE(RunComponentExtensionTest( | 73 ASSERT_TRUE(RunComponentExtensionTest( |
| 72 "chrome_auth_private/installed_component_app")); | 74 "chrome_auth_private/installed_component_app")); |
| 73 } | 75 } |
| 74 | 76 |
| OLD | NEW |