| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/extension_record_api.h" | 5 #include "chrome/browser/extensions/extension_record_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 namespace utils = extension_function_test_utils; | 30 namespace utils = extension_function_test_utils; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 // Dummy content for mock stats file. | 34 // Dummy content for mock stats file. |
| 35 const std::string kTestStatistics = "Sample Stat 1\nSample Stat 2\n"; | 35 const std::string kTestStatistics = "Sample Stat 1\nSample Stat 2\n"; |
| 36 | 36 |
| 37 // Standard capture parameters, with a mix of good and bad URLs, and | 37 // Standard capture parameters, with a mix of good and bad URLs, and |
| 38 // a hole for filling in the user data dir. | 38 // a hole for filling in the user data dir. |
| 39 const char kCaptureArgs1[] = | 39 const char kCaptureArgs1[] = |
| 40 "[[\"URL 1\", \"URL 2(bad)\", \"URL 3\", \"URL 4(bad)\"], \"%s\"]"; | 40 "[[\"URL 1\", \"URL 2(bad)\", \"URL 3\", \"URL 4(bad)\"]" |
| 41 ", \"%s\", 2]"; |
| 41 | 42 |
| 42 // Standard playback parameters, with the same mix of good and bad URLs | 43 // Standard playback parameters, with the same mix of good and bad URLs |
| 43 // as the capture parameters, a hole for filling in the user data dir, and | 44 // as the capture parameters, a hole for filling in the user data dir, and |
| 44 // a mocked-up extension path and repeat count (which are used only to | 45 // a mocked-up extension path and repeat count (which are used only to |
| 45 // verify that they made it into the CommandLine, since extension loading | 46 // verify that they made it into the CommandLine, since extension loading |
| 46 // and repeat-counting are hard to emulate in the test ProcessStrategy. | 47 // and repeat-counting are hard to emulate in the test ProcessStrategy. |
| 47 const char kPlaybackArgs1[] = | 48 const char kPlaybackArgs1[] = |
| 48 "[[\"URL 1\", \"URL 2(bad)\", \"URL 3\", \"URL 4(bad)\"], \"%s\"" | 49 "[[\"URL 1\", \"URL 2(bad)\", \"URL 3\", \"URL 4(bad)\"], \"%s\"" |
| 49 ", {\"extensionPath\": \"MockExtension\", \"repeatCount\": 2}]"; | 50 ", 2, {\"extensionPath\": \"MockExtension\"}]"; |
| 50 | 51 |
| 51 // Use this as the value of FilePath switches (e.g. user-data-dir) that | 52 // Use this as the value of FilePath switches (e.g. user-data-dir) that |
| 52 // should be replaced by the record methods. | 53 // should be replaced by the record methods. |
| 53 const FilePath::CharType kDummyDirName[] = FILE_PATH_LITERAL("ReplaceMe"); | 54 const FilePath::CharType kDummyDirName[] = FILE_PATH_LITERAL("ReplaceMe"); |
| 54 | 55 |
| 55 // Use this as the filename for a mock "cache" file in the user-data-dir. | 56 // Use this as the filename for a mock "cache" file in the user-data-dir. |
| 56 const FilePath::CharType kMockCacheFile[] = FILE_PATH_LITERAL("MockCache"); | 57 const FilePath::CharType kMockCacheFile[] = FILE_PATH_LITERAL("MockCache"); |
| 57 | 58 |
| 58 // Prefix for temporary user data directory | 59 // Prefix for temporary user data directory |
| 59 const FilePath::CharType kUserDataDirPrefix[] | 60 const FilePath::CharType kUserDataDirPrefix[] |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 command_line.GetSwitchValueASCII(switches::kVisitURLsCount).compare("2") | 339 command_line.GetSwitchValueASCII(switches::kVisitURLsCount).compare("2") |
| 339 == 0); | 340 == 0); |
| 340 | 341 |
| 341 // Check for return value with proper stats. | 342 // Check for return value with proper stats. |
| 342 EXPECT_EQ(kTestStatistics, utils::GetString(result.get(), kStatsKey)); | 343 EXPECT_EQ(kTestStatistics, utils::GetString(result.get(), kStatsKey)); |
| 343 | 344 |
| 344 ListValue* errors = NULL; | 345 ListValue* errors = NULL; |
| 345 EXPECT_TRUE(result->GetList(kErrorsKey, &errors)); | 346 EXPECT_TRUE(result->GetList(kErrorsKey, &errors)); |
| 346 EXPECT_TRUE(VerifyURLHandling(errors, strategy)); | 347 EXPECT_TRUE(VerifyURLHandling(errors, strategy)); |
| 347 } | 348 } |
| OLD | NEW |