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

Side by Side Diff: components/policy/core/common/cloud/policy_header_service_unittest.cc

Issue 108603005: Update uses of Value in chromeos/, cloud_print/, components/, content/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
OLDNEW
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 "base/base64.h" 5 #include "base/base64.h"
6 #include "base/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" 9 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h"
10 #include "components/policy/core/common/cloud/policy_header_io_helper.h" 10 #include "components/policy/core/common/cloud/policy_header_io_helper.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (expected_dmtoken.empty()) { 54 if (expected_dmtoken.empty()) {
55 EXPECT_TRUE(headers.IsEmpty()); 55 EXPECT_TRUE(headers.IsEmpty());
56 } else { 56 } else {
57 // Read header. 57 // Read header.
58 std::string header; 58 std::string header;
59 EXPECT_TRUE(headers.GetHeader(kPolicyHeaderName, &header)); 59 EXPECT_TRUE(headers.GetHeader(kPolicyHeaderName, &header));
60 // Decode the base64 value into JSON. 60 // Decode the base64 value into JSON.
61 std::string decoded; 61 std::string decoded;
62 base::Base64Decode(header, &decoded); 62 base::Base64Decode(header, &decoded);
63 // Parse the JSON. 63 // Parse the JSON.
64 scoped_ptr<Value> value(base::JSONReader::Read(decoded)); 64 scoped_ptr<base::Value> value(base::JSONReader::Read(decoded));
65 ASSERT_TRUE(value); 65 ASSERT_TRUE(value);
66 DictionaryValue* dict; 66 base::DictionaryValue* dict;
67 EXPECT_TRUE(value->GetAsDictionary(&dict)); 67 EXPECT_TRUE(value->GetAsDictionary(&dict));
68 // Read the values and verify them vs the expected values. 68 // Read the values and verify them vs the expected values.
69 std::string dm_token; 69 std::string dm_token;
70 dict->GetString("user_dmtoken", &dm_token); 70 dict->GetString("user_dmtoken", &dm_token);
71 EXPECT_EQ(dm_token, expected_dmtoken); 71 EXPECT_EQ(dm_token, expected_dmtoken);
72 } 72 }
73 } 73 }
74 74
75 base::MessageLoop loop_; 75 base::MessageLoop loop_;
76 scoped_ptr<PolicyHeaderService> service_; 76 scoped_ptr<PolicyHeaderService> service_;
(...skipping 29 matching lines...) Expand all
106 user_store_.SetPolicy(scoped_ptr<PolicyData>()); 106 user_store_.SetPolicy(scoped_ptr<PolicyData>());
107 task_runner_->RunUntilIdle(); 107 task_runner_->RunUntilIdle();
108 108
109 net::TestURLRequest request2( 109 net::TestURLRequest request2(
110 GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL, &context); 110 GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL, &context);
111 helper_->AddPolicyHeaders(&request2); 111 helper_->AddPolicyHeaders(&request2);
112 ValidateHeader(request2.extra_request_headers(), ""); 112 ValidateHeader(request2.extra_request_headers(), "");
113 } 113 }
114 114
115 } // namespace policy 115 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698