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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 | 24 |
25 namespace em = enterprise_management; | 25 namespace em = enterprise_management; |
26 | 26 |
27 namespace chromeos { | 27 namespace chromeos { |
28 | 28 |
29 class CrosSettingsTest : public testing::Test { | 29 class CrosSettingsTest : public testing::Test { |
30 protected: | 30 protected: |
31 CrosSettingsTest() | 31 CrosSettingsTest() |
32 : message_loop_(MessageLoop::TYPE_UI), | 32 : message_loop_(base::MessageLoop::TYPE_UI), |
33 ui_thread_(content::BrowserThread::UI, &message_loop_), | 33 ui_thread_(content::BrowserThread::UI, &message_loop_), |
34 local_state_(TestingBrowserProcess::GetGlobal()), | 34 local_state_(TestingBrowserProcess::GetGlobal()), |
35 weak_factory_(this) {} | 35 weak_factory_(this) {} |
36 | 36 |
37 virtual ~CrosSettingsTest() {} | 37 virtual ~CrosSettingsTest() {} |
38 | 38 |
39 virtual void TearDown() OVERRIDE { | 39 virtual void TearDown() OVERRIDE { |
40 ASSERT_TRUE(expected_props_.empty()); | 40 ASSERT_TRUE(expected_props_.empty()); |
41 STLDeleteValues(&expected_props_); | 41 STLDeleteValues(&expected_props_); |
42 expected_props_.clear(); | 42 expected_props_.clear(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 em::PolicyFetchResponse response; | 80 em::PolicyFetchResponse response; |
81 em::ChromeDeviceSettingsProto pol; | 81 em::ChromeDeviceSettingsProto pol; |
82 policy->set_policy_type(policy::dm_protocol::kChromeDevicePolicyType); | 82 policy->set_policy_type(policy::dm_protocol::kChromeDevicePolicyType); |
83 policy->set_username("me@owner"); | 83 policy->set_username("me@owner"); |
84 policy->set_policy_value(pol.SerializeAsString()); | 84 policy->set_policy_value(pol.SerializeAsString()); |
85 // Wipe the signed settings store. | 85 // Wipe the signed settings store. |
86 response.set_policy_data(policy->SerializeAsString()); | 86 response.set_policy_data(policy->SerializeAsString()); |
87 response.set_policy_data_signature("false"); | 87 response.set_policy_data_signature("false"); |
88 } | 88 } |
89 | 89 |
90 MessageLoop message_loop_; | 90 base::MessageLoop message_loop_; |
91 content::TestBrowserThread ui_thread_; | 91 content::TestBrowserThread ui_thread_; |
92 | 92 |
93 ScopedTestingLocalState local_state_; | 93 ScopedTestingLocalState local_state_; |
94 ScopedDeviceSettingsTestHelper device_settings_test_helper_; | 94 ScopedDeviceSettingsTestHelper device_settings_test_helper_; |
95 CrosSettings settings_; | 95 CrosSettings settings_; |
96 | 96 |
97 base::WeakPtrFactory<CrosSettingsTest> weak_factory_; | 97 base::WeakPtrFactory<CrosSettingsTest> weak_factory_; |
98 | 98 |
99 std::map<std::string, base::Value*> expected_props_; | 99 std::map<std::string, base::Value*> expected_props_; |
100 }; | 100 }; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 EXPECT_TRUE(cs->FindEmailInList(kAccountsPrefUsers, "WITH.DOTS@gmail.com")); | 244 EXPECT_TRUE(cs->FindEmailInList(kAccountsPrefUsers, "WITH.DOTS@gmail.com")); |
245 EXPECT_TRUE(cs->FindEmailInList(kAccountsPrefUsers, "WITHDOTS")); | 245 EXPECT_TRUE(cs->FindEmailInList(kAccountsPrefUsers, "WITHDOTS")); |
246 | 246 |
247 EXPECT_TRUE(cs->FindEmailInList(kAccountsPrefUsers, "Upper@example.com")); | 247 EXPECT_TRUE(cs->FindEmailInList(kAccountsPrefUsers, "Upper@example.com")); |
248 EXPECT_FALSE(cs->FindEmailInList(kAccountsPrefUsers, "U.pper@example.com")); | 248 EXPECT_FALSE(cs->FindEmailInList(kAccountsPrefUsers, "U.pper@example.com")); |
249 EXPECT_FALSE(cs->FindEmailInList(kAccountsPrefUsers, "Upper")); | 249 EXPECT_FALSE(cs->FindEmailInList(kAccountsPrefUsers, "Upper")); |
250 EXPECT_TRUE(cs->FindEmailInList(kAccountsPrefUsers, "upper@example.com")); | 250 EXPECT_TRUE(cs->FindEmailInList(kAccountsPrefUsers, "upper@example.com")); |
251 } | 251 } |
252 | 252 |
253 } // namespace chromeos | 253 } // namespace chromeos |
OLD | NEW |