Chromium Code Reviews| 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/common/extensions/extension_manifest_constants.h" | 5 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 6 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 6 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 7 #include "chrome/common/extensions/manifest_url_handler.h" | 7 #include "chrome/common/extensions/manifest_url_handler.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace errors = extension_manifest_errors; | 10 namespace errors = extension_manifest_errors; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 "http", | 25 "http", |
| 26 extensions::ManifestURL::GetOptionsPage(extension).scheme().c_str()); | 26 extensions::ManifestURL::GetOptionsPage(extension).scheme().c_str()); |
| 27 EXPECT_STREQ( | 27 EXPECT_STREQ( |
| 28 "example.com", | 28 "example.com", |
| 29 extensions::ManifestURL::GetOptionsPage(extension).host().c_str()); | 29 extensions::ManifestURL::GetOptionsPage(extension).host().c_str()); |
| 30 EXPECT_STREQ( | 30 EXPECT_STREQ( |
| 31 "options.html", | 31 "options.html", |
| 32 extensions::ManifestURL:: | 32 extensions::ManifestURL:: |
| 33 GetOptionsPage(extension).ExtractFileName().c_str()); | 33 GetOptionsPage(extension).ExtractFileName().c_str()); |
| 34 | 34 |
| 35 extension = LoadAndExpectSuccess("platform_app_with_options_page.json"); | |
|
Yoyo Zhou
2013/04/16 20:11:40
Maybe add a comment here: // Platforms apps do not
| |
| 36 EXPECT_TRUE(extensions::ManifestURL::GetOptionsPage(extension).is_empty()); | |
| 37 | |
| 35 Testcase testcases[] = { | 38 Testcase testcases[] = { |
| 36 // Forbid options page with relative URL in hosted apps. | 39 // Forbid options page with relative URL in hosted apps. |
| 37 Testcase("hosted_app_relative_options.json", | 40 Testcase("hosted_app_relative_options.json", |
| 38 errors::kInvalidOptionsPageInHostedApp), | 41 errors::kInvalidOptionsPageInHostedApp), |
| 39 | 42 |
| 40 // Forbid options page with non-(http|https) scheme in hosted app. | 43 // Forbid options page with non-(http|https) scheme in hosted app. |
| 41 Testcase("hosted_app_file_options.json", | 44 Testcase("hosted_app_file_options.json", |
| 42 errors::kInvalidOptionsPageInHostedApp), | 45 errors::kInvalidOptionsPageInHostedApp), |
| 43 | 46 |
| 44 // Forbid absolute URL for options page in packaged apps. | 47 // Forbid absolute URL for options page in packaged apps. |
| 45 Testcase("packaged_app_absolute_options.json", | 48 Testcase("packaged_app_absolute_options.json", |
| 46 errors::kInvalidOptionsPageExpectUrlInPackage) | 49 errors::kInvalidOptionsPageExpectUrlInPackage) |
| 47 }; | 50 }; |
| 48 RunTestcases(testcases, arraysize(testcases), | 51 RunTestcases(testcases, arraysize(testcases), |
| 49 EXPECT_TYPE_ERROR); | 52 EXPECT_TYPE_ERROR); |
| 50 } | 53 } |
| OLD | NEW |