| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "breakpad/src/client/windows/common/ipc_protocol.h" | 8 #include "breakpad/src/client/windows/common/ipc_protocol.h" |
| 9 #include "chrome/app/breakpad_field_trial_win.h" | 9 #include "chrome/app/breakpad_field_trial_win.h" |
| 10 #include "chrome/app/breakpad_win.h" | 10 #include "chrome/app/breakpad_win.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 typedef std::vector<string16> Experiments; | 25 typedef std::vector<string16> Experiments; |
| 26 void ValidateExperimentChunks(const Experiments& experiments) { | 26 void ValidateExperimentChunks(const Experiments& experiments) { |
| 27 testing::SetExperimentList(experiments); | 27 testing::SetExperimentList(experiments); |
| 28 EXPECT_STREQ(base::StringPrintf(L"%d", experiments.size()).c_str(), | 28 EXPECT_STREQ(base::StringPrintf(L"%d", experiments.size()).c_str(), |
| 29 (*g_custom_entries)[g_num_of_experiments_offset].value); | 29 (*g_custom_entries)[g_num_of_experiments_offset].value); |
| 30 // We make a copy of the array that we empty as we find the experiments. | 30 // We make a copy of the array that we empty as we find the experiments. |
| 31 Experiments experiments_left(experiments); | 31 Experiments experiments_left(experiments); |
| 32 for (int i = 0; i < kMaxReportedExperimentChunks; ++i) { | 32 for (int i = 0; i < kMaxReportedVariationChunks; ++i) { |
| 33 EXPECT_STREQ(base::StringPrintf(L"experiment-chunk-%i", i + 1).c_str(), | 33 EXPECT_STREQ(base::StringPrintf(L"experiment-chunk-%i", i + 1).c_str(), |
| 34 (*g_custom_entries)[g_experiment_chunks_offset + i].name); | 34 (*g_custom_entries)[g_experiment_chunks_offset + i].name); |
| 35 if (experiments_left.empty()) { | 35 if (experiments_left.empty()) { |
| 36 // All other slots should be empty. | 36 // All other slots should be empty. |
| 37 EXPECT_STREQ( | 37 EXPECT_STREQ( |
| 38 L"", (*g_custom_entries)[g_experiment_chunks_offset + i].value); | 38 L"", (*g_custom_entries)[g_experiment_chunks_offset + i].value); |
| 39 } else { | 39 } else { |
| 40 // We can't guarantee the order, so we must search for them all. | 40 // We can't guarantee the order, so we must search for them all. |
| 41 Experiments::const_iterator experiment = experiments_left.begin(); | 41 Experiments::const_iterator experiment = experiments_left.begin(); |
| 42 while (experiment != experiments_left.end()) { | 42 while (experiment != experiments_left.end()) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 68 | 68 |
| 69 experiments.push_back(L"There-You Are"); | 69 experiments.push_back(L"There-You Are"); |
| 70 ValidateExperimentChunks(experiments); | 70 ValidateExperimentChunks(experiments); |
| 71 | 71 |
| 72 experiments.push_back(L"Peter-Sellers"); | 72 experiments.push_back(L"Peter-Sellers"); |
| 73 ValidateExperimentChunks(experiments); | 73 ValidateExperimentChunks(experiments); |
| 74 | 74 |
| 75 experiments.push_back(L"Eat me-Drink me"); | 75 experiments.push_back(L"Eat me-Drink me"); |
| 76 ValidateExperimentChunks(experiments); | 76 ValidateExperimentChunks(experiments); |
| 77 } | 77 } |
| OLD | NEW |