Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: chrome/browser/google_update_settings_mac_unittest.mm

Issue 173020: Make Mac first run store sentinel in Profile directory. (Closed)
Patch Set: spelling Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <Foundation/Foundation.h>
6
7 #include "base/basictypes.h"
8 #include "base/logging.h"
9 #include "base/sys_string_conversions.h"
10 #include "chrome/installer/util/google_update_constants.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "testing/platform_test.h"
13
14 namespace google_update {
15
16 bool GetCollectStatsConsentFromDictionary(NSDictionary* dict);
17
18 } // namespace google_update
19
20
21 class GoogleUpdateTest : public PlatformTest {
22 };
23
24 TEST_F(GoogleUpdateTest, StatsConstent) {
25 using google_update::GetCollectStatsConsentFromDictionary;
26
27 // Stats are off by default.
28 NSDictionary* empty_dict = [NSDictionary dictionary];
29 ASSERT_FALSE(GetCollectStatsConsentFromDictionary(empty_dict));
30
31 NSString* collect_stats_key = base::SysWideToNSString(
32 google_update::kRegUsageStatsField);
33
34 // Stats reporting is ON.
35 NSNumber* stats_enabled = [NSNumber numberWithBool:YES];
36 NSDictionary* enabled_dict = [NSDictionary
37 dictionaryWithObject:stats_enabled
38 forKey:collect_stats_key];
39 ASSERT_TRUE(GetCollectStatsConsentFromDictionary(enabled_dict));
40
41 // Stats reporting is OFF.
42 NSNumber* stats_disabled = [NSNumber numberWithBool:NO];
43 NSDictionary* disabled_dict = [NSDictionary
44 dictionaryWithObject:stats_disabled
45 forKey:collect_stats_key];
46 ASSERT_FALSE(GetCollectStatsConsentFromDictionary(disabled_dict));
47
48 // Check that we fail gracefully if an object of the wrong type is present.
49 NSDictionary* wrong_type_dict = [NSDictionary
50 dictionaryWithObject:empty_dict
51 forKey:collect_stats_key];
52 ASSERT_FALSE(GetCollectStatsConsentFromDictionary(wrong_type_dict));
53 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698