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

Side by Side Diff: chrome/browser/net/transport_security_persister_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 (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 "chrome/browser/net/transport_security_persister.h" 5 #include "chrome/browser/net/transport_security_persister.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/files/scoped_temp_dir.h"
13 #include "base/message_loop.h" 14 #include "base/message_loop.h"
14 #include "base/scoped_temp_dir.h"
15 #include "content/public/test/test_browser_thread.h" 15 #include "content/public/test/test_browser_thread.h"
16 #include "net/base/transport_security_state.h" 16 #include "net/base/transport_security_state.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using net::TransportSecurityState; 19 using net::TransportSecurityState;
20 20
21 class TransportSecurityPersisterTest : public testing::Test { 21 class TransportSecurityPersisterTest : public testing::Test {
22 public: 22 public:
23 TransportSecurityPersisterTest() 23 TransportSecurityPersisterTest()
24 : message_loop_(MessageLoop::TYPE_IO), 24 : message_loop_(MessageLoop::TYPE_IO),
(...skipping 15 matching lines...) Expand all
40 // Ordering is important here. If member variables are not destroyed in the 40 // Ordering is important here. If member variables are not destroyed in the
41 // right order, then DCHECKs will fail all over the place. 41 // right order, then DCHECKs will fail all over the place.
42 MessageLoop message_loop_; 42 MessageLoop message_loop_;
43 43
44 // Needed for ImportantFileWriter, which TransportSecurityPersister uses. 44 // Needed for ImportantFileWriter, which TransportSecurityPersister uses.
45 content::TestBrowserThread test_file_thread_; 45 content::TestBrowserThread test_file_thread_;
46 46
47 // TransportSecurityPersister runs on the IO thread. 47 // TransportSecurityPersister runs on the IO thread.
48 content::TestBrowserThread test_io_thread_; 48 content::TestBrowserThread test_io_thread_;
49 49
50 ScopedTempDir temp_dir_; 50 base::ScopedTempDir temp_dir_;
51 TransportSecurityState state_; 51 TransportSecurityState state_;
52 scoped_ptr<TransportSecurityPersister> persister_; 52 scoped_ptr<TransportSecurityPersister> persister_;
53 }; 53 };
54 54
55 TEST_F(TransportSecurityPersisterTest, SerializeData1) { 55 TEST_F(TransportSecurityPersisterTest, SerializeData1) {
56 std::string output; 56 std::string output;
57 bool dirty; 57 bool dirty;
58 58
59 EXPECT_TRUE(persister_->SerializeData(&output)); 59 EXPECT_TRUE(persister_->SerializeData(&output));
60 EXPECT_TRUE(persister_->LoadEntries(output, &dirty)); 60 EXPECT_TRUE(persister_->LoadEntries(output, &dirty));
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 "\"mode\": \"pinning-only\"" 226 "\"mode\": \"pinning-only\""
227 "}}"); 227 "}}");
228 228
229 EXPECT_TRUE(persister_->DeserializeFromCommandLine(preload)); 229 EXPECT_TRUE(persister_->DeserializeFromCommandLine(preload));
230 230
231 TransportSecurityState::DomainState domain_state; 231 TransportSecurityState::DomainState domain_state;
232 EXPECT_TRUE(state_.GetDomainState("docs.google.com", true, &domain_state)); 232 EXPECT_TRUE(state_.GetDomainState("docs.google.com", true, &domain_state));
233 EXPECT_FALSE(domain_state.HasPins()); 233 EXPECT_FALSE(domain_state.HasPins());
234 EXPECT_FALSE(domain_state.ShouldRedirectHTTPToHTTPS()); 234 EXPECT_FALSE(domain_state.ShouldRedirectHTTPToHTTPS());
235 } 235 }
OLDNEW
« no previous file with comments | « chrome/browser/net/sqlite_server_bound_cert_store_unittest.cc ('k') | chrome/browser/page_cycler/page_cycler_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698