Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js

Issue 1433343003: [Extensions] Wait until the Window object is cleared before classifying contexts Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js
diff --git a/chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js b/chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b27e5cf2af957b6d710ec4e2c10faef85517e7
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/bindings/chromei18nrepro/background.js
@@ -0,0 +1,49 @@
+// Copyright 2015 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.
+
+var windowLoaded = false;
+var messaged = false;
+var iframeI18n = undefined;
+var appWindow = undefined;
+
+chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.app.window.create('window.html', {
+ id: "mainwin",
+ innerBounds: {
+ width: 700,
+ height: 600
+ }
+ }, function(win) {
+ appWindow = win;
+ appWindow.contentWindow.onload = function() {
+ windowLoaded = true;
+ chrome.test.log('Window loaded: ' + windowLoaded);
+ chrome.test.log('Iframe i18n: ' + iframeI18n);
+ // If the message already arrived, report the i18n state.
+ if (messaged) {
+ appWindow.contentWindow.reportChromeI18nState(
+ chrome.i18n != undefined, iframeI18n);
+ }
+ };
+ });
+});
+
+function initialize() {
+ var iframe = document.createElement('iframe');
+ iframe.src = '/iframe.html';
+ iframe.style.display = 'none';
+
+ document.body.appendChild(iframe);
+
+ window.addEventListener('message', function(e) {
+ messaged = true;
+ iframeI18n = e.data;
+ if (windowLoaded) {
+ appWindow.contentWindow.reportChromeI18nState(
+ chrome.i18n != undefined, iframeI18n);
+ }
+ });
+};
+
+initialize();

Powered by Google App Engine
This is Rietveld 408576698