Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3625)

Unified Diff: chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc

Issue 14241002: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
index 4cf2475b7b59e298533346663f1ccc254f421ec4..a2146f24cab3dc677683c767ea041c14cb4a3741 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc
@@ -2,37 +2,48 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
-
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/extensions/app_launcher_info.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
#include "extensions/common/error_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace errors = extension_manifest_errors;
namespace keys = extension_manifest_keys;
-using extensions::ErrorUtils;
+namespace extensions {
-TEST_F(ExtensionManifestTest, AppLaunchContainer) {
- scoped_refptr<extensions::Extension> extension;
+class AppLaunchManifestTest : public ExtensionManifestTest {
+ protected:
+ virtual void SetUp() OVERRIDE {
+ ExtensionManifestTest::SetUp();
+ (new AppLaunchManifestHandler)->Register();
+ }
+};
+
+TEST_F(AppLaunchManifestTest, AppLaunchContainer) {
+ scoped_refptr<Extension> extension;
extension = LoadAndExpectSuccess("launch_tab.json");
- EXPECT_EQ(extension_misc::LAUNCH_TAB, extension->launch_container());
+ EXPECT_EQ(extension_misc::LAUNCH_TAB,
+ AppLauncherInfo::GetLaunchContainer(extension));
extension = LoadAndExpectSuccess("launch_panel.json");
- EXPECT_EQ(extension_misc::LAUNCH_PANEL, extension->launch_container());
+ EXPECT_EQ(extension_misc::LAUNCH_PANEL,
+ AppLauncherInfo::GetLaunchContainer(extension));
extension = LoadAndExpectSuccess("launch_default.json");
- EXPECT_EQ(extension_misc::LAUNCH_TAB, extension->launch_container());
+ EXPECT_EQ(extension_misc::LAUNCH_TAB,
+ AppLauncherInfo::GetLaunchContainer(extension));
extension = LoadAndExpectSuccess("launch_width.json");
- EXPECT_EQ(640, extension->launch_width());
+ EXPECT_EQ(640, AppLauncherInfo::GetLaunchWidth(extension));
extension = LoadAndExpectSuccess("launch_height.json");
- EXPECT_EQ(480, extension->launch_height());
+ EXPECT_EQ(480, AppLauncherInfo::GetLaunchHeight(extension));
Testcase testcases[] = {
Testcase("launch_window.json", errors::kInvalidLaunchContainer),
@@ -63,7 +74,7 @@ TEST_F(ExtensionManifestTest, AppLaunchContainer) {
EXPECT_TYPE_ERROR);
}
-TEST_F(ExtensionManifestTest, AppLaunchURL) {
+TEST_F(AppLaunchManifestTest, AppLaunchURL) {
Testcase testcases[] = {
Testcase("launch_path_and_url.json",
errors::kLaunchPathAndURLAreExclusive),
@@ -101,14 +112,14 @@ TEST_F(ExtensionManifestTest, AppLaunchURL) {
RunTestcases(testcases, arraysize(testcases),
EXPECT_TYPE_ERROR);
- scoped_refptr<extensions::Extension> extension;
+ scoped_refptr<Extension> extension;
extension = LoadAndExpectSuccess("launch_local_path.json");
EXPECT_EQ(extension->url().spec() + "launch.html",
- extension->GetFullLaunchURL().spec());
+ AppLauncherInfo::GetFullLaunchURL(extension).spec());
extension = LoadAndExpectSuccess("launch_local_path_localized.json");
EXPECT_EQ(extension->url().spec() + "launch.html",
- extension->GetFullLaunchURL().spec());
+ AppLauncherInfo::GetFullLaunchURL(extension).spec());
LoadAndExpectError("launch_web_url_relative.json",
ErrorUtils::FormatErrorMessage(
@@ -117,8 +128,10 @@ TEST_F(ExtensionManifestTest, AppLaunchURL) {
extension = LoadAndExpectSuccess("launch_web_url_absolute.json");
EXPECT_EQ(GURL("http://www.google.com/launch.html"),
- extension->GetFullLaunchURL());
+ AppLauncherInfo::GetFullLaunchURL(extension));
extension = LoadAndExpectSuccess("launch_web_url_localized.json");
EXPECT_EQ(GURL("http://www.google.com/launch.html"),
- extension->GetFullLaunchURL());
+ AppLauncherInfo::GetFullLaunchURL(extension));
}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698