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