| Index: chrome/browser/extensions/api/tabs/tabs_test.cc
|
| ===================================================================
|
| --- chrome/browser/extensions/api/tabs/tabs_test.cc (revision 142698)
|
| +++ chrome/browser/extensions/api/tabs/tabs_test.cc (working copy)
|
| @@ -547,3 +547,42 @@
|
| browser()),
|
| keys::kInvalidWindowStateError));
|
| }
|
| +
|
| +IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, DuplicateTabNoPermission) {
|
| + scoped_refptr<CreateTabFunction> create_tab_function(new CreateTabFunction());
|
| + // Without a callback the function will not generate a result.
|
| + create_tab_function->set_has_callback(true);
|
| +
|
| + static const char kNewBlankTabArgs[] =
|
| + "[{\"url\": \"about:blank\"}]";
|
| +
|
| + scoped_ptr<base::DictionaryValue> result(utils::ToDictionary(
|
| + utils::RunFunctionAndReturnResult(
|
| + create_tab_function.get(),
|
| + kNewBlankTabArgs,
|
| + browser())));
|
| +
|
| + int tab_id = utils::GetInteger(result.get(), "id");
|
| +
|
| + scoped_refptr<DuplicateTabFunction> duplicate_tab_function(
|
| + new DuplicateTabFunction());
|
| + scoped_refptr<extensions::Extension> empty_extension(
|
| + utils::CreateEmptyExtension());
|
| + duplicate_tab_function->set_extension(empty_extension.get());
|
| + // Without a callback the function will not generate a result.
|
| + duplicate_tab_function->set_has_callback(true);
|
| +
|
| + scoped_ptr<base::Value> duplicate_result(
|
| + utils::RunFunctionAndReturnResult(
|
| + duplicate_tab_function.get(), base::StringPrintf("[%u]", tab_id),
|
| + browser()));
|
| +
|
| + int duplicate_tab_id = tab_id;
|
| + duplicate_result.get()->GetAsInteger(&duplicate_tab_id);
|
| + // The test empty extension has no permissions, therefore it should get
|
| + // tab id of TYPE_INTEGER in the function result.
|
| + EXPECT_EQ(base::Value::TYPE_INTEGER, duplicate_result->GetType());
|
| + // Duplicate tab id should be different from the original tab id.
|
| + EXPECT_NE(tab_id, duplicate_tab_id);
|
| +}
|
| +
|
|
|