OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "chrome/browser/extensions/api/automation_internal/automation_util.h" | 8 #include "chrome/browser/extensions/api/automation_internal/automation_util.h" |
9 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // are equivalent, and then one or both of the trees are reset to a new version. | 361 // are equivalent, and then one or both of the trees are reset to a new version. |
362 class FakeAutomationInternalEnableTabFunction | 362 class FakeAutomationInternalEnableTabFunction |
363 : public UIThreadExtensionFunction { | 363 : public UIThreadExtensionFunction { |
364 public: | 364 public: |
365 FakeAutomationInternalEnableTabFunction() {} | 365 FakeAutomationInternalEnableTabFunction() {} |
366 | 366 |
367 ExtensionFunction::ResponseAction Run() override { | 367 ExtensionFunction::ResponseAction Run() override { |
368 using api::automation_internal::EnableTab::Params; | 368 using api::automation_internal::EnableTab::Params; |
369 scoped_ptr<Params> params(Params::Create(*args_)); | 369 scoped_ptr<Params> params(Params::Create(*args_)); |
370 EXTENSION_FUNCTION_VALIDATE(params.get()); | 370 EXTENSION_FUNCTION_VALIDATE(params.get()); |
371 if (!params->tab_id.get()) | 371 if (!params->args.tab_id.get()) |
372 return RespondNow(Error("tab_id not specified")); | 372 return RespondNow(Error("tab_id not specified")); |
373 int tab_id = *params->tab_id; | 373 int tab_id = *params->args.tab_id; |
374 if (tab_id == 0) { | 374 if (tab_id == 0) { |
375 // tab 0 <--> tree0 | 375 // tab 0 <--> tree0 |
376 base::MessageLoop::current()->PostTask( | 376 base::MessageLoop::current()->PostTask( |
377 FROM_HERE, | 377 FROM_HERE, |
378 base::Bind(&TreeSerializationState::InitializeTree0, | 378 base::Bind(&TreeSerializationState::InitializeTree0, |
379 base::Unretained(&state), | 379 base::Unretained(&state), |
380 base::Unretained(browser_context()))); | 380 base::Unretained(browser_context()))); |
381 // TODO(aboxhall): Need to rewrite this test in terms of tree ids. | 381 // TODO(aboxhall): Need to rewrite this test in terms of tree ids. |
382 return RespondNow(ArgumentList( | 382 return RespondNow(ArgumentList( |
383 api::automation_internal::EnableTab::Results::Create(0))); | 383 api::automation_internal::EnableTab::Results::Create(0))); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 "automationInternal.enableTab", | 532 "automationInternal.enableTab", |
533 FakeAutomationInternalEnableTabFunctionFactory)); | 533 FakeAutomationInternalEnableTabFunctionFactory)); |
534 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction( | 534 ASSERT_TRUE(extensions::ExtensionFunctionDispatcher::OverrideFunction( |
535 "automationInternal.performAction", | 535 "automationInternal.performAction", |
536 FakeAutomationInternalPerformActionFunctionFactory)); | 536 FakeAutomationInternalPerformActionFunctionFactory)); |
537 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated", | 537 ASSERT_TRUE(RunExtensionSubtest("automation/tests/generated", |
538 "generated_trees.html")) << message_; | 538 "generated_trees.html")) << message_; |
539 } | 539 } |
540 | 540 |
541 } // namespace extensions | 541 } // namespace extensions |
OLD | NEW |