OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/test_extension_system.h" | 10 #include "chrome/browser/extensions/test_extension_system.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 ~MessageCenterSettingsControllerBaseTest() override{}; | 33 ~MessageCenterSettingsControllerBaseTest() override{}; |
34 | 34 |
35 base::FilePath GetProfilePath(const std::string& base_name) { | 35 base::FilePath GetProfilePath(const std::string& base_name) { |
36 return testing_profile_manager_.profile_manager()->user_data_dir() | 36 return testing_profile_manager_.profile_manager()->user_data_dir() |
37 .AppendASCII(base_name); | 37 .AppendASCII(base_name); |
38 } | 38 } |
39 | 39 |
40 void SetUp() override { ASSERT_TRUE(testing_profile_manager_.SetUp()); } | 40 void SetUp() override { ASSERT_TRUE(testing_profile_manager_.SetUp()); } |
41 | 41 |
42 virtual TestingProfile* CreateProfile(const std::string& name) { | 42 virtual TestingProfile* CreateProfile(const std::string& name) { |
43 TestingProfile* profile = | 43 return testing_profile_manager_.CreateTestingProfile(name); |
44 testing_profile_manager_.CreateTestingProfile(name); | |
45 ProfileInfoCache* cache = testing_profile_manager_.profile_info_cache(); | |
46 // Preload the avatar icon so it's cached for the test's execution. This | |
47 // test is synchronous, but access of the AvatarIcon during creation of the | |
48 // ProfileNotifierGroup will post tasks to create the gfx::Image that don't | |
49 // execute until after NotifierGroups's deleted, meaning the references leak | |
50 // and cause ASAN errors. | |
51 cache->GetAvatarIconOfProfileAtIndex( | |
52 cache->GetIndexOfProfileWithPath(profile->GetPath())); | |
53 base::MessageLoop::current()->RunUntilIdle(); | |
54 return profile; | |
55 } | 44 } |
56 | 45 |
57 void CreateController() { | 46 void CreateController() { |
58 controller_.reset(new MessageCenterSettingsController( | 47 controller_.reset(new MessageCenterSettingsController( |
59 testing_profile_manager_.profile_info_cache())); | 48 testing_profile_manager_.profile_info_cache())); |
60 } | 49 } |
61 | 50 |
62 void ResetController() { | 51 void ResetController() { |
63 controller_.reset(); | 52 controller_.reset(); |
64 } | 53 } |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 EXPECT_EQ(3u, notifiers.size()); | 250 EXPECT_EQ(3u, notifiers.size()); |
262 EXPECT_EQ(ash::system_notifier::kNotifierScreenshot, | 251 EXPECT_EQ(ash::system_notifier::kNotifierScreenshot, |
263 notifiers[2]->notifier_id.id); | 252 notifiers[2]->notifier_id.id); |
264 #endif | 253 #endif |
265 | 254 |
266 EXPECT_EQ(kBarId, notifiers[0]->notifier_id.id); | 255 EXPECT_EQ(kBarId, notifiers[0]->notifier_id.id); |
267 EXPECT_EQ(kFooId, notifiers[1]->notifier_id.id); | 256 EXPECT_EQ(kFooId, notifiers[1]->notifier_id.id); |
268 | 257 |
269 STLDeleteElements(¬ifiers); | 258 STLDeleteElements(¬ifiers); |
270 } | 259 } |
OLD | NEW |