update_engine: Reduce file size for p2p /tmp files.

The P2PManagerTest.ShareFile unit test requires to have enough free
space in /tmp to hold a file, although it never creates the file.

This patch reduces the requirement from 10MB to 1MB to minimize
false failures when there isn't enough space in /tmp.

BUG=chromium:401341
TEST=FEATURES=test emerge-link update_engine

Change-Id: I6ac5cc6735ed6deef1c81a5dd4a589a0930105df
Reviewed-on: https://chromium-review.googlesource.com/244760
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
diff --git a/p2p_manager_unittest.cc b/p2p_manager_unittest.cc
index 79804f3..8b0c62e 100644
--- a/p2p_manager_unittest.cc
+++ b/p2p_manager_unittest.cc
@@ -352,18 +352,19 @@
                  << "Please update your system to support this feature.";
     return;
   }
+  const int kP2PTestFileSize = 1000 * 1000;  // 1 MB
 
-  EXPECT_TRUE(manager_->FileShare("foo", 10 * 1000 * 1000));
+  EXPECT_TRUE(manager_->FileShare("foo", kP2PTestFileSize));
   EXPECT_EQ(manager_->FileGetPath("foo"),
             test_conf_->GetP2PDir().Append("foo.cros_au.p2p.tmp"));
   EXPECT_TRUE(CheckP2PFile(test_conf_->GetP2PDir().value(),
-                           "foo.cros_au.p2p.tmp", 0, 10 * 1000 * 1000));
+                           "foo.cros_au.p2p.tmp", 0, kP2PTestFileSize));
 
   // Sharing it again - with the same expected size - should return true
-  EXPECT_TRUE(manager_->FileShare("foo", 10 * 1000 * 1000));
+  EXPECT_TRUE(manager_->FileShare("foo", kP2PTestFileSize));
 
   // ... but if we use the wrong size, it should fail
-  EXPECT_FALSE(manager_->FileShare("foo", 10 * 1000 * 1000 + 1));
+  EXPECT_FALSE(manager_->FileShare("foo", kP2PTestFileSize + 1));
 }
 
 // Check that making a shared file visible, does what is expected.
@@ -373,13 +374,14 @@
                  << "Please update your system to support this feature.";
     return;
   }
+  const int kP2PTestFileSize = 1000 * 1000;  // 1 MB
 
   // First, check that it's not visible.
-  manager_->FileShare("foo", 10*1000*1000);
+  manager_->FileShare("foo", kP2PTestFileSize);
   EXPECT_EQ(manager_->FileGetPath("foo"),
             test_conf_->GetP2PDir().Append("foo.cros_au.p2p.tmp"));
   EXPECT_TRUE(CheckP2PFile(test_conf_->GetP2PDir().value(),
-                           "foo.cros_au.p2p.tmp", 0, 10 * 1000 * 1000));
+                           "foo.cros_au.p2p.tmp", 0, kP2PTestFileSize));
   // Make the file visible and check that it changed its name. Do it
   // twice to check that FileMakeVisible() is idempotent.
   for (int n = 0; n < 2; n++) {
@@ -387,7 +389,7 @@
     EXPECT_EQ(manager_->FileGetPath("foo"),
               test_conf_->GetP2PDir().Append("foo.cros_au.p2p"));
     EXPECT_TRUE(CheckP2PFile(test_conf_->GetP2PDir().value(),
-                             "foo.cros_au.p2p", 0, 10 * 1000 * 1000));
+                             "foo.cros_au.p2p", 0, kP2PTestFileSize));
   }
 }