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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 #endif | 300 #endif |
301 | 301 |
302 base::FilePath first_profile = | 302 base::FilePath first_profile = |
303 user_data_directory.AppendASCII(first_profile_name_); | 303 user_data_directory.AppendASCII(first_profile_name_); |
304 CHECK(file_util::CreateDirectory(first_profile)); | 304 CHECK(file_util::CreateDirectory(first_profile)); |
305 | 305 |
306 base::FilePath stock_prefs_file; | 306 base::FilePath stock_prefs_file; |
307 PathService::Get(chrome::DIR_TEST_DATA, &stock_prefs_file); | 307 PathService::Get(chrome::DIR_TEST_DATA, &stock_prefs_file); |
308 stock_prefs_file = stock_prefs_file.AppendASCII("performance_monitor") | 308 stock_prefs_file = stock_prefs_file.AppendASCII("performance_monitor") |
309 .AppendASCII("unclean_exit_prefs"); | 309 .AppendASCII("unclean_exit_prefs"); |
310 CHECK(file_util::PathExists(stock_prefs_file)); | 310 CHECK(base::PathExists(stock_prefs_file)); |
311 | 311 |
312 base::FilePath first_profile_prefs_file = | 312 base::FilePath first_profile_prefs_file = |
313 first_profile.Append(chrome::kPreferencesFilename); | 313 first_profile.Append(chrome::kPreferencesFilename); |
314 CHECK(base::CopyFile(stock_prefs_file, first_profile_prefs_file)); | 314 CHECK(base::CopyFile(stock_prefs_file, first_profile_prefs_file)); |
315 CHECK(file_util::PathExists(first_profile_prefs_file)); | 315 CHECK(base::PathExists(first_profile_prefs_file)); |
316 | 316 |
317 second_profile_name_ = | 317 second_profile_name_ = |
318 std::string(chrome::kMultiProfileDirPrefix) | 318 std::string(chrome::kMultiProfileDirPrefix) |
319 .append(base::IntToString(1)); | 319 .append(base::IntToString(1)); |
320 | 320 |
321 base::FilePath second_profile = | 321 base::FilePath second_profile = |
322 user_data_directory.AppendASCII(second_profile_name_); | 322 user_data_directory.AppendASCII(second_profile_name_); |
323 CHECK(file_util::CreateDirectory(second_profile)); | 323 CHECK(file_util::CreateDirectory(second_profile)); |
324 | 324 |
325 base::FilePath second_profile_prefs_file = | 325 base::FilePath second_profile_prefs_file = |
326 second_profile.Append(chrome::kPreferencesFilename); | 326 second_profile.Append(chrome::kPreferencesFilename); |
327 CHECK(base::CopyFile(stock_prefs_file, second_profile_prefs_file)); | 327 CHECK(base::CopyFile(stock_prefs_file, second_profile_prefs_file)); |
328 CHECK(file_util::PathExists(second_profile_prefs_file)); | 328 CHECK(base::PathExists(second_profile_prefs_file)); |
329 | 329 |
330 return true; | 330 return true; |
331 } | 331 } |
332 | 332 |
333 protected: | 333 protected: |
334 std::string first_profile_name_; | 334 std::string first_profile_name_; |
335 std::string second_profile_name_; | 335 std::string second_profile_name_; |
336 }; | 336 }; |
337 | 337 |
338 class PerformanceMonitorSessionRestoreBrowserTest | 338 class PerformanceMonitorSessionRestoreBrowserTest |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 test_server()->GetURL(std::string("files/").append("title2.html"))); | 790 test_server()->GetURL(std::string("files/").append("title2.html"))); |
791 | 791 |
792 performance_monitor()->DoTimedCollections(); | 792 performance_monitor()->DoTimedCollections(); |
793 | 793 |
794 metrics = GetStats(METRIC_NETWORK_BYTES_READ); | 794 metrics = GetStats(METRIC_NETWORK_BYTES_READ); |
795 ASSERT_EQ(2u, metrics.size()); | 795 ASSERT_EQ(2u, metrics.size()); |
796 EXPECT_GE(metrics[1].value, page1_size + page2_size); | 796 EXPECT_GE(metrics[1].value, page1_size + page2_size); |
797 } | 797 } |
798 | 798 |
799 } // namespace performance_monitor | 799 } // namespace performance_monitor |
OLD | NEW |