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 24 matching lines...) Expand all Loading... |
35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
36 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
37 #include "chrome/test/base/ui_test_utils.h" | 37 #include "chrome/test/base/ui_test_utils.h" |
38 #include "content/public/browser/notification_registrar.h" | 38 #include "content/public/browser/notification_registrar.h" |
39 #include "content/public/browser/notification_service.h" | 39 #include "content/public/browser/notification_service.h" |
40 #include "content/public/common/page_transition_types.h" | 40 #include "content/public/common/page_transition_types.h" |
41 #include "content/public/test/browser_test_utils.h" | 41 #include "content/public/test/browser_test_utils.h" |
42 #include "content/public/test/test_navigation_observer.h" | 42 #include "content/public/test/test_navigation_observer.h" |
43 #include "content/public/test/test_utils.h" | 43 #include "content/public/test/test_utils.h" |
44 | 44 |
| 45 #if defined(OS_CHROMEOS) |
| 46 #include "chromeos/chromeos_switches.h" |
| 47 #endif |
| 48 |
45 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
46 #include "base/mac/scoped_nsautorelease_pool.h" | 50 #include "base/mac/scoped_nsautorelease_pool.h" |
47 #endif | 51 #endif |
48 | 52 |
49 using extensions::Extension; | 53 using extensions::Extension; |
50 | 54 |
51 namespace performance_monitor { | 55 namespace performance_monitor { |
52 | 56 |
53 namespace { | 57 namespace { |
54 | 58 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 virtual bool SetUpUserDataDirectory() OVERRIDE { | 282 virtual bool SetUpUserDataDirectory() OVERRIDE { |
279 base::FilePath user_data_directory; | 283 base::FilePath user_data_directory; |
280 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); | 284 PathService::Get(chrome::DIR_USER_DATA, &user_data_directory); |
281 | 285 |
282 // On CrOS, if we are "logged in" with the --login-profile switch, | 286 // On CrOS, if we are "logged in" with the --login-profile switch, |
283 // the default profile will be different. We check if we are logged in, and, | 287 // the default profile will be different. We check if we are logged in, and, |
284 // if we are, we use that profile name instead. (Note: trybots will | 288 // if we are, we use that profile name instead. (Note: trybots will |
285 // typically be logged in with 'user'.) | 289 // typically be logged in with 'user'.) |
286 #if defined(OS_CHROMEOS) | 290 #if defined(OS_CHROMEOS) |
287 const CommandLine command_line = *CommandLine::ForCurrentProcess(); | 291 const CommandLine command_line = *CommandLine::ForCurrentProcess(); |
288 if (command_line.HasSwitch(switches::kLoginProfile)) { | 292 if (command_line.HasSwitch(chromeos::switches::kLoginProfile)) { |
289 first_profile_name_ = | 293 first_profile_name_ = |
290 command_line.GetSwitchValueASCII(switches::kLoginProfile); | 294 command_line.GetSwitchValueASCII(chromeos::switches::kLoginProfile); |
291 } else { | 295 } else { |
292 first_profile_name_ = chrome::kInitialProfile; | 296 first_profile_name_ = chrome::kInitialProfile; |
293 } | 297 } |
294 #else | 298 #else |
295 first_profile_name_ = chrome::kInitialProfile; | 299 first_profile_name_ = chrome::kInitialProfile; |
296 #endif | 300 #endif |
297 | 301 |
298 base::FilePath first_profile = | 302 base::FilePath first_profile = |
299 user_data_directory.AppendASCII(first_profile_name_); | 303 user_data_directory.AppendASCII(first_profile_name_); |
300 CHECK(file_util::CreateDirectory(first_profile)); | 304 CHECK(file_util::CreateDirectory(first_profile)); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 test_server()->GetURL(std::string("files/").append("title2.html"))); | 790 test_server()->GetURL(std::string("files/").append("title2.html"))); |
787 | 791 |
788 performance_monitor()->DoTimedCollections(); | 792 performance_monitor()->DoTimedCollections(); |
789 | 793 |
790 metrics = GetStats(METRIC_NETWORK_BYTES_READ); | 794 metrics = GetStats(METRIC_NETWORK_BYTES_READ); |
791 ASSERT_EQ(2u, metrics.size()); | 795 ASSERT_EQ(2u, metrics.size()); |
792 EXPECT_GE(metrics[1].value, page1_size + page2_size); | 796 EXPECT_GE(metrics[1].value, page1_size + page2_size); |
793 } | 797 } |
794 | 798 |
795 } // namespace performance_monitor | 799 } // namespace performance_monitor |
OLD | NEW |