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

Side by Side Diff: chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc

Issue 1739183003: Make extensions::DictionaryBuilder and extensions::ListValue unmovable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/activity_log/fullstream_ui_policy.h" 5 #include "chrome/browser/extensions/activity_log/fullstream_ui_policy.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 chromeos::ScopedTestCrosSettings test_cros_settings_; 450 chromeos::ScopedTestCrosSettings test_cros_settings_;
451 scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_; 451 scoped_ptr<chromeos::ScopedTestUserManager> test_user_manager_;
452 #endif 452 #endif
453 }; 453 };
454 454
455 TEST_F(FullStreamUIPolicyTest, Construct) { 455 TEST_F(FullStreamUIPolicyTest, Construct) {
456 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get()); 456 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get());
457 policy->Init(); 457 policy->Init();
458 scoped_refptr<const Extension> extension = 458 scoped_refptr<const Extension> extension =
459 ExtensionBuilder() 459 ExtensionBuilder()
460 .SetManifest(std::move(DictionaryBuilder() 460 .SetManifest(DictionaryBuilder()
461 .Set("name", "Test extension") 461 .Set("name", "Test extension")
462 .Set("version", "1.0.0") 462 .Set("version", "1.0.0")
463 .Set("manifest_version", 2))) 463 .Set("manifest_version", 2)
464 .Build())
464 .Build(); 465 .Build();
465 extension_service_->AddExtension(extension.get()); 466 extension_service_->AddExtension(extension.get());
466 scoped_ptr<base::ListValue> args(new base::ListValue()); 467 scoped_ptr<base::ListValue> args(new base::ListValue());
467 scoped_refptr<Action> action = new Action(extension->id(), 468 scoped_refptr<Action> action = new Action(extension->id(),
468 base::Time::Now(), 469 base::Time::Now(),
469 Action::ACTION_API_CALL, 470 Action::ACTION_API_CALL,
470 "tabs.testMethod"); 471 "tabs.testMethod");
471 action->set_args(std::move(args)); 472 action->set_args(std::move(args));
472 policy->ProcessAction(action); 473 policy->ProcessAction(action);
473 policy->Close(); 474 policy->Close();
474 } 475 }
475 476
476 TEST_F(FullStreamUIPolicyTest, LogAndFetchActions) { 477 TEST_F(FullStreamUIPolicyTest, LogAndFetchActions) {
477 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get()); 478 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get());
478 policy->Init(); 479 policy->Init();
479 scoped_refptr<const Extension> extension = 480 scoped_refptr<const Extension> extension =
480 ExtensionBuilder() 481 ExtensionBuilder()
481 .SetManifest(std::move(DictionaryBuilder() 482 .SetManifest(DictionaryBuilder()
482 .Set("name", "Test extension") 483 .Set("name", "Test extension")
483 .Set("version", "1.0.0") 484 .Set("version", "1.0.0")
484 .Set("manifest_version", 2))) 485 .Set("manifest_version", 2)
486 .Build())
485 .Build(); 487 .Build();
486 extension_service_->AddExtension(extension.get()); 488 extension_service_->AddExtension(extension.get());
487 GURL gurl("http://www.google.com"); 489 GURL gurl("http://www.google.com");
488 490
489 // Write some API calls 491 // Write some API calls
490 scoped_refptr<Action> action_api = new Action(extension->id(), 492 scoped_refptr<Action> action_api = new Action(extension->id(),
491 base::Time::Now(), 493 base::Time::Now(),
492 Action::ACTION_API_CALL, 494 Action::ACTION_API_CALL,
493 "tabs.testMethod"); 495 "tabs.testMethod");
494 action_api->set_args(make_scoped_ptr(new base::ListValue())); 496 action_api->set_args(make_scoped_ptr(new base::ListValue()));
(...skipping 14 matching lines...) Expand all
509 base::Bind(&FullStreamUIPolicyTest::RetrieveActions_LogAndFetchActions)); 511 base::Bind(&FullStreamUIPolicyTest::RetrieveActions_LogAndFetchActions));
510 512
511 policy->Close(); 513 policy->Close();
512 } 514 }
513 515
514 TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) { 516 TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) {
515 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get()); 517 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get());
516 policy->Init(); 518 policy->Init();
517 scoped_refptr<const Extension> extension = 519 scoped_refptr<const Extension> extension =
518 ExtensionBuilder() 520 ExtensionBuilder()
519 .SetManifest(std::move(DictionaryBuilder() 521 .SetManifest(DictionaryBuilder()
520 .Set("name", "Test extension") 522 .Set("name", "Test extension")
521 .Set("version", "1.0.0") 523 .Set("version", "1.0.0")
522 .Set("manifest_version", 2))) 524 .Set("manifest_version", 2)
525 .Build())
523 .Build(); 526 .Build();
524 extension_service_->AddExtension(extension.get()); 527 extension_service_->AddExtension(extension.get());
525 GURL gurl("http://www.google.com"); 528 GURL gurl("http://www.google.com");
526 529
527 // Write some API calls 530 // Write some API calls
528 scoped_refptr<Action> action_api = new Action(extension->id(), 531 scoped_refptr<Action> action_api = new Action(extension->id(),
529 base::Time::Now(), 532 base::Time::Now(),
530 Action::ACTION_API_CALL, 533 Action::ACTION_API_CALL,
531 "tabs.testMethod"); 534 "tabs.testMethod");
532 action_api->set_args(make_scoped_ptr(new base::ListValue())); 535 action_api->set_args(make_scoped_ptr(new base::ListValue()));
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 &FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions2)); 610 &FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions2));
608 611
609 policy->Close(); 612 policy->Close();
610 } 613 }
611 614
612 TEST_F(FullStreamUIPolicyTest, LogWithArguments) { 615 TEST_F(FullStreamUIPolicyTest, LogWithArguments) {
613 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get()); 616 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get());
614 policy->Init(); 617 policy->Init();
615 scoped_refptr<const Extension> extension = 618 scoped_refptr<const Extension> extension =
616 ExtensionBuilder() 619 ExtensionBuilder()
617 .SetManifest(std::move(DictionaryBuilder() 620 .SetManifest(DictionaryBuilder()
618 .Set("name", "Test extension") 621 .Set("name", "Test extension")
619 .Set("version", "1.0.0") 622 .Set("version", "1.0.0")
620 .Set("manifest_version", 2))) 623 .Set("manifest_version", 2)
624 .Build())
621 .Build(); 625 .Build();
622 extension_service_->AddExtension(extension.get()); 626 extension_service_->AddExtension(extension.get());
623 627
624 scoped_ptr<base::ListValue> args(new base::ListValue()); 628 scoped_ptr<base::ListValue> args(new base::ListValue());
625 args->Set(0, new base::StringValue("hello")); 629 args->Set(0, new base::StringValue("hello"));
626 args->Set(1, new base::StringValue("world")); 630 args->Set(1, new base::StringValue("world"));
627 scoped_refptr<Action> action = new Action(extension->id(), 631 scoped_refptr<Action> action = new Action(extension->id(),
628 base::Time::Now(), 632 base::Time::Now(),
629 Action::ACTION_API_CALL, 633 Action::ACTION_API_CALL,
630 "extension.connect"); 634 "extension.connect");
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 base::Bind( 952 base::Bind(
949 &FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions300)); 953 &FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions300));
950 policy->Close(); 954 policy->Close();
951 } 955 }
952 956
953 TEST_F(FullStreamUIPolicyTest, DeleteDatabase) { 957 TEST_F(FullStreamUIPolicyTest, DeleteDatabase) {
954 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get()); 958 ActivityLogDatabasePolicy* policy = new FullStreamUIPolicy(profile_.get());
955 policy->Init(); 959 policy->Init();
956 scoped_refptr<const Extension> extension = 960 scoped_refptr<const Extension> extension =
957 ExtensionBuilder() 961 ExtensionBuilder()
958 .SetManifest(std::move(DictionaryBuilder() 962 .SetManifest(DictionaryBuilder()
959 .Set("name", "Test extension") 963 .Set("name", "Test extension")
960 .Set("version", "1.0.0") 964 .Set("version", "1.0.0")
961 .Set("manifest_version", 2))) 965 .Set("manifest_version", 2)
966 .Build())
962 .Build(); 967 .Build();
963 extension_service_->AddExtension(extension.get()); 968 extension_service_->AddExtension(extension.get());
964 GURL gurl("http://www.google.com"); 969 GURL gurl("http://www.google.com");
965 970
966 // Write some API calls. 971 // Write some API calls.
967 scoped_refptr<Action> action_api = new Action(extension->id(), 972 scoped_refptr<Action> action_api = new Action(extension->id(),
968 base::Time::Now(), 973 base::Time::Now(),
969 Action::ACTION_API_CALL, 974 Action::ACTION_API_CALL,
970 "tabs.testMethod"); 975 "tabs.testMethod");
971 action_api->set_args(make_scoped_ptr(new base::ListValue())); 976 action_api->set_args(make_scoped_ptr(new base::ListValue()));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 action_ids.push_back(3); 1055 action_ids.push_back(3);
1051 action_ids.push_back(4); 1056 action_ids.push_back(4);
1052 CheckRemoveActions( 1057 CheckRemoveActions(
1053 policy, action_ids, base::Bind(&FullStreamUIPolicyTest::Action2Deleted)); 1058 policy, action_ids, base::Bind(&FullStreamUIPolicyTest::Action2Deleted));
1054 action_ids.clear(); 1059 action_ids.clear();
1055 1060
1056 policy->Close(); 1061 policy->Close();
1057 } 1062 }
1058 1063
1059 } // namespace extensions 1064 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698