OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" | 10 #include "chrome/browser/extensions/dev_mode_bubble_controller.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (ExtensionRegistry::Get(profile())->enabled_extensions().GetByID(id)) | 384 if (ExtensionRegistry::Get(profile())->enabled_extensions().GetByID(id)) |
385 return testing::AssertionSuccess(); | 385 return testing::AssertionSuccess(); |
386 return testing::AssertionFailure() << "Could not install extension: " << id; | 386 return testing::AssertionFailure() << "Could not install extension: " << id; |
387 } | 387 } |
388 | 388 |
389 void Init() { | 389 void Init() { |
390 // The two lines of magical incantation required to get the extension | 390 // The two lines of magical incantation required to get the extension |
391 // service to work inside a unit test and access the extension prefs. | 391 // service to work inside a unit test and access the extension prefs. |
392 thread_bundle_.reset(new content::TestBrowserThreadBundle); | 392 thread_bundle_.reset(new content::TestBrowserThreadBundle); |
393 profile_.reset(new TestingProfile); | 393 profile_.reset(new TestingProfile); |
394 static_cast<TestExtensionSystem*>( | 394 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile())) |
395 ExtensionSystem::Get(profile()))->CreateExtensionService( | 395 ->CreateExtensionService(base::CommandLine::ForCurrentProcess(), |
396 CommandLine::ForCurrentProcess(), | 396 base::FilePath(), false); |
397 base::FilePath(), | |
398 false); | |
399 service_ = ExtensionSystem::Get(profile())->extension_service(); | 397 service_ = ExtensionSystem::Get(profile())->extension_service(); |
400 service_->Init(); | 398 service_->Init(); |
401 } | 399 } |
402 | 400 |
403 ~ExtensionMessageBubbleTest() override { | 401 ~ExtensionMessageBubbleTest() override { |
404 // Make sure the profile is destroyed before the thread bundle. | 402 // Make sure the profile is destroyed before the thread bundle. |
405 profile_.reset(NULL); | 403 profile_.reset(NULL); |
406 } | 404 } |
407 | 405 |
408 void SetUp() override { | 406 void SetUp() override { |
409 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); | 407 command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM)); |
410 } | 408 } |
411 | 409 |
412 protected: | 410 protected: |
413 Profile* profile() { return profile_.get(); } | 411 Profile* profile() { return profile_.get(); } |
414 | 412 |
415 scoped_refptr<Extension> CreateExtension( | 413 scoped_refptr<Extension> CreateExtension( |
416 Manifest::Location location, | 414 Manifest::Location location, |
417 const std::string& data, | 415 const std::string& data, |
418 const std::string& id) { | 416 const std::string& id) { |
419 scoped_ptr<base::DictionaryValue> parsed_manifest( | 417 scoped_ptr<base::DictionaryValue> parsed_manifest( |
420 extension_function_test_utils::ParseDictionary(data)); | 418 extension_function_test_utils::ParseDictionary(data)); |
421 return extension_function_test_utils::CreateExtension( | 419 return extension_function_test_utils::CreateExtension( |
422 location, | 420 location, |
423 parsed_manifest.get(), | 421 parsed_manifest.get(), |
424 id); | 422 id); |
425 } | 423 } |
426 | 424 |
427 ExtensionService* service_; | 425 ExtensionService* service_; |
428 | 426 |
429 private: | 427 private: |
430 scoped_ptr<CommandLine> command_line_; | 428 scoped_ptr<base::CommandLine> command_line_; |
431 scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_; | 429 scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_; |
432 scoped_ptr<TestingProfile> profile_; | 430 scoped_ptr<TestingProfile> profile_; |
433 | 431 |
434 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleTest); | 432 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageBubbleTest); |
435 }; | 433 }; |
436 | 434 |
437 // The feature this is meant to test is only implemented on Windows. | 435 // The feature this is meant to test is only implemented on Windows. |
438 #if defined(OS_WIN) | 436 #if defined(OS_WIN) |
439 #define MAYBE_WipeoutControllerTest WipeoutControllerTest | 437 #define MAYBE_WipeoutControllerTest WipeoutControllerTest |
440 #else | 438 #else |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 extensions::UNINSTALL_REASON_FOR_TESTING, | 963 extensions::UNINSTALL_REASON_FOR_TESTING, |
966 base::Bind(&base::DoNothing), | 964 base::Bind(&base::DoNothing), |
967 NULL); | 965 NULL); |
968 service_->UninstallExtension(kId3, | 966 service_->UninstallExtension(kId3, |
969 extensions::UNINSTALL_REASON_FOR_TESTING, | 967 extensions::UNINSTALL_REASON_FOR_TESTING, |
970 base::Bind(&base::DoNothing), | 968 base::Bind(&base::DoNothing), |
971 NULL); | 969 NULL); |
972 } | 970 } |
973 | 971 |
974 } // namespace extensions | 972 } // namespace extensions |
OLD | NEW |