Reland "FLEDGE: field trial testing config for 20->40 in component ads limit"

This reverts commit 2650556d1e0977967c84733a5c252b09b0f0157d.

Changes for reland: Include Fuchsia in field trial config, and force on the flags in browser tests by hand as well

Original change's description:
> Revert "FLEDGE: field trial testing config for 20->40 in component ads limit"
>
> This reverts commit c825fae53cdfa08b33e560c15bb7020e0646a451.
>
> Reason for revert:
> LUCI Bisection has identified this change as the cause of a test failure. See the analysis: https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/5753898272817152
>
> Original change's description:
> > FLEDGE: field trial testing config for 20->40 in component ads limit
> >
> > Fix the bug this revealed, and update test expectations to notice the corresponding feature detection browser signals showing up. Also add a new WPT test for new limit, since I was in the neighborhood anyway.
> >
> > Bug: 324445653
> >
> > Change-Id: Ib1f3d23f0ea2657c8e27cab67caddff1208825e1
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5280539
> > Reviewed-by: Russ Hamilton <behamilton@google.com>
> > Commit-Queue: Maks Orlovich <morlovich@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1258749}
> >
>
> Bug: 324445653
> Change-Id: I60ed84e1607b879446e09b53e824368a3a4cd209
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5282851
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Tim Sergeant <tsergeant@chromium.org>
> Commit-Queue: Tim Sergeant <tsergeant@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1258985}

Bug: 324445653, 324647198
Change-Id: I29ebdb03208aeccbb04320543f82679a56087250
Cq-Include-Trybots: luci.chromium.try:fuchsia-arm64-cast-receiver-rel,android-official,linux-official
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5285075
Reviewed-by: Russ Hamilton <behamilton@google.com>
Commit-Queue: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1259286}
diff --git a/fenced-frame/get-nested-configs.https.html b/fenced-frame/get-nested-configs.https.html
index da77f94..2876e52 100644
--- a/fenced-frame/get-nested-configs.https.html
+++ b/fenced-frame/get-nested-configs.https.html
@@ -17,7 +17,7 @@
   const response = await nextValueFromServer(key);
   const [length] = response.split(",");
 
-  assert_equals(length, '20', 'There should be 20 nested configurations.');
+  assert_equals(length, '40', 'There should be 40 nested configurations.');
 }, 'getNestedConfigs() created by FLEDGE should return configurations');
 
 for (const resolve_to_config of [true, false]) {
@@ -57,7 +57,7 @@
   const response = await nextValueFromServer(key);
   const [length, first_url] = response.split(",");
 
-  assert_equals(length, '20', 'There should be 20 nested configurations.');
+  assert_equals(length, '40', 'There should be 40 nested configurations.');
 }, 'getNestedConfigs() should work in a same-origin nested iframe');
 
 promise_test(async (t) => {
diff --git a/fledge/tentative/component-ads.https.window.js b/fledge/tentative/component-ads.https.window.js
index 719a645..7e98570 100644
--- a/fledge/tentative/component-ads.https.window.js
+++ b/fledge/tentative/component-ads.https.window.js
@@ -61,7 +61,7 @@
       `// "status" is passed to the beacon URL, to be verified by waitForObservedRequests().
        let status = "ok";
        const componentAds = window.fence.getNestedConfigs()
-       if (componentAds.length != 20)
+       if (componentAds.length != 40)
          status = "unexpected getNestedConfigs() length";
        for (let i of ${JSON.stringify(componentAdsToLoad)}) {
          let fencedFrame = document.createElement("fencedframe");
@@ -72,8 +72,7 @@
 
        window.fence.reportEvent({eventType: "beacon",
                                  eventData: status,
-                                 destination: ["buyer"]});`
-      );
+                                 destination: ["buyer"]});`);
 
   let bid = {bid:1, render: renderURL};
   if (componentAdsInBid) {
@@ -141,13 +140,11 @@
 subsetTest(promise_test, async test => {
   const uuid = generateUuid(test);
 
-  const renderURL = createRenderURL(
-    uuid,
-    `let status = "ok";
+  const renderURL = createRenderURL(uuid, `let status = "ok";
      const nestedConfigsLength = window.fence.getNestedConfigs().length
-     // "getNestedConfigs()" should return a list of 20 configs, to avoid leaking
+     // "getNestedConfigs()" should return a list of 40 configs, to avoid leaking
      // whether there were any component URLs to the page.
-     if (nestedConfigsLength != 20)
+     if (nestedConfigsLength != 40)
        status = "unexpected getNestedConfigs() length: " + nestedConfigsLength;
      window.fence.reportEvent({eventType: "beacon",
                                eventData: status,
@@ -293,6 +290,18 @@
 
 subsetTest(promise_test, async test => {
   const uuid = generateUuid(test);
+  const intsUpTo39 = [];
+  for (let i = 0; i < 40; ++i) {
+    intsUpTo39.push(i);
+  }
+  await runComponentAdLoadingTest(
+      test, uuid, /*numComponentAdsInInterestGroup=*/ 40,
+      /*componentAdsInBid=*/ intsUpTo39,
+      /*componentAdsToLoad=*/ intsUpTo39);
+}, '40 of 40 component ads in bid and then shown.');
+
+subsetTest(promise_test, async test => {
+  const uuid = generateUuid(test);
   await runComponentAdLoadingTest(test, uuid, /*numComponentAdsInInterestGroup=*/20,
                                   /*componentAdsInBid=*/[1, 2, 3, 4, 5, 6],
                                   /*componentAdsToLoad=*/[1, 3]);
@@ -330,7 +339,7 @@
 
   let adComponents = [];
   let adComponentsList = [];
-  for (let i = 0; i < 21; ++i) {
+  for (let i = 0; i < 41; ++i) {
     let componentRenderURL = createComponentAdTrackerURL(uuid, i);
     adComponents.push({renderURL: componentRenderURL});
     adComponentsList.push(componentRenderURL);
@@ -348,7 +357,7 @@
                                  adComponents: ${JSON.stringify(adComponentsList)}};`}),
             ads: [{renderURL: renderURL}],
             adComponents: adComponents}});
-}, '21 component ads not allowed in bid.');
+}, '41 component ads not allowed in bid.');
 
 subsetTest(promise_test, async test => {
   const uuid = generateUuid(test);
@@ -356,7 +365,7 @@
 
   let adComponents = [];
   let adComponentsList = [];
-  for (let i = 0; i < 21; ++i) {
+  for (let i = 0; i < 41; ++i) {
     let componentRenderURL = createComponentAdTrackerURL(uuid, i);
     adComponents.push({renderURL: componentRenderURL});
     adComponentsList.push(adComponents[0].renderURL);
@@ -374,7 +383,7 @@
                          adComponents: ${JSON.stringify(adComponentsList)}};`}),
             ads: [{renderURL: renderURL}],
             adComponents: adComponents}});
-}, 'Same component ad not allowed 21 times in bid.');
+}, 'Same component ad not allowed 41 times in bid.');
 
 subsetTest(promise_test, async test => {
   const uuid = generateUuid(test);