[Extension test] Add ability to load event_page extension as SW extension.

Add a flag to RunExtensionTest so that an existing event page based
test extension can be loaded as SW based extension. This can be
used to run extension tests with Service Worker based extensions.

This CL also adds a simple event page based tabs API test
at tabs/lazy_background_on_created/ and demonstrates that
the extension can be loaded as SW extension and the corresponding test
ExtensionApiTabTest.LazyBackgroundTabsOnCreated passes with the flag in
ServiceWorkerBasedBackgroundTest.TabsOnCreated.

Doc: https://docs.google.com/document/d/1PvXZ7VGRGdmd1s99SFByn9NCGj0GAiBhhPmfjj35ZeI/edit#

Bug: 967899
Change-Id: Ie979986e4c9f5bcac644152d8527aeb1c8c365c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636988
Commit-Queue: Istiaque Ahmed <[email protected]>
Reviewed-by: Devlin <[email protected]>
Cr-Commit-Position: refs/heads/master@{#666484}
diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc
index b92e752..4b47ee6 100644
--- a/chrome/browser/extensions/service_worker_apitest.cc
+++ b/chrome/browser/extensions/service_worker_apitest.cc
@@ -1794,6 +1794,12 @@
   EXPECT_TRUE(moved_tab_listener.WaitUntilSatisfied());
 }
 
+IN_PROC_BROWSER_TEST_F(ServiceWorkerBasedBackgroundTest, TabsOnCreated) {
+  ASSERT_TRUE(RunExtensionTestWithFlags("tabs/lazy_background_on_created",
+                                        kFlagRunAsServiceWorkerBasedExtension))
+      << message_;
+}
+
 // Tests that console messages logged by extension service workers, both via
 // the typical console.* methods and via our custom bindings console, are
 // passed through the normal ServiceWorker console messaging and are