Chromium Code Reviews| Index: chrome/browser/extensions/api/browser/browser_apitest.cc |
| diff --git a/chrome/browser/extensions/api/browser/browser_apitest.cc b/chrome/browser/extensions/api/browser/browser_apitest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..88754b839bfd4a27f8f447e9f89e0a3634457765 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/browser/browser_apitest.cc |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <string> |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/strings/stringprintf.h" |
| +#include "base/values.h" |
| +#include "chrome/browser/extensions/api/browser/browser_api.h" |
| +#include "chrome/browser/extensions/extension_function_test_utils.h" |
| +#include "chrome/test/base/in_process_browser_test.h" |
| + |
| +namespace extensions { |
| + |
| +namespace utils = extension_function_test_utils; |
| + |
| +namespace { |
| + |
| +class BrowserApiTest : public InProcessBrowserTest { |
| +}; |
| + |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_F(BrowserApiTest, OpenTab) { |
| + std::string url = "about:blank"; |
|
miket_OOO
2014/04/28 18:24:35
Would a different URL be a better test? For exampl
rpaquay
2014/04/28 19:44:12
Agreed. I only added a "sanity check" test at this
|
| + |
| + scoped_refptr<api::BrowserOpenTabFunction> function = |
| + new api::BrowserOpenTabFunction(); |
| + scoped_refptr<Extension> extension(utils::CreateEmptyExtension()); |
| + function->set_extension(extension.get()); |
| + base::Value* result = utils::RunFunctionAndReturnSingleResult( |
| + function.get(), |
| + base::StringPrintf("[{\"url\":\"%s\"}]", url.c_str()), |
| + browser()); |
| + |
| + // result is currently NULL on success. |
| + EXPECT_FALSE(result); |
|
miket_OOO
2014/04/28 18:24:35
Is there a failure case? I see the IDL has a void
rpaquay
2014/04/28 19:44:12
The failure cases would be reported through "chrom
|
| +} |
| + |
| +} // namespace extensions |