OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" | 12 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" |
13 #include "chrome/browser/extensions/extension_apitest.h" | 13 #include "chrome/browser/extensions/extension_apitest.h" |
14 #include "chrome/browser/extensions/extension_function_test_utils.h" | 14 #include "chrome/browser/extensions/extension_function_test_utils.h" |
15 #include "chrome/browser/extensions/extension_install_prompt.h" | 15 #include "chrome/browser/extensions/extension_install_prompt.h" |
16 #include "chrome/browser/extensions/extension_install_ui.h" | 16 #include "chrome/browser/extensions/extension_install_ui.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/extensions/webstore_installer.h" | 18 #include "chrome/browser/extensions/webstore_installer.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/test/base/test_launcher_utils.h" | |
24 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
25 #include "content/public/browser/gpu_data_manager.h" | 24 #include "content/public/browser/gpu_data_manager.h" |
26 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
27 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
28 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
29 #include "gpu/config/gpu_feature_type.h" | 28 #include "gpu/config/gpu_feature_type.h" |
30 #include "gpu/config/gpu_info.h" | 29 #include "gpu/config/gpu_info.h" |
31 #include "net/dns/mock_host_resolver.h" | 30 #include "net/dns/mock_host_resolver.h" |
32 #include "ui/gl/gl_switches.h" | 31 #include "ui/gl/gl_switches.h" |
33 | 32 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 ASSERT_TRUE(listener.received_success()); | 304 ASSERT_TRUE(listener.received_success()); |
306 ASSERT_EQ("iamefpfkojoapidjnbafmgkgncegbkad", listener.id()); | 305 ASSERT_EQ("iamefpfkojoapidjnbafmgkgncegbkad", listener.id()); |
307 } | 306 } |
308 | 307 |
309 // Tests that an error is properly reported when an empty crx is returned. | 308 // Tests that an error is properly reported when an empty crx is returned. |
310 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, EmptyCrx) { | 309 IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, EmptyCrx) { |
311 ASSERT_TRUE(RunInstallTest("empty.html", "empty.crx")); | 310 ASSERT_TRUE(RunInstallTest("empty.html", "empty.crx")); |
312 } | 311 } |
313 | 312 |
314 class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { | 313 class ExtensionWebstoreGetWebGLStatusTest : public InProcessBrowserTest { |
315 public: | |
316 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
317 // We need to launch GPU process to decide if WebGL is allowed. | |
318 // Run it on top of osmesa to avoid bot driver issues. | |
319 #if !defined(OS_MACOSX) | |
320 CHECK(test_launcher_utils::OverrideGLImplementation( | |
321 command_line, gfx::kGLImplementationOSMesaName)) << | |
322 "kUseGL must not be set multiple times!"; | |
323 #endif | |
324 } | |
325 | |
326 protected: | 314 protected: |
327 void RunTest(bool webgl_allowed) { | 315 void RunTest(bool webgl_allowed) { |
328 static const char kEmptyArgs[] = "[]"; | 316 static const char kEmptyArgs[] = "[]"; |
329 static const char kWebGLStatusAllowed[] = "webgl_allowed"; | 317 static const char kWebGLStatusAllowed[] = "webgl_allowed"; |
330 static const char kWebGLStatusBlocked[] = "webgl_blocked"; | 318 static const char kWebGLStatusBlocked[] = "webgl_blocked"; |
331 scoped_refptr<WebstorePrivateGetWebGLStatusFunction> function = | 319 scoped_refptr<WebstorePrivateGetWebGLStatusFunction> function = |
332 new WebstorePrivateGetWebGLStatusFunction(); | 320 new WebstorePrivateGetWebGLStatusFunction(); |
333 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( | 321 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult( |
334 function.get(), kEmptyArgs, browser())); | 322 function.get(), kEmptyArgs, browser())); |
335 ASSERT_TRUE(result); | 323 ASSERT_TRUE(result); |
(...skipping 30 matching lines...) Expand all Loading... |
366 content::GpuDataManager::GetInstance()->InitializeForTesting( | 354 content::GpuDataManager::GetInstance()->InitializeForTesting( |
367 json_blacklist, gpu_info); | 355 json_blacklist, gpu_info); |
368 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 356 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
369 gpu::GPU_FEATURE_TYPE_WEBGL)); | 357 gpu::GPU_FEATURE_TYPE_WEBGL)); |
370 | 358 |
371 bool webgl_allowed = false; | 359 bool webgl_allowed = false; |
372 RunTest(webgl_allowed); | 360 RunTest(webgl_allowed); |
373 } | 361 } |
374 | 362 |
375 } // namespace extensions | 363 } // namespace extensions |
OLD | NEW |