Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 s2.type = mime_image; | 325 s2.type = mime_image; |
| 326 ASSERT_EQ(URLPattern::PARSE_SUCCESS, | 326 ASSERT_EQ(URLPattern::PARSE_SUCCESS, |
| 327 s2.url_pattern.Parse(test_url.spec())); | 327 s2.url_pattern.Parse(test_url.spec())); |
| 328 s2.user_date = 1; | 328 s2.user_date = 1; |
| 329 s2.suppression = 4; | 329 s2.suppression = 4; |
| 330 s2.service_url = test_service_url_2.spec(); | 330 s2.service_url = test_service_url_2.spec(); |
| 331 ASSERT_TRUE(IntentsTable()->SetDefaultService(s2)); | 331 ASSERT_TRUE(IntentsTable()->SetDefaultService(s2)); |
| 332 | 332 |
| 333 std::vector<DefaultWebIntentService> defaults; | 333 std::vector<DefaultWebIntentService> defaults; |
| 334 ASSERT_TRUE(IntentsTable()->GetAllDefaultServices(&defaults)); | 334 ASSERT_TRUE(IntentsTable()->GetAllDefaultServices(&defaults)); |
| 335 ASSERT_EQ(3U, defaults.size()); | 335 ASSERT_EQ(2U, defaults.size()); |
| 336 | 336 |
| 337 ASSERT_TRUE(IntentsTable()->RemoveServiceDefaults(test_service_url)); | 337 ASSERT_TRUE(IntentsTable()->RemoveServiceDefaults(test_service_url)); |
| 338 | 338 |
| 339 defaults.clear(); | 339 defaults.clear(); |
| 340 ASSERT_TRUE(IntentsTable()->GetAllDefaultServices(&defaults)); | 340 ASSERT_TRUE(IntentsTable()->GetAllDefaultServices(&defaults)); |
| 341 ASSERT_EQ(1U, defaults.size()); | 341 ASSERT_EQ(1U, defaults.size()); |
| 342 EXPECT_EQ(test_service_url_2.spec(), defaults[0].service_url); | 342 EXPECT_EQ(test_service_url_2.spec(), defaults[0].service_url); |
| 343 } | 343 } |
| 344 | 344 |
| 345 TEST_F(WebIntentsTableTest, OverwriteDefaults) { | |
| 346 DefaultWebIntentService default_service; | |
| 347 default_service.action = test_action; | |
| 348 default_service.type = mime_image; | |
| 349 ASSERT_EQ(URLPattern::PARSE_SUCCESS, | |
|
Steve McKay
2012/09/14 18:57:00
Nuke the assert, it's unrelated to the test. We ca
Greg Billock
2012/09/14 19:12:28
Done.
| |
| 350 default_service.url_pattern.Parse(test_url.spec())); | |
| 351 default_service.user_date = 1; | |
| 352 default_service.suppression = 4; | |
| 353 default_service.service_url = "service_url"; | |
| 354 ASSERT_TRUE(IntentsTable()->SetDefaultService(default_service)); | |
| 355 | |
| 356 default_service.user_date = 2; | |
| 357 default_service.service_url = "service_url2"; | |
| 358 ASSERT_TRUE(IntentsTable()->SetDefaultService(default_service)); | |
| 359 | |
| 360 default_service.user_date = 3; | |
| 361 default_service.service_url = "service_url3"; | |
| 362 ASSERT_TRUE(IntentsTable()->SetDefaultService(default_service)); | |
| 363 | |
| 364 std::vector<DefaultWebIntentService> defaults; | |
| 365 ASSERT_TRUE(IntentsTable()->GetAllDefaultServices(&defaults)); | |
| 366 ASSERT_EQ(1U, defaults.size()); | |
| 367 EXPECT_EQ("service_url3", defaults[0].service_url); | |
| 368 } | |
| 369 | |
| 345 } // namespace | 370 } // namespace |
| OLD | NEW |