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

Unified Diff: chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc

Issue 286203003: Whitelist chrome.screenlockPrivate only for component apps on ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Run tests as component extension tests on ChromeOS Created 6 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 | « no previous file | chrome/common/extensions/api/_permission_features.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc
diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc
index 7a1fd37f61d96deb57589e92f5cf999179fc8b4d..f4ac37771861c22b47387a8b425423bbeebede2d 100644
--- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc
+++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc
@@ -10,13 +10,15 @@
#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/notification_service.h"
#include "extensions/browser/api/test/test_api.h"
+#include "extensions/common/switches.h"
namespace extensions {
namespace {
-const char kTestUser[] = "testuser@gmail.com";
const char kAttemptClickAuthMessage[] = "attemptClickAuth";
+const char kTestExtensionId[] = "lkegkdgachcnekllcdfkijonogckdnjo";
+const char kTestUser[] = "testuser@gmail.com";
} // namespace
@@ -30,10 +32,12 @@ class ScreenlockPrivateApiTest : public ExtensionApiTest,
// ExtensionApiTest
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
ExtensionApiTest::SetUpCommandLine(command_line);
+ command_line->AppendSwitchASCII(
+ extensions::switches::kWhitelistedExtensionID, kTestExtensionId);
#if !defined(OS_CHROMEOS)
// New profile management needs to be on for non-ChromeOS lock.
- switches::EnableNewProfileManagementForTesting(command_line);
+ ::switches::EnableNewProfileManagementForTesting(command_line);
#endif
}
@@ -67,6 +71,16 @@ class ScreenlockPrivateApiTest : public ExtensionApiTest,
}
}
+ // Loads |extension_name| as appropriate for the platform and waits for a
+ // pass / fail notification.
+ void RunTest(const std::string& extension_name) {
+#if defined(OS_CHROMEOS)
+ ASSERT_TRUE(RunComponentExtensionTest(extension_name)) << message_;
+#else
+ ASSERT_TRUE(RunExtensionTest(extension_name)) << message_;
+#endif
+ }
+
private:
content::NotificationRegistrar registrar_;
@@ -74,11 +88,11 @@ class ScreenlockPrivateApiTest : public ExtensionApiTest,
};
IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, LockUnlock) {
- ASSERT_TRUE(RunExtensionTest("screenlock_private/lock_unlock")) << message_;
+ RunTest("screenlock_private/lock_unlock");
}
IN_PROC_BROWSER_TEST_F(ScreenlockPrivateApiTest, AuthType) {
- ASSERT_TRUE(RunExtensionTest("screenlock_private/auth_type")) << message_;
+ RunTest("screenlock_private/auth_type");
}
} // namespace extensions
« no previous file with comments | « no previous file | chrome/common/extensions/api/_permission_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698