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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_unittest.cc

Issue 2799093006: Remove base::BinaryValue (Closed)
Patch Set: Rebase Created 3 years, 8 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <queue> 10 #include <queue>
11 #include <tuple> 11 #include <tuple>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/json/json_reader.h" 17 #include "base/json/json_reader.h"
18 #include "base/json/json_string_value_serializer.h" 18 #include "base/json/json_string_value_serializer.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/memory/weak_ptr.h" 21 #include "base/memory/weak_ptr.h"
22 #include "base/run_loop.h" 22 #include "base/run_loop.h"
23 #include "base/stl_util.h" 23 #include "base/stl_util.h"
24 #include "base/strings/string_piece.h" 24 #include "base/strings/string_piece.h"
25 #include "base/strings/string_split.h" 25 #include "base/strings/string_split.h"
26 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
27 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
28 #include "base/threading/thread_task_runner_handle.h" 28 #include "base/threading/thread_task_runner_handle.h"
29 #include "base/time/time.h" 29 #include "base/time/time.h"
30 #include "base/values.h"
30 #include "chrome/browser/content_settings/cookie_settings_factory.h" 31 #include "chrome/browser/content_settings/cookie_settings_factory.h"
31 #include "chrome/browser/extensions/event_router_forwarder.h" 32 #include "chrome/browser/extensions/event_router_forwarder.h"
32 #include "chrome/browser/net/chrome_extensions_network_delegate.h" 33 #include "chrome/browser/net/chrome_extensions_network_delegate.h"
33 #include "chrome/browser/net/chrome_network_delegate.h" 34 #include "chrome/browser/net/chrome_network_delegate.h"
34 #include "chrome/test/base/testing_browser_process.h" 35 #include "chrome/test/base/testing_browser_process.h"
35 #include "chrome/test/base/testing_profile.h" 36 #include "chrome/test/base/testing_profile.h"
36 #include "chrome/test/base/testing_profile_manager.h" 37 #include "chrome/test/base/testing_profile_manager.h"
37 #include "components/about_handler/about_protocol_handler.h" 38 #include "components/about_handler/about_protocol_handler.h"
38 #include "components/content_settings/core/browser/cookie_settings.h" 39 #include "components/content_settings/core/browser/cookie_settings.h"
39 #include "components/prefs/pref_member.h" 40 #include "components/prefs/pref_member.h"
(...skipping 19 matching lines...) Expand all
59 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" 60 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
60 #include "net/url_request/url_request_job_factory_impl.h" 61 #include "net/url_request/url_request_job_factory_impl.h"
61 #include "net/url_request/url_request_test_util.h" 62 #include "net/url_request/url_request_test_util.h"
62 #include "testing/gtest/include/gtest/gtest-message.h" 63 #include "testing/gtest/include/gtest/gtest-message.h"
63 #include "testing/gtest/include/gtest/gtest.h" 64 #include "testing/gtest/include/gtest/gtest.h"
64 65
65 namespace helpers = extension_web_request_api_helpers; 66 namespace helpers = extension_web_request_api_helpers;
66 namespace keys = extension_web_request_api_constants; 67 namespace keys = extension_web_request_api_constants;
67 namespace web_request = extensions::api::web_request; 68 namespace web_request = extensions::api::web_request;
68 69
69 using base::BinaryValue;
70 using base::DictionaryValue; 70 using base::DictionaryValue;
71 using base::ListValue; 71 using base::ListValue;
72 using base::Time; 72 using base::Time;
73 using base::TimeDelta; 73 using base::TimeDelta;
74 using base::Value; 74 using base::Value;
75 using helpers::CalculateOnAuthRequiredDelta; 75 using helpers::CalculateOnAuthRequiredDelta;
76 using helpers::CalculateOnBeforeRequestDelta; 76 using helpers::CalculateOnBeforeRequestDelta;
77 using helpers::CalculateOnBeforeSendHeadersDelta; 77 using helpers::CalculateOnBeforeSendHeadersDelta;
78 using helpers::CalculateOnHeadersReceivedDelta; 78 using helpers::CalculateOnHeadersReceivedDelta;
79 using helpers::CharListToString; 79 using helpers::CharListToString;
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 const char kFormData[] = 603 const char kFormData[] =
604 "{\"A\":[\"test text\"],\"B\":[\"\"],\"C\":[\"test password\"]}"; 604 "{\"A\":[\"test text\"],\"B\":[\"\"],\"C\":[\"test password\"]}";
605 std::unique_ptr<const base::Value> form_data = 605 std::unique_ptr<const base::Value> form_data =
606 base::JSONReader::Read(kFormData); 606 base::JSONReader::Read(kFormData);
607 ASSERT_TRUE(form_data.get() != NULL); 607 ASSERT_TRUE(form_data.get() != NULL);
608 ASSERT_TRUE(form_data->GetType() == base::Value::Type::DICTIONARY); 608 ASSERT_TRUE(form_data->GetType() == base::Value::Type::DICTIONARY);
609 // Contents of raw. 609 // Contents of raw.
610 base::ListValue raw; 610 base::ListValue raw;
611 extensions::subtle::AppendKeyValuePair( 611 extensions::subtle::AppendKeyValuePair(
612 keys::kRequestBodyRawBytesKey, 612 keys::kRequestBodyRawBytesKey,
613 BinaryValue::CreateWithCopiedBuffer(kPlainBlock1, kPlainBlock1Length), 613 Value::CreateWithCopiedBuffer(kPlainBlock1, kPlainBlock1Length), &raw);
614 &raw);
615 extensions::subtle::AppendKeyValuePair( 614 extensions::subtle::AppendKeyValuePair(
616 keys::kRequestBodyRawFileKey, 615 keys::kRequestBodyRawFileKey,
617 base::MakeUnique<base::Value>(std::string()), &raw); 616 base::MakeUnique<base::Value>(std::string()), &raw);
618 extensions::subtle::AppendKeyValuePair( 617 extensions::subtle::AppendKeyValuePair(
619 keys::kRequestBodyRawBytesKey, 618 keys::kRequestBodyRawBytesKey,
620 BinaryValue::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length), 619 Value::CreateWithCopiedBuffer(kPlainBlock2, kPlainBlock2Length), &raw);
621 &raw);
622 // Summary. 620 // Summary.
623 const base::Value* const kExpected[] = { 621 const base::Value* const kExpected[] = {
624 form_data.get(), 622 form_data.get(),
625 NULL, 623 NULL,
626 &raw, 624 &raw,
627 &raw, 625 &raw,
628 }; 626 };
629 static_assert(arraysize(kPath) == arraysize(kExpected), 627 static_assert(arraysize(kPath) == arraysize(kExpected),
630 "kPath and kExpected arrays should have the same number " 628 "kPath and kExpected arrays should have the same number "
631 "of elements"); 629 "of elements");
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 EXPECT_TRUE(credentials_set); 2481 EXPECT_TRUE(credentials_set);
2484 EXPECT_FALSE(auth3.Empty()); 2482 EXPECT_FALSE(auth3.Empty());
2485 EXPECT_EQ(username, auth1.username()); 2483 EXPECT_EQ(username, auth1.username());
2486 EXPECT_EQ(password, auth1.password()); 2484 EXPECT_EQ(password, auth1.password());
2487 EXPECT_EQ(1u, warning_set.size()); 2485 EXPECT_EQ(1u, warning_set.size());
2488 EXPECT_TRUE(HasWarning(warning_set, "extid2")); 2486 EXPECT_TRUE(HasWarning(warning_set, "extid2"));
2489 EXPECT_EQ(3u, capturing_net_log.GetSize()); 2487 EXPECT_EQ(3u, capturing_net_log.GetSize());
2490 } 2488 }
2491 2489
2492 } // namespace extensions 2490 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/platform_keys/platform_keys_api.cc ('k') | chrome/browser/extensions/extension_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698