| OLD | NEW | 
|    1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2011 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/file_util.h" |    5 #include "base/file_util.h" | 
|    6 #include "base/ref_counted.h" |    6 #include "base/ref_counted.h" | 
|    7 #include "base/utf_string_conversions.h" |    7 #include "base/utf_string_conversions.h" | 
|    8 #include "chrome/browser/browser_list.h" |    8 #include "chrome/browser/browser_list.h" | 
|    9 #include "chrome/browser/extensions/autoupdate_interceptor.h" |    9 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 
|   10 #include "chrome/browser/extensions/extension_apitest.h" |   10 #include "chrome/browser/extensions/extension_apitest.h" | 
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  635   if (newtab_result) |  635   if (newtab_result) | 
|  636     *newtab_result = newtab; |  636     *newtab_result = newtab; | 
|  637 } |  637 } | 
|  638  |  638  | 
|  639 // Tests that an extension page can call window.open to an extension URL and |  639 // Tests that an extension page can call window.open to an extension URL and | 
|  640 // the new window has extension privileges. |  640 // the new window has extension privileges. | 
|  641 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenExtension) { |  641 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WindowOpenExtension) { | 
|  642   ASSERT_TRUE(LoadExtension( |  642   ASSERT_TRUE(LoadExtension( | 
|  643       test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"))); |  643       test_data_dir_.AppendASCII("uitest").AppendASCII("window_open"))); | 
|  644  |  644  | 
|  645   TabContents* newtab; |  645   TabContents* newtab = NULL;  // clang, needs investigation | 
|  646   ASSERT_NO_FATAL_FAILURE(WindowOpenHelper( |  646   ASSERT_NO_FATAL_FAILURE(WindowOpenHelper( | 
|  647       browser(), |  647       browser(), | 
|  648       GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + |  648       GURL(std::string("chrome-extension://") + last_loaded_extension_id_ + | 
|  649            "/test.html"), |  649            "/test.html"), | 
|  650       "newtab.html", &newtab)); |  650       "newtab.html", &newtab)); | 
|  651  |  651  | 
|  652   bool result = false; |  652   bool result = false; | 
|  653   ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |  653   ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 
|  654       newtab->render_view_host(), L"", L"testExtensionApi()", &result)); |  654       newtab->render_view_host(), L"", L"testExtensionApi()", &result)); | 
|  655   EXPECT_TRUE(result); |  655   EXPECT_TRUE(result); | 
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  854           L"        window.chrome.app.isInstalled = false;" |  854           L"        window.chrome.app.isInstalled = false;" | 
|  855           L"        return 'BAD: Should have thrown by now...';" |  855           L"        return 'BAD: Should have thrown by now...';" | 
|  856           L"      } catch (e) {" |  856           L"      } catch (e) {" | 
|  857           L"        return 'GOOD: Saw expected error.';" |  857           L"        return 'GOOD: Saw expected error.';" | 
|  858           L"      }" |  858           L"      }" | 
|  859           L"    }()" |  859           L"    }()" | 
|  860           L");", |  860           L");", | 
|  861           &result)); |  861           &result)); | 
|  862   EXPECT_EQ("GOOD: Saw expected error.", result); |  862   EXPECT_EQ("GOOD: Saw expected error.", result); | 
|  863 } |  863 } | 
| OLD | NEW |