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

Side by Side Diff: net/sdch/sdch_owner_unittest.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « net/sdch/sdch_owner.cc ('k') | net/server/http_connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "net/sdch/sdch_owner.h"
6
7 #include <utility>
8
5 #include "base/location.h" 9 #include "base/location.h"
6 #include "base/macros.h" 10 #include "base/macros.h"
7 #include "base/memory/memory_pressure_listener.h" 11 #include "base/memory/memory_pressure_listener.h"
8 #include "base/prefs/testing_pref_store.h" 12 #include "base/prefs/testing_pref_store.h"
9 #include "base/run_loop.h" 13 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
11 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
12 #include "base/test/histogram_tester.h" 16 #include "base/test/histogram_tester.h"
13 #include "base/test/simple_test_clock.h" 17 #include "base/test/simple_test_clock.h"
14 #include "base/thread_task_runner_handle.h" 18 #include "base/thread_task_runner_handle.h"
15 #include "base/values.h" 19 #include "base/values.h"
16 #include "net/base/sdch_manager.h" 20 #include "net/base/sdch_manager.h"
17 #include "net/log/net_log.h" 21 #include "net/log/net_log.h"
18 #include "net/sdch/sdch_owner.h"
19 #include "net/url_request/url_request.h" 22 #include "net/url_request/url_request.h"
20 #include "net/url_request/url_request_context.h" 23 #include "net/url_request/url_request_context.h"
21 #include "net/url_request/url_request_error_job.h" 24 #include "net/url_request/url_request_error_job.h"
22 #include "net/url_request/url_request_job.h" 25 #include "net/url_request/url_request_job.h"
23 #include "net/url_request/url_request_job_factory.h" 26 #include "net/url_request/url_request_job_factory.h"
24 #include "net/url_request/url_request_test_util.h" 27 #include "net/url_request/url_request_test_util.h"
25 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
26 29
27 namespace { 30 namespace {
28 31
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 pref_store_->SetValue("SDCH", make_scoped_ptr(new base::DictionaryValue()), 784 pref_store_->SetValue("SDCH", make_scoped_ptr(new base::DictionaryValue()),
782 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 785 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
783 ResetOwner(false); 786 ResetOwner(false);
784 EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); 787 EXPECT_EQ(0, owner_->GetDictionaryCountForTesting());
785 } 788 }
786 789
787 // Test a persistence store with a bad version number. 790 // Test a persistence store with a bad version number.
788 TEST_F(SdchOwnerPersistenceTest, Persistent_BadVersion) { 791 TEST_F(SdchOwnerPersistenceTest, Persistent_BadVersion) {
789 scoped_ptr<base::DictionaryValue> sdch_dict(new base::DictionaryValue()); 792 scoped_ptr<base::DictionaryValue> sdch_dict(new base::DictionaryValue());
790 sdch_dict->SetInteger("version", 2); 793 sdch_dict->SetInteger("version", 2);
791 pref_store_->SetValue("SDCH", sdch_dict.Pass(), 794 pref_store_->SetValue("SDCH", std::move(sdch_dict),
792 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 795 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
793 796
794 ResetOwner(false); 797 ResetOwner(false);
795 EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); 798 EXPECT_EQ(0, owner_->GetDictionaryCountForTesting());
796 } 799 }
797 800
798 // Test a persistence store with an empty dictionaries map. 801 // Test a persistence store with an empty dictionaries map.
799 TEST_F(SdchOwnerPersistenceTest, Persistent_EmptyDictList) { 802 TEST_F(SdchOwnerPersistenceTest, Persistent_EmptyDictList) {
800 scoped_ptr<base::DictionaryValue> sdch_dict(new base::DictionaryValue()); 803 scoped_ptr<base::DictionaryValue> sdch_dict(new base::DictionaryValue());
801 scoped_ptr<base::DictionaryValue> dicts(new base::DictionaryValue()); 804 scoped_ptr<base::DictionaryValue> dicts(new base::DictionaryValue());
802 sdch_dict->SetInteger("version", 1); 805 sdch_dict->SetInteger("version", 1);
803 sdch_dict->Set("dictionaries", dicts.Pass()); 806 sdch_dict->Set("dictionaries", std::move(dicts));
804 pref_store_->SetValue("SDCH", sdch_dict.Pass(), 807 pref_store_->SetValue("SDCH", std::move(sdch_dict),
805 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); 808 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
806 809
807 ResetOwner(false); 810 ResetOwner(false);
808 EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); 811 EXPECT_EQ(0, owner_->GetDictionaryCountForTesting());
809 } 812 }
810 813
811 TEST_F(SdchOwnerPersistenceTest, OneDict) { 814 TEST_F(SdchOwnerPersistenceTest, OneDict) {
812 const GURL url("http://www.example.com/dict"); 815 const GURL url("http://www.example.com/dict");
813 ResetOwner(false); 816 ResetOwner(false);
814 EXPECT_EQ(0, owner_->GetDictionaryCountForTesting()); 817 EXPECT_EQ(0, owner_->GetDictionaryCountForTesting());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 920
918 EXPECT_TRUE(CompleteLoadFromURL(url0, "0", true)); 921 EXPECT_TRUE(CompleteLoadFromURL(url0, "0", true));
919 EXPECT_TRUE(CompleteLoadFromURL(url1, "1", false)); 922 EXPECT_TRUE(CompleteLoadFromURL(url1, "1", false));
920 923
921 tester.ExpectTotalCount("Sdch3.NetworkBytesSpent", 1); 924 tester.ExpectTotalCount("Sdch3.NetworkBytesSpent", 1);
922 tester.ExpectUniqueSample("Sdch3.NetworkBytesSpent", 925 tester.ExpectUniqueSample("Sdch3.NetworkBytesSpent",
923 CreateDictionary(url1, "1").size(), 1); 926 CreateDictionary(url1, "1").size(), 1);
924 } 927 }
925 928
926 } // namespace net 929 } // namespace net
OLDNEW
« no previous file with comments | « net/sdch/sdch_owner.cc ('k') | net/server/http_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698