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

Unified Diff: apps/load_and_launch_browsertest.cc

Issue 2181393002: Revert of Restrict use of two app-launching command line flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « apps/app_load_service.cc ('k') | chrome/browser/extensions/extension_system_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: apps/load_and_launch_browsertest.cc
diff --git a/apps/load_and_launch_browsertest.cc b/apps/load_and_launch_browsertest.cc
index 2edb104aa9479ed314062696b10f353082a0e254..fc95daec61bc75a6fdd0be387e65942f9d00ab93 100644
--- a/apps/load_and_launch_browsertest.cc
+++ b/apps/load_and_launch_browsertest.cc
@@ -8,17 +8,13 @@
#include "apps/switches.h"
#include "base/process/launch.h"
-#include "base/strings/utf_string_conversions.h"
#include "base/test/test_timeouts.h"
#include "chrome/browser/apps/app_browsertest_util.h"
#include "chrome/browser/extensions/extension_browsertest.h"
-#include "chrome/browser/extensions/extension_error_reporter.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/ui/simple_message_box_internal.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/test_launcher.h"
-#include "extensions/browser/extension_registry.h"
#include "extensions/test/extension_test_message_listener.h"
using extensions::PlatformAppBrowserTest;
@@ -31,8 +27,6 @@
switches::kUserDataDir,
switches::kNoSandbox,
};
-
-static const std::string kTestExtensionId("behllobkkfkfnphdnhnkndlbkcpglgmj");
} // namespace
@@ -118,17 +112,18 @@
namespace {
-// TestFixture that appends --load-and-launch-app with an app before calling
-// BrowserMain.
-class LoadAndLaunchPlatformAppBrowserTest : public PlatformAppBrowserTest {
+// TestFixture that appends --load-and-launch-app before calling BrowserMain.
+class PlatformAppLoadAndLaunchBrowserTest : public PlatformAppBrowserTest {
protected:
- LoadAndLaunchPlatformAppBrowserTest() {}
+ PlatformAppLoadAndLaunchBrowserTest() {}
void SetUpCommandLine(base::CommandLine* command_line) override {
PlatformAppBrowserTest::SetUpCommandLine(command_line);
- base::FilePath app_path =
- test_data_dir_.AppendASCII("platform_apps").AppendASCII("minimal");
- command_line->AppendSwitchNative(apps::kLoadAndLaunchApp, app_path.value());
+ app_path_ = test_data_dir_
+ .AppendASCII("platform_apps")
+ .AppendASCII("minimal");
+ command_line->AppendSwitchNative(apps::kLoadAndLaunchApp,
+ app_path_.value());
}
void LoadAndLaunchApp() {
@@ -141,32 +136,9 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(LoadAndLaunchPlatformAppBrowserTest);
-};
+ base::FilePath app_path_;
-// TestFixture that appends --load-and-launch-app with an extension before
-// calling BrowserMain.
-class LoadAndLaunchExtensionBrowserTest : public PlatformAppBrowserTest {
- protected:
- LoadAndLaunchExtensionBrowserTest() {}
-
- void SetUpCommandLine(base::CommandLine* command_line) override {
- PlatformAppBrowserTest::SetUpCommandLine(command_line);
- base::FilePath app_path = test_data_dir_.AppendASCII("good")
- .AppendASCII("Extensions")
- .AppendASCII(kTestExtensionId)
- .AppendASCII("1.0.0.0");
- command_line->AppendSwitchNative(apps::kLoadAndLaunchApp, app_path.value());
- }
-
- void SetUpInProcessBrowserTestFixture() override {
- PlatformAppBrowserTest::SetUpInProcessBrowserTestFixture();
-
- // Skip showing the error message box to avoid freezing the main thread.
- chrome::internal::g_should_skip_message_box_for_test = true;
- }
-
- DISALLOW_COPY_AND_ASSIGN(LoadAndLaunchExtensionBrowserTest);
+ DISALLOW_COPY_AND_ASSIGN(PlatformAppLoadAndLaunchBrowserTest);
};
} // namespace
@@ -183,32 +155,9 @@
#endif
// Case where Chrome is not running.
-IN_PROC_BROWSER_TEST_F(LoadAndLaunchPlatformAppBrowserTest,
+IN_PROC_BROWSER_TEST_F(PlatformAppLoadAndLaunchBrowserTest,
MAYBE_LoadAndLaunchAppChromeNotRunning) {
LoadAndLaunchApp();
}
-IN_PROC_BROWSER_TEST_F(LoadAndLaunchExtensionBrowserTest,
- LoadAndLaunchExtension) {
- const std::vector<base::string16>* errors =
- ExtensionErrorReporter::GetInstance()->GetErrors();
-
-#if defined(GOOGLE_CHROME_BUILD)
- // The error is skipped on official builds.
- EXPECT_TRUE(errors->empty());
-#else
- // Expect kUnpackedExtensionInsteadOfAppError.
- EXPECT_EQ(1u, errors->size());
- EXPECT_NE(base::string16::npos,
- errors->at(0).find(base::ASCIIToUTF16(
- "App loading flags cannot be used to load extensions")));
-#endif
-
- extensions::ExtensionRegistry* registry =
- extensions::ExtensionRegistry::Get(profile());
- EXPECT_EQ(nullptr,
- registry->GetExtensionById(
- kTestExtensionId, extensions::ExtensionRegistry::EVERYTHING));
-}
-
} // namespace apps
« no previous file with comments | « apps/app_load_service.cc ('k') | chrome/browser/extensions/extension_system_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698