| 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 "chrome/browser/extensions/api/cloud_print_private/cloud_print_private_
api.h" | 5 #include "chrome/browser/extensions/api/cloud_print_private/cloud_print_private_
api.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Returns a test server URL, but with host 'www.cloudprintapp.com' so it | 41 // Returns a test server URL, but with host 'www.cloudprintapp.com' so it |
| 42 // matches the cloud print app's extent that we set up via command line | 42 // matches the cloud print app's extent that we set up via command line |
| 43 // flags. | 43 // flags. |
| 44 GURL GetTestServerURL(const std::string& path) { | 44 GURL GetTestServerURL(const std::string& path) { |
| 45 GURL url = test_server()->GetURL( | 45 GURL url = test_server()->GetURL( |
| 46 "files/extensions/api_test/cloud_print_private/" + path); | 46 "files/extensions/api_test/cloud_print_private/" + path); |
| 47 | 47 |
| 48 // Replace the host with 'www.cloudprintapp.com' so it matches the cloud | 48 // Replace the host with 'www.cloudprintapp.com' so it matches the cloud |
| 49 // print app's extent. | 49 // print app's extent. |
| 50 GURL::Replacements replace_host; | 50 GURL::Replacements replace_host; |
| 51 std::string host_str("www.cloudprintapp.com"); | 51 replace_host.SetHostStr("www.cloudprintapp.com"); |
| 52 replace_host.SetHostStr(host_str); | |
| 53 return url.ReplaceComponents(replace_host); | 52 return url.ReplaceComponents(replace_host); |
| 54 } | 53 } |
| 55 }; | 54 }; |
| 56 | 55 |
| 57 #if !defined(OS_CHROMEOS) | 56 #if !defined(OS_CHROMEOS) |
| 58 | 57 |
| 59 using extensions::api::cloud_print_private::UserSettings; | 58 using extensions::api::cloud_print_private::UserSettings; |
| 60 | 59 |
| 61 class CloudPrintTestsDelegateMock : public extensions::CloudPrintTestsDelegate { | 60 class CloudPrintTestsDelegateMock : public extensions::CloudPrintTestsDelegate { |
| 62 public: | 61 public: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 113 |
| 115 // Run this as a hosted app. Since we have overridden the cloud print service | 114 // Run this as a hosted app. Since we have overridden the cloud print service |
| 116 // URL in the command line, this URL should match the web extent for our | 115 // URL in the command line, this URL should match the web extent for our |
| 117 // cloud print component app and it should work. | 116 // cloud print component app and it should work. |
| 118 GURL page_url = GetTestServerURL( | 117 GURL page_url = GetTestServerURL( |
| 119 "enable_chrome_connector/cloud_print_success_tests.html"); | 118 "enable_chrome_connector/cloud_print_success_tests.html"); |
| 120 ASSERT_TRUE(RunPageTest(page_url.spec())); | 119 ASSERT_TRUE(RunPageTest(page_url.spec())); |
| 121 } | 120 } |
| 122 | 121 |
| 123 #endif // !defined(OS_CHROMEOS) | 122 #endif // !defined(OS_CHROMEOS) |
| OLD | NEW |