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

Side by Side Diff: chrome/browser/webdata/token_service_table_unittest.cc

Issue 13749010: Disable ProfileSyncServicePasswordTest and TokenServiceTableTest on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/profile_sync_service_password_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/files/scoped_temp_dir.h" 6 #include "base/files/scoped_temp_dir.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/browser/webdata/token_service_table.h" 10 #include "chrome/browser/webdata/token_service_table.h"
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 31
32 base::FilePath file_; 32 base::FilePath file_;
33 base::ScopedTempDir temp_dir_; 33 base::ScopedTempDir temp_dir_;
34 scoped_ptr<TokenServiceTable> table_; 34 scoped_ptr<TokenServiceTable> table_;
35 scoped_ptr<WebDatabase> db_; 35 scoped_ptr<WebDatabase> db_;
36 private: 36 private:
37 DISALLOW_COPY_AND_ASSIGN(TokenServiceTableTest); 37 DISALLOW_COPY_AND_ASSIGN(TokenServiceTableTest);
38 }; 38 };
39 39
40 TEST_F(TokenServiceTableTest, TokenServiceGetAllRemoveAll) { 40 // Flaky on mac_rel. See http://crbug.com/228943
41 #if defined(OS_MACOSX)
42 #define MAYBE_TokenServiceGetAllRemoveAll DISABLED_TokenServiceGetAllRemoveAll
43 #define MAYBE_TokenServiceGetSet DISABLED_TokenServiceGetSet
44 #else
45 #define MAYBE_TokenServiceGetAllRemoveAll TokenServiceGetAllRemoveAll
46 #define MAYBE_TokenServiceGetSet TokenServiceGetSet
47 #endif
48
49 TEST_F(TokenServiceTableTest, MAYBE_TokenServiceGetAllRemoveAll) {
41 std::map<std::string, std::string> out_map; 50 std::map<std::string, std::string> out_map;
42 std::string service; 51 std::string service;
43 std::string service2; 52 std::string service2;
44 service = "testservice"; 53 service = "testservice";
45 service2 = "othertestservice"; 54 service2 = "othertestservice";
46 55
47 EXPECT_TRUE(table_->GetAllTokens(&out_map)); 56 EXPECT_TRUE(table_->GetAllTokens(&out_map));
48 EXPECT_TRUE(out_map.empty()); 57 EXPECT_TRUE(out_map.empty());
49 58
50 // Check that get all tokens works 59 // Check that get all tokens works
51 EXPECT_TRUE(table_->SetTokenForService(service, "pepperoni")); 60 EXPECT_TRUE(table_->SetTokenForService(service, "pepperoni"));
52 EXPECT_TRUE(table_->SetTokenForService(service2, "steak")); 61 EXPECT_TRUE(table_->SetTokenForService(service2, "steak"));
53 EXPECT_TRUE(table_->GetAllTokens(&out_map)); 62 EXPECT_TRUE(table_->GetAllTokens(&out_map));
54 EXPECT_EQ(out_map.find(service)->second, "pepperoni"); 63 EXPECT_EQ(out_map.find(service)->second, "pepperoni");
55 EXPECT_EQ(out_map.find(service2)->second, "steak"); 64 EXPECT_EQ(out_map.find(service2)->second, "steak");
56 out_map.clear(); 65 out_map.clear();
57 66
58 // Purge 67 // Purge
59 EXPECT_TRUE(table_->RemoveAllTokens()); 68 EXPECT_TRUE(table_->RemoveAllTokens());
60 EXPECT_TRUE(table_->GetAllTokens(&out_map)); 69 EXPECT_TRUE(table_->GetAllTokens(&out_map));
61 EXPECT_TRUE(out_map.empty()); 70 EXPECT_TRUE(out_map.empty());
62 71
63 // Check that you can still add it back in 72 // Check that you can still add it back in
64 EXPECT_TRUE(table_->SetTokenForService(service, "cheese")); 73 EXPECT_TRUE(table_->SetTokenForService(service, "cheese"));
65 EXPECT_TRUE(table_->GetAllTokens(&out_map)); 74 EXPECT_TRUE(table_->GetAllTokens(&out_map));
66 EXPECT_EQ(out_map.find(service)->second, "cheese"); 75 EXPECT_EQ(out_map.find(service)->second, "cheese");
67 } 76 }
68 77
69 TEST_F(TokenServiceTableTest, TokenServiceGetSet) { 78 TEST_F(TokenServiceTableTest, MAYBE_TokenServiceGetSet) {
70 std::map<std::string, std::string> out_map; 79 std::map<std::string, std::string> out_map;
71 std::string service; 80 std::string service;
72 service = "testservice"; 81 service = "testservice";
73 82
74 EXPECT_TRUE(table_->GetAllTokens(&out_map)); 83 EXPECT_TRUE(table_->GetAllTokens(&out_map));
75 EXPECT_TRUE(out_map.empty()); 84 EXPECT_TRUE(out_map.empty());
76 85
77 EXPECT_TRUE(table_->SetTokenForService(service, "pepperoni")); 86 EXPECT_TRUE(table_->SetTokenForService(service, "pepperoni"));
78 EXPECT_TRUE(table_->GetAllTokens(&out_map)); 87 EXPECT_TRUE(table_->GetAllTokens(&out_map));
79 EXPECT_EQ(out_map.find(service)->second, "pepperoni"); 88 EXPECT_EQ(out_map.find(service)->second, "pepperoni");
80 out_map.clear(); 89 out_map.clear();
81 90
82 // try blanking it - won't remove it from the db though! 91 // try blanking it - won't remove it from the db though!
83 EXPECT_TRUE(table_->SetTokenForService(service, "")); 92 EXPECT_TRUE(table_->SetTokenForService(service, ""));
84 EXPECT_TRUE(table_->GetAllTokens(&out_map)); 93 EXPECT_TRUE(table_->GetAllTokens(&out_map));
85 EXPECT_EQ(out_map.find(service)->second, ""); 94 EXPECT_EQ(out_map.find(service)->second, "");
86 out_map.clear(); 95 out_map.clear();
87 96
88 // try mutating it 97 // try mutating it
89 EXPECT_TRUE(table_->SetTokenForService(service, "ham")); 98 EXPECT_TRUE(table_->SetTokenForService(service, "ham"));
90 EXPECT_TRUE(table_->GetAllTokens(&out_map)); 99 EXPECT_TRUE(table_->GetAllTokens(&out_map));
91 EXPECT_EQ(out_map.find(service)->second, "ham"); 100 EXPECT_EQ(out_map.find(service)->second, "ham");
92 } 101 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_password_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698