Bahrain's Gulf Hotel complex is set to house a 165 room, 15-storey luxury apartment block worth over US$10 million.
A block of serviced apartments is to be built within Bahrain's Gulf Hotel complex. The project is expected to cost in the region of US $10.6 million. Work will start in July 2004 and should be completed within 18 months. The 15 storey building will house a total of 101 apartments, consisting of one, two or three bedrooms. "The development project will reinforce the current status of Gulf Hotel as the biggest hotel property in Bahrain, with 360 rooms, a convention and exhibition centre, huge recreation area and 11 outlets," says Farouk Almoayyed, chairman, Bahrain Hotels Company. The apartments range from 95m² for a one-bedroom and 145m² for a three-bedroom flat. There are also options to connect a single-bedroom apartment with a two or three-bedroom apartment. The overall area of the tower is 15,000m². "Each of the apartments will be fully equipped with furnishings, kitchen area and hotel amenities and facilities," said an Adel Ahmadi spokesperson. "The building will be conveniently located in what is known now as the garden leading to the Pearl Suite function room." A glass-enclosed atrium will connect the apartment building to the South Wing building of the Gulf Hotel. This means that residents will have access to the hotel's recreation, food and beverage and business facilities. The apartments are designed to house long-staying guests and families and they (the apartments) will be connected directly to the hotel, but it will also have an outside entrance. Residents will be able to use all of the hotel facilities as part of the Gulf Hotel package. With the opening of the new building in 2005, the Gulf Hotel will be the largest hotel property in Bahrain, offering more than 520 rooms. The development will also provide a boost to the local economy of Bahrain with many jobs for locals being created. "Within the 101 apartments are 165 rooms. We expect the building to be ready for accommodation in at least two years time.We expect to increase the hotel staff by over 20%, therefore the opening of the building means that there will be 100 more jobs created in Bahrain," Almoayyed adds. This latest development comes on the back of the imminent launch of the US$18.5 million Movenpick Bahrain, which is set to hold its soft launch this coming January. The 106-room property will become the first hotel on Muharraq Island.


Mike Cappelletti & Mike Caro games by two great writers.
£12.99 Pub: 2006 126pp mainly focusing on Omaha high.
ID: X1220 strategies for each game.
ID: X12807 absolutely crush PLO8 poker games.
Pat Dittmar mastering the game of poker.
ID: X12161 new players into winning players.
ID: X2681 cash games and tournaments.
Jeff Hwang play in live games or online.
William Jockusch up through advanced concepts.
Stewart Reuben action at each stage of a complete hand.
Tournament, Ring & Pot Limit situation, logic and reasoning supplied.


text:
Die Jüdische Gemeinde Höringhausen im nordhessischen Dorf Höringhausen, einer ehemals Hessen-Darmstädter Enklave innerhalb des Fürstentums Waldeck und einem heutigen Ortsteil der Stadt Waldeck, bestand vom 18. Jahrhundert bis zur Zeit des Nationalsozialismus.

Gemeindeentwicklung
In Höringhausen bestand eine jüdische Gemeinde von der Mitte des 18. Jahrhunderts bis 1938/1942. Im Jahre 1704 sind erstmals zwei jüdische Hausbesitzer erwähnt. Im Jahre 1730 hatten drei Juden im Ort das vom Landgrafen verbriefte Recht, Pfänder anzunehmen und dafür Geld auszuzahlen; verpfändete Gegenstände mussten acht Tage lang zum Einlösen bereitgehalten werden, dann durften sie veräußert werden. Um die Mitte des 18. Jahrhunderts begann ein verstärkter Zuzug weiterer Familien, sodass nunmehr eine Gemeinde (Kehillah) im kultischen Sinne bestand, und 1783 gab es bereits 24 jüdische Familien bzw. Haushaltungen im Dorf. Von allen wurde das so genannte Schutzgeld erhoben. Nach der Mitte des 19. Jahrhunderts erreichte die Zahl der jüdischen Einwohner ihren Höchststand mit 152 im Jahre 1856. Danach fiel ihre Zahl durch Abwanderung stetig, insbesondere nachdem 1869 im Norddeutschen Bund und 1871 im Deutschen Reich die Jüdische Emanzipation Gesetz wurde und damit sowohl Gewerbe- als auch Wohnfreiheit gegeben waren. Die Entwicklung der Gemeindegröße war wie folgt:

Gemeindeleben
Bis zur Mitte des 19. Jahrhunderts lebten die jüdischen Familien des landwirtschaftlich geprägten Dorfs vor allem vom Klein- und Hausierhandel und ein wenig Landwirtschaft (hauptsächlich Gärten und Wiesen) in recht ärmlichen Verhältnissen. Danach brachten es einige von ihnen zu etwas Wohlstand durch den Betrieb etwas größerer Gewerbebetriebe und Handlungen (Blech- und Altwarenhandlung, Fell-, Leder- und Schuhhandlung, Kolonialwarenladen, Tuchwarengeschäft, Tuch- und Handarbeitsladen, Spirituosenhandel). Einer betrieb ein einträgliches Gasthaus. Juden durften sich im Fürstentum Waldeck nur von Sonnenaufgang bis Sonnenuntergang aufhalten, und da jüdische Händler das Fürstentum nicht an einem Tag durchqueren konnten, kehrten sie gerne in der mitten im Fürstentum gelegenen hessen-darmstädter Enklave Höringhausen ein. Unter den gewerbetreibenden Juden waren ein Schuhmacher, ein Küfer und sieben Metzger. Letztere übten ihre Tätigkeit auch in den umliegenden Orten aus, damit ihre Glaubensbrüder dort koscheres Fleisch verzehren konnten. Sie mussten für ihre Tätigkeit eine besondere Steuer bezahlen, die sogenannte Schlacht-Akzise.

Die Gemeinde gehörte zunächst zum Rabbinat Gießen, seit 1885 zum Provinzialrabbinat Marburg. Sie war orthodox eingestellt, und der Sabbat wurde streng beachtet. Während des Sabbats und an jüdischen Festtagen kümmerten sich oft christliche Nachbarsfrauen um das Inganghalten des Feuers und andere Dinge, die Juden an solchen Tagen untersagt waren. Enge Beziehungen bestanden zur sicherlich wohlhabenderen jüdischen Gemeinde in der nahen waldeckschen Stadt Sachsenhausen.

Ein jüdischer Einwohner des Dorfs, Markus Lazarus, nahm als Soldat am Deutsch-Französischen Krieg 1870/71 teil und begründete später den Kriegerverein Höringhausen, dessen Vereinsfahne er auch stiftete. Vor seinem Tod im Jahre 1907 stiftete er der jüdischen, der evangelischen und der politischen Gemeinde jeweils 9000 Mark, mit der Auflage, es nur für Arme, Kranke und sonstige wohltätige Zwecke zu verwenden.

Im Ersten Weltkrieg fielen aus der jüdischen Gemeinde zwei Söhne der Familie Adler; ihre Namen sind auf dem Kriegerdenkmal der Gemeinde verewigt.

Nationalsozialistische Verfolgung
Das bisher gute Zusammenleben der Bewohner des Ortes änderte sich erst ab Ende der 1920er Jahre. Von den 22 jüdischen Personen in fünf Familien, die 1933 noch in Höringhausen lebten, zogen fast alle in den folgenden Jahren wegen der zunehmenden Entrechtung und Repressalien weg oder wanderten ganz aus Deutschland aus. Isaak Kohlhagen, reisender Tuchwarenhändler aus Höringhausen, wurde während der Zeit des Nationalsozialismus verhaftet und erst nach schwersten Misshandlungen nach Hause entlassen; er starb an den Folgen seiner Verletzungen im Jahr 1938.

1939 gab es nur noch vier jüdische Einwohner. Sie wurden 1942 in Vernichtungslager deportiert und dort ermordet. Von den in Höringhausen geborenen und/oder längere Zeit am Ort wohnhaften jüdischen Personen wurden mindestens 17 umgebracht; von ihnen wurde die Älteste 1854, der Jüngste 1906 geboren.

Gemeindeeinrichtungen

An Einrichtungen bestanden eine Synagoge (ab 1792), eine jüdische Schule (von 1869 bis um 1917 als jüdische Elementarschule, ansonsten Religionsschule), eine Mikwe (rituelles Bad) an der Alrafter Straße (1870 erneuert und "Plunkhäuschen" genannt) und ein jüdischer Friedhof. Der Friedhof wurde in der Mitte des 19. Jahrhunderts angelegt. Er hat eine Größe von 27 Ar und liegt etwa 500 m vom Ortskern entfernt am Komberg, inmitten landwirtschaftlich genutzter Flächen. 25 Grabsteine sind erhalten. Viele stehen allerdings nicht mehr an ihren ursprünglichen Grabstellen, andere sind umgekippt, einige auch zerbrochen. Etliche sind in falscher Richtung wieder aufgestellt worden. Die letzte Belegung war im Februar 1936, als der Leder- und Fellhändler Hermann Katzenstein, der wenige Tage zuvor überfallen und schwer misshandelt worden war, an den Folgen seiner Verletzungen starb und dort beigesetzt wurde.

Die Elementarschule (zunächst Privatschule, ab 1886 auf Antrag der jüdischen Gemeinde "öffentliche israelitische Elementarschule") wurde 1871 von 26, 1873 von 23 Schülern besucht. Die Schülerzahlen gingen ständig zurück, und so besuchten bald alle Kinder die Dorfschule und ab etwa 1917 gingen die jüdischen Kinder nur noch zum religiösen Unterricht in die Synagoge. Die Gemeinde hatte einen Lehrer, der auch als Chasan (Vorbeter) und Schochet (Schlachter) fungierte. Bemerkenswert ist, dass die Gemeinde im Jahre 1878, als sie in der Zeitschrift "Der Israelit" vom 27. November 1878 die Stelle eines Religionslehrers und Vorbeters ausschrieb, in ihre Anzeige den Satz einfügte: "Polen und Russen bleiben unberücksichtigt."

Synagoge

Bis zum Bau der ersten Synagoge im Jahre 1792 nutzte die Gemeinde einen Betraum in einem der jüdischen Wohnhäuser. Die erste Synagoge stand an der Ecke Hauptstraße/Korbacher Straße. Sie wurde im August 1841 vom großherzoglichen Kreisrat in Vöhl für baufällig und irreparabel erklärt und 1851 auf Anweisung der Behörden geschlossen. Schon im August 1841 hatte der Kreisrat von der Gemeinde Auskunft verlangt, ob die Kosten für einen Neubau durch Umlagen oder Kapitalaufnahmen erbracht werden könnten. Es dauerte noch bis 1847 ehe sich die männlichen Gemeindemitglieder verpflichteten, je nach Einkommen eine Summe zu zeichnen, die sie in den nächsten Jahren für den Bau einer Synagoge spenden wollten. Junggesellen waren ausdrücklich mit herangezogen, und jeder zwischen 15 und 60 Jahren musste so hoch zeichnen, wie eben möglich. So kamen 258 Gulden und 20 Albus pro Jahr zusammen. Gleichzeitig beantragte die Gemeinde die Genehmigung, bei Glaubensbrüdern in den Provinzen Oberhessen und Starkenburg Kollekten erheben zu dürfen, um die insgesamt 5000 Gulden an veranschlagten Baukosten aufzubringen; dies wurde bewilligt.

Nach der Schließung der alten Synagoge behalf man sich zunächst mit einem Betraum im Wohnhaus eines Gemeindemitglieds. Dieses Haus wurde 1852 abgerissen und auf dem Grundstück (Hauptstraße 15) im Jahre 1854 ein neues jüdisches Gemeindezentrum mit Synagoge, Schule und Lehrerwohnung gebaut. Es war ein aus rotem, behauenem Sandstein erstellter rechteckig-gestreckter Massivbau auf einem niedrigen Sockel, mit einem Satteldach. Die Giebelwände waren bis über die Dachfläche hochgezogen. Ein kleiner vorgebauter Erker am Ostgiebel zeigte von außen den Standort des Toraschreins an. Die Fenster und Türen hatten charakteristische Rundbögen. Die Holzfenster waren mit Sprossen unterteilt und hatten durchbrochene Bogenflächen. In der Mitte der Straßenseite befand sich, auf Sockelhöhe, die zweiflügelige Haupteingangstür mit breitem Stufenzugang. Rechts und links davon waren jeweils zwei Fenster. Die Synagoge wurde durch den großherzoglichen Rabbiner Benedict Samuel Levi aus Gießen eingeweiht.

Da wegen der nach 1933 stark zurückgegangenen Zahl der Gemeindemitglieder keine regelmäßigen Gottesdienste mehr abgehalten werden konnten, wurde das Gebäude 1937 an die Spar- und Darlehenskasse Höringhausen verkauft und als Lager benutzt. Durch diesen Verkauf entging es der Zerstörung beim Novemberpogrom 1938. Die rituellen Gegenstände wurden nach Kassel verbracht; dort wurden sie beim Novemberpogrom 1938 zerstört.

Nachkriegsnutzung

Nach 1945 wurde das Gebäude auf Anordnung der Militärregierung für die Unterbringung mehrerer Flüchtlingsfamilien verwendet. Danach wurde es, baulich im Wesentlichen unverändert, wieder von der Spar- und Darlehenskasse gekauft und erneut als Lager genutzt. Erst gegen Ende der 1950er Jahre wurde die ehemalige Synagoge baulich stark verändert und äußerlich als ehemaliges Gotteshaus unkenntlich gemacht: die Fenster und Türöffnungen wurden verändert, und das Gebäude wurde um ein Drittel verkürzt, um eine Hofeinfahrt zu den neu errichteten Lagerräumen hinter dem Haus zu schaffen.

Ab August 1989 wurde der bis dahin noch erhaltene Gebäudeteil der ehemaligen Synagoge abgebrochen und auf dem Grundstück ein Neubau der Raiffeisenbank Freienhagen-Höringhausen (früher Spar- und Darlehenskasse) errichtet. Nach langen Verhandlungen wurde schließlich eine Gedenktafel an der rechten Seitenmauer angebracht, mit folgender Inschrift: "Gedenktafel der "Synagoge" Höringhausen. Bis zu seiner Veräußerung an die Raiffeisenkasse Höringhausen im Jahre 1937 diente das im Jahre 1854 erbaute Gebäude der jüdischen Gemeinde als Synagoge und Schule". Heute befindet sich in dem Gebäude der Hauptsitz der NetCom Access.

Fotogalerie Friedhof

Einzelnachweise

Weblinks
 Zur jüdischen Gemeinde Höringhausen bei Alemannia Judaica
 Anneliese Laartz: Juden in Höringhausen. Vortragsmanuskript. 1999.

Horinghausen
Organisation (Waldeck, Stadt)
Horinghausen

redpajama_set_name: RedPajamaWikipedia


Hoboken, NJ : J. Wiley, c2004.
Hoboken, N.J. : John Wiley and Sons, Incorporated, 2013.
New York ; Chichester : John Wiley, c2001.
Hoboken, N.J. : John Wiley & Sons, c2006.
New York ; Chichester : Wiley, 2005.
Beijing : Dian zi gong ye chu ban she, 2002.
Hoboken, N.J. : John Wiley & Sons ; New York : International Institute for Learning, c2010.
New York : Chichester : Wiley, 2003.
Hoboken, N.J. : Wiley : International Institute for Learning, c2010.
New York ; Chichester : Wiley, c2001.
Hoboken, N.J. : Wiley ; New York : IIL/International Institute for Learning, c2009.
Berea, Ohio : Wiley, c2006.


Your Form and your Sequence were made for each other. When your Subscribers opt into your Form, a great way to engage them immediately is to drop them into a Welcome Sequence (read more ideas for this here).
In order for this seamless transition to work, you will want to connect your Form to your Sequence.
If you don't have a Visual Automation set up yet, this is a great place to start!
Once you're on your Automations page from the navigation bar, click New Automation, in the top right of the page.
You'll be taken to a page where you can click Create New Automation to select your entry point for this Automation (this is the step that will trigger people into this Automation).
Click the (+) to add an Action.
Search for your existing Sequence or click Create Sequence to create a new one.
No need to save—Automations will save automatically!
As Subscribers go through all of the published emails in the Sequence, they are marked as having completed that Sequence. From here, Subscribers will move on to the next step in the Automation.
NOTE: If you're still working on your emails, create a new email at the end of your Sequence, set the delay for 999 days, and publish it. That will give you plenty of time to add or publish emails before Subscribers complete the Sequence!
A subscriber is manually removed from a Sequence by you.
When you're ready, toggle this Automation to Live for Subscribers to start flowing through.


text:
Basselinia iterata is a species of flowering plant in the family Arecaceae. It is found only in New Caledonia.

References

iterata
Endemic flora of New Caledonia
Vulnerable plants
Taxonomy articles created by Polbot


text:
Heggessey's legacy
As the controller of BBC1 considers her next move, Maggie Brown and Matt Wells examine how she put the channel ahead of the competition
Maggie Brown and Matt Wells
Sun 13 Feb 2005 21.35 EST
If Lorraine Heggessey quits this week as controller of BBC1, she will have achieved what few of her predecessors have managed: leaving it in a stronger state than when she took over. In her four years at the top, Heggessey has turned a cash-starved, unloved channel into the most popular network in Britain. In that sense, she is probably the most successful controller of the channel since Michael Grade.
But that populism came at a price. It lost the BBC friends at a crucial time: when the Hutton chips were down, the corporation was left stranded - only now, with Dyke gone, is there a sense that BBC1 is regaining its public service purpose.
Fortunately for Heggessey, again unlike some of those who went before her, she has managed to survive the broadcasting front line with her armour intact, if a little battered. But she knows that running BBC1 is not a job for life - the trick is to leave while on top. This consideration has been high in Heggessey's mind over the weekend as she weighs up the juicy temptation to move to Talkback Thames, where the post of chief executive beckons.
It has been a fast-paced four years. She was appointed by Dyke and Mark Thompson, then director of television, in September 2000, when ITV1 under David Liddiment was riding high. Dyke identified the main channel as the BBC's biggest weakness, moving Peter Salmon to head up sport and injecting £100m into the programme budget.
Small, energetic, a woman of great intelligence, but no intellectual, Heggessey has an ability to see programmes from the viewers' point of view, and set about rebuilding the channel with vigour. She succeeded almost too well in reversing 50 years of history by late 2001, and made BBC1 the UK's most popular channel, ousting ITV. Dyke hailed it as a "remarkable achievement". The gap has remained - last year BBC1's audience share was 24.7% to ITV1's 22.8.%
Six months ago, at the Edinburgh Television festival, she soliloquised about staying for another two to three years, despite the drubbing that EastEnders was getting.
But there is a downside to running BBC1: ceaseless demands. "It's a job that grinds you down. You thank your lucky stars you have the chance to do it. But you can't please everyone," says a former BBC1 controller.
And the fun of the Dyke era is over. While Heggessey is not estranged from Mark Thompson, his ruthlessness, demanding 15% staff cuts, is alienating many. The governors, led by Grade, want to exercise their muscles over programme standards. One executive committee member says: "Everyone is taking potshots."
Heggessey must sense the end of an expansionary era. The growth in digital is faster and having a more profound effect on the big channels than expected. It is a struggle to even stay on a plateau.
So, if Heggessey goes now, what would be her achievements, apart from improving audience share?
First, she worked hand in glove with Dyke to ensure the lightning decision to move the news from 9pm to 10pm in October 2000 went as smoothly as possible. She oversaw a big boost to popular drama and entertainment, plus a big spend on sport. Whereas her predecessor, Peter Salmon, could afford one Waking the Dead a year, she had the money for eight. The fourth weekly EastEnders episode, blocked by John Birt, was swiftly signed off by Dyke. My Family was bumped up to 26 episodes a year from eight. But her signature programmes were brave, such as her National Health week. She is a great believer in shared family experiences and she pushed the children's annual Prom as well as the dramas I Was a Rat and My Dad's the Prime Minister.
She is also identified with popular factual specials, including Pyramid, and Pompeii: The Last Day, though last autumn's Space Odyssey fell flat. But the rush for popularity brought a backlash. Rolf on Art was not enough arts programming, and scheduling Holby City against ITV's thought-provoking drama Second Coming was an own goal.
Her populist hunt for big events led her into trouble in 2002 with the derivative Fame Academy. She and Dyke provoked ire by sticking with their decision to run Panorama at 10.15pm on Sunday nights.
Her enthusiasm is sometimes her undoing: she can get so excited and passionate it can affect her judgment.
But in the past two years she has been moving according to the governors' demands, to remodel BBC1 in a more diverse, public service manner. Arts are back with Imagine and series such as Michelangelo. To describe Heggessey as Greg Dyke's "mini me" would be wrong. Her history is as part of the group of Lime Grove, current-affairs-trained women, who include her direct boss, Jana Bennett. She was a producer on Panorama, and was known as a single-minded operator who would not shirk from voicing her dissenting opinions.
This no-nonsense approach irritated and impressed her colleagues in equal measure - and it is her great strength. Nigel Pickard, director of programmes at ITV, says: "Lorraine is her own person. She did have a great relationship with Greg, and she was a fantastically good appointment. But she is independent. The relationship was based on professional respect. Maybe in some people's eyes BBC1 has become too popular, but if offered a fourth EastEnders who wouldn't take it?"
Heggessey does have a tough, ruthless side, and being controller of BBC1 means having to find a way to say no 200 times a day. "I think Lorraine has been brilliant," says Pickard, who followed Heggessey head of Children's BBC. "She is a great team player. She is a very good leader, a great motivator."
"She's the most positive and energetic person I have ever met, a real leader," says a BBC colleague.
Talkback Thames needs an impresario, to sell its shows and formats, including Pop Idol, and hold together a range of diverse talents from the huge drama factory of The Bill and Family Affairs in Merton, south London and writers such as Stephen Poliakoff.
Heggessey has the right qualities in spades - plus a fantastic insight into what programming the BBC needs. That is commercial gold dust. Pickard, who rebuffed an approach for the Talkback Thames job, says, "it's a fantastic job. If she takes it she would do it well."
Other top BBC executives say those with talent are currently receiving "up to a dozen offers" from independent companies.
The terms on which outside suppliers make programmes for broadcasters changed dramatically last year, in their favour. The BBC has announced its own decision to throw open a further quarter of its programming to outsiders, the so-called Window of Creative Competition. That could mean perhaps £200m to be competed for.
The choice of Talkback Thames is interesting, and leads straight to her patron, Dyke. It is part of Fremantle, the former Pearson Television division formed from a clutch of big spending mergers orchestrated by Dyke in the mid 1990s. Though now owned by broadcaster RTL, and so not strictly an independent, it is run by Tony Cohen, Dyke's former close executive colleague. One of the production companies, Grundy, makes Neighbours, which at some point will be replaced with a British-made series.
If Heggessey goes - and friends say she has made up her mind to leave, whether it is for Talkback or somewhere else - such decisions will be made by her successor.
There are two obvious candidates: one from within the BBC and one from outside. Jane Tranter, the controller of drama, has worked closely with Heggessey, although it is thought that she would take a considerable amount of persuasion to leave her current post. The other is Kevin Lygo, director of programmes at Channel 4, like Heggessey a brilliant programme strategist and fount of energy. But Lygo may have his eye on a greater prize - there are suggestions that, despite a no-poaching deal agreed by Thompson when he left C4 last year, the director-general covets Lygo as director of television material - although the post is not currently vacant.
If Heggessey does leave this week, and it is understood that an announcement could be made by tomorrow, she will be the first senior executive to leave since Thompson was appointed. The signs are that others may follow suit sooner, rather than later.

redpajama_set_name: RedPajamaCommonCrawl


text:
// Copyright (c) 2012 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 "gpu/command_buffer/service/test_helper.h"

#include <stddef.h>
#include <stdint.h>

#include <algorithm>
#include <string>

#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_tokenizer.h"
#include "gpu/command_buffer/service/buffer_manager.h"
#include "gpu/command_buffer/service/error_state_mock.h"
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/mocks.h"
#include "gpu/command_buffer/service/program_manager.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/gl_mock.h"
#include "ui/gl/gl_version_info.h"

using ::testing::_;
using ::testing::DoAll;
using ::testing::InSequence;
using ::testing::MatcherCast;
using ::testing::Pointee;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::SetArrayArgument;
using ::testing::SetArgumentPointee;
using ::testing::StrEq;
using ::testing::StrictMock;

namespace gpu {
namespace gles2 {

namespace {

template<typename T>
T ConstructShaderVariable(
    GLenum type, GLint array_size, GLenum precision,
    bool static_use, const std::string& name) {
  T var;
  var.type = type;
  var.arraySize = array_size;
  var.precision = precision;
  var.staticUse = static_use;
  var.name = name;
  var.mappedName = name;  // No name hashing.
  return var;
}

}  // namespace anonymous

// GCC requires these declarations, but MSVC requires they not be present
#ifndef COMPILER_MSVC
const GLuint TestHelper::kServiceBlackTexture2dId;
const GLuint TestHelper::kServiceDefaultTexture2dId;
const GLuint TestHelper::kServiceBlackTexture3dId;
const GLuint TestHelper::kServiceDefaultTexture3dId;
const GLuint TestHelper::kServiceBlackTexture2dArrayId;
const GLuint TestHelper::kServiceDefaultTexture2dArrayId;
const GLuint TestHelper::kServiceBlackTextureCubemapId;
const GLuint TestHelper::kServiceDefaultTextureCubemapId;
const GLuint TestHelper::kServiceBlackExternalTextureId;
const GLuint TestHelper::kServiceDefaultExternalTextureId;
const GLuint TestHelper::kServiceBlackRectangleTextureId;
const GLuint TestHelper::kServiceDefaultRectangleTextureId;

const GLint TestHelper::kMaxSamples;
const GLint TestHelper::kMaxRenderbufferSize;
const GLint TestHelper::kMaxTextureSize;
const GLint TestHelper::kMaxCubeMapTextureSize;
const GLint TestHelper::kMaxRectangleTextureSize;
const GLint TestHelper::kMax3DTextureSize;
const GLint TestHelper::kMaxArrayTextureLayers;
const GLint TestHelper::kNumVertexAttribs;
const GLint TestHelper::kNumTextureUnits;
const GLint TestHelper::kMaxTextureImageUnits;
const GLint TestHelper::kMaxVertexTextureImageUnits;
const GLint TestHelper::kMaxFragmentUniformVectors;
const GLint TestHelper::kMaxFragmentUniformComponents;
const GLint TestHelper::kMaxVaryingVectors;
const GLint TestHelper::kMaxVaryingFloats;
const GLint TestHelper::kMaxVertexUniformVectors;
const GLint TestHelper::kMaxVertexUniformComponents;
const GLint TestHelper::kMaxVertexOutputComponents;
const GLint TestHelper::kMaxFragmentInputComponents;
const GLint TestHelper::kMaxProgramTexelOffset;
const GLint TestHelper::kMinProgramTexelOffset;
const GLint TestHelper::kMaxTransformFeedbackSeparateAttribs;
const GLint TestHelper::kMaxUniformBufferBindings;
const GLint TestHelper::kUniformBufferOffsetAlignment;
#endif

std::vector<std::string> TestHelper::split_extensions_;

void TestHelper::SetupTextureInitializationExpectations(
    ::gfx::MockGLInterface* gl,
    GLenum target,
    bool use_default_textures) {
  InSequence sequence;

  bool needs_initialization = (target != GL_TEXTURE_EXTERNAL_OES);
  bool needs_faces = (target == GL_TEXTURE_CUBE_MAP);
  bool is_3d_or_2d_array_target = (target == GL_TEXTURE_3D ||
      target == GL_TEXTURE_2D_ARRAY);

  static GLuint texture_2d_ids[] = {
    kServiceBlackTexture2dId,
    kServiceDefaultTexture2dId };
  static GLuint texture_3d_ids[] = {
    kServiceBlackTexture3dId,
    kServiceDefaultTexture3dId };
  static GLuint texture_2d_array_ids[] = {
    kServiceBlackTexture2dArrayId,
    kServiceDefaultTexture2dArrayId };
  static GLuint texture_cube_map_ids[] = {
    kServiceBlackTextureCubemapId,
    kServiceDefaultTextureCubemapId };
  static GLuint texture_external_oes_ids[] = {
    kServiceBlackExternalTextureId,
    kServiceDefaultExternalTextureId };
  static GLuint texture_rectangle_arb_ids[] = {
    kServiceBlackRectangleTextureId,
    kServiceDefaultRectangleTextureId };

  const GLuint* texture_ids = NULL;
  switch (target) {
    case GL_TEXTURE_2D:
      texture_ids = &texture_2d_ids[0];
      break;
    case GL_TEXTURE_3D:
      texture_ids = &texture_3d_ids[0];
      break;
    case GL_TEXTURE_2D_ARRAY:
      texture_ids = &texture_2d_array_ids[0];
      break;
    case GL_TEXTURE_CUBE_MAP:
      texture_ids = &texture_cube_map_ids[0];
      break;
    case GL_TEXTURE_EXTERNAL_OES:
      texture_ids = &texture_external_oes_ids[0];
      break;
    case GL_TEXTURE_RECTANGLE_ARB:
      texture_ids = &texture_rectangle_arb_ids[0];
      break;
    default:
      NOTREACHED();
  }

  int array_size = use_default_textures ? 2 : 1;

  EXPECT_CALL(*gl, GenTextures(array_size, _))
      .WillOnce(SetArrayArgument<1>(texture_ids,
                                    texture_ids + array_size))
          .RetiresOnSaturation();
  for (int ii = 0; ii < array_size; ++ii) {
    EXPECT_CALL(*gl, BindTexture(target, texture_ids[ii]))
        .Times(1)
        .RetiresOnSaturation();
    if (needs_initialization) {
      if (needs_faces) {
        static GLenum faces[] = {
          GL_TEXTURE_CUBE_MAP_POSITIVE_X,
          GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
          GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
          GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
          GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
          GL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
        };
        for (size_t ii = 0; ii < arraysize(faces); ++ii) {
          EXPECT_CALL(*gl, TexImage2D(faces[ii], 0, GL_RGBA, 1, 1, 0, GL_RGBA,
                                      GL_UNSIGNED_BYTE, _))
              .Times(1)
              .RetiresOnSaturation();
        }
      } else {
        if (is_3d_or_2d_array_target) {
          EXPECT_CALL(*gl, TexImage3D(target, 0, GL_RGBA, 1, 1, 1, 0, GL_RGBA,
                                      GL_UNSIGNED_BYTE, _))
              .Times(1)
              .RetiresOnSaturation();
        } else {
          EXPECT_CALL(*gl, TexImage2D(target, 0, GL_RGBA, 1, 1, 0, GL_RGBA,
                                      GL_UNSIGNED_BYTE, _))
              .Times(1)
              .RetiresOnSaturation();
        }
      }
    }
  }
  EXPECT_CALL(*gl, BindTexture(target, 0))
      .Times(1)
      .RetiresOnSaturation();
}

void TestHelper::SetupTextureManagerInitExpectations(
    ::gfx::MockGLInterface* gl,
    bool is_es3_enabled,
    bool is_desktop_core_profile,
    const char* extensions,
    bool use_default_textures) {
  InSequence sequence;

  SetupTextureInitializationExpectations(
      gl, GL_TEXTURE_2D, use_default_textures);
  SetupTextureInitializationExpectations(
      gl, GL_TEXTURE_CUBE_MAP, use_default_textures);

  if (is_es3_enabled) {
    SetupTextureInitializationExpectations(
        gl, GL_TEXTURE_3D, use_default_textures);
    SetupTextureInitializationExpectations(
        gl, GL_TEXTURE_2D_ARRAY, use_default_textures);
  }

  bool ext_image_external = false;
  bool arb_texture_rectangle = is_desktop_core_profile;
  base::CStringTokenizer t(extensions, extensions + strlen(extensions), " ");
  while (t.GetNext()) {
    if (t.token() == "GL_OES_EGL_image_external") {
      ext_image_external = true;
      break;
    }
    if (t.token() == "GL_ARB_texture_rectangle") {
      arb_texture_rectangle = true;
      break;
    }
  }

  if (ext_image_external) {
    SetupTextureInitializationExpectations(
        gl, GL_TEXTURE_EXTERNAL_OES, use_default_textures);
  }
  if (arb_texture_rectangle) {
    SetupTextureInitializationExpectations(
        gl, GL_TEXTURE_RECTANGLE_ARB, use_default_textures);
  }
}

void TestHelper::SetupTextureDestructionExpectations(
    ::gfx::MockGLInterface* gl,
    GLenum target,
    bool use_default_textures) {
  if (!use_default_textures)
    return;

  GLuint texture_id = 0;
  switch (target) {
    case GL_TEXTURE_2D:
      texture_id = kServiceDefaultTexture2dId;
      break;
    case GL_TEXTURE_3D:
      texture_id = kServiceDefaultTexture3dId;
      break;
    case GL_TEXTURE_2D_ARRAY:
      texture_id = kServiceDefaultTexture2dArrayId;
      break;
    case GL_TEXTURE_CUBE_MAP:
      texture_id = kServiceDefaultTextureCubemapId;
      break;
    case GL_TEXTURE_EXTERNAL_OES:
      texture_id = kServiceDefaultExternalTextureId;
      break;
    case GL_TEXTURE_RECTANGLE_ARB:
      texture_id = kServiceDefaultRectangleTextureId;
      break;
    default:
      NOTREACHED();
  }

  EXPECT_CALL(*gl, DeleteTextures(1, Pointee(texture_id)))
      .Times(1)
      .RetiresOnSaturation();
}

void TestHelper::SetupTextureManagerDestructionExpectations(
    ::gfx::MockGLInterface* gl,
    bool is_es3_enabled,
    bool is_desktop_core_profile,
    const char* extensions,
    bool use_default_textures) {
  SetupTextureDestructionExpectations(gl, GL_TEXTURE_2D, use_default_textures);
  SetupTextureDestructionExpectations(
      gl, GL_TEXTURE_CUBE_MAP, use_default_textures);

  if (is_es3_enabled) {
    SetupTextureDestructionExpectations(
        gl, GL_TEXTURE_3D, use_default_textures);
    SetupTextureDestructionExpectations(
        gl, GL_TEXTURE_2D_ARRAY,use_default_textures);
  }

  bool ext_image_external = false;
  bool arb_texture_rectangle = false;
  base::CStringTokenizer t(extensions, extensions + strlen(extensions), " ");
  while (t.GetNext()) {
    if (t.token() == "GL_OES_EGL_image_external") {
      ext_image_external = true;
      break;
    }
    if (t.token() == "GL_ARB_texture_rectangle") {
      arb_texture_rectangle = true;
      break;
    }
  }

  if (ext_image_external) {
    SetupTextureDestructionExpectations(
        gl, GL_TEXTURE_EXTERNAL_OES, use_default_textures);
  }
  if (arb_texture_rectangle || is_desktop_core_profile) {
    SetupTextureDestructionExpectations(
        gl, GL_TEXTURE_RECTANGLE_ARB, use_default_textures);
  }

  EXPECT_CALL(*gl, DeleteTextures(TextureManager::kNumDefaultTextures, _))
      .Times(1)
      .RetiresOnSaturation();
}

void TestHelper::SetupContextGroupInitExpectations(
    ::gfx::MockGLInterface* gl,
    const DisallowedFeatures& disallowed_features,
    const char* extensions,
    const char* gl_version,
    bool bind_generates_resource) {
  InSequence sequence;

  SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", gl_version);

  gfx::GLVersionInfo gl_info(gl_version, "", extensions);

  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, _))
      .WillOnce(SetArgumentPointee<1>(kMaxRenderbufferSize))
      .RetiresOnSaturation();
  if (strstr(extensions, "GL_EXT_framebuffer_multisample") ||
      strstr(extensions, "GL_EXT_multisampled_render_to_texture") ||
      gl_info.is_es3) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES, _))
        .WillOnce(SetArgumentPointee<1>(kMaxSamples))
        .RetiresOnSaturation();
  } else if (strstr(extensions, "GL_IMG_multisampled_render_to_texture")) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_SAMPLES_IMG, _))
        .WillOnce(SetArgumentPointee<1>(kMaxSamples))
        .RetiresOnSaturation();
  }

  if (gl_info.IsAtLeastGL(3, 3) ||
      (gl_info.IsAtLeastGL(3, 2) &&
       strstr(extensions, "GL_ARB_blend_func_extended")) ||
      (gl_info.is_es && strstr(extensions, "GL_EXT_blend_func_extended"))) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT, _))
        .WillOnce(SetArgumentPointee<1>(8))
        .RetiresOnSaturation();
  }

  if (gl_info.IsES3Capable()) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxTransformFeedbackSeparateAttribs))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxUniformBufferBindings))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, _))
        .WillOnce(SetArgumentPointee<1>(kUniformBufferOffsetAlignment))
        .RetiresOnSaturation();
  }

  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_ATTRIBS, _))
      .WillOnce(SetArgumentPointee<1>(kNumVertexAttribs))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, _))
      .WillOnce(SetArgumentPointee<1>(kNumTextureUnits))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_TEXTURE_SIZE, _))
      .WillOnce(SetArgumentPointee<1>(kMaxTextureSize))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, _))
      .WillOnce(SetArgumentPointee<1>(kMaxCubeMapTextureSize))
      .RetiresOnSaturation();
  if (gl_info.IsES3Capable()) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_3D_TEXTURE_SIZE, _))
        .WillOnce(SetArgumentPointee<1>(kMax3DTextureSize))
        .RetiresOnSaturation();
  }
  if (gl_info.IsES3Capable()) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxArrayTextureLayers))
        .RetiresOnSaturation();
  }
  if (strstr(extensions, "GL_ARB_texture_rectangle")) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE, _))
        .WillOnce(SetArgumentPointee<1>(kMaxRectangleTextureSize))
        .RetiresOnSaturation();
  }
  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, _))
      .WillOnce(SetArgumentPointee<1>(kMaxTextureImageUnits))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, _))
      .WillOnce(SetArgumentPointee<1>(kMaxVertexTextureImageUnits))
      .RetiresOnSaturation();

  if (gl_info.is_es) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxFragmentUniformVectors))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VARYING_VECTORS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxVaryingVectors))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxVertexUniformVectors))
        .RetiresOnSaturation();
  } else {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxFragmentUniformComponents))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VARYING_FLOATS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxVaryingFloats))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, _))
        .WillOnce(SetArgumentPointee<1>(kMaxVertexUniformComponents))
        .RetiresOnSaturation();
  }

  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, _))
      .Times(testing::Between(0, 1))
      .WillRepeatedly(SetArgumentPointee<1>(kMaxVertexOutputComponents))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_FRAGMENT_INPUT_COMPONENTS, _))
      .Times(testing::Between(0, 1))
      .WillRepeatedly(SetArgumentPointee<1>(kMaxFragmentInputComponents))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl, GetIntegerv(GL_MAX_PROGRAM_TEXEL_OFFSET, _))
      .Times(testing::Between(0, 1))
      .WillRepeatedly(SetArgumentPointee<1>(kMaxProgramTexelOffset))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl, GetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, _))
      .Times(testing::Between(0, 1))
      .WillRepeatedly(SetArgumentPointee<1>(kMinProgramTexelOffset))
      .RetiresOnSaturation();

  bool use_default_textures = bind_generates_resource;
  SetupTextureManagerInitExpectations(
      gl, false, gl_info.is_desktop_core_profile, extensions,
      use_default_textures);
}

void TestHelper::SetupFeatureInfoInitExpectations(
      ::gfx::MockGLInterface* gl, const char* extensions) {
  SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", "");
}

void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion(
     ::gfx::MockGLInterface* gl,
     const char* extensions,
     const char* gl_renderer,
     const char* gl_version,
     bool enable_es3) {
  InSequence sequence;

  EXPECT_CALL(*gl, GetString(GL_VERSION))
      .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version)))
      .RetiresOnSaturation();

  // Persistent storage is needed for the split extension string.
  split_extensions_.clear();
  if (extensions) {
    split_extensions_ = base::SplitString(
        extensions, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
  }

  gfx::GLVersionInfo gl_info(gl_version, gl_renderer, extensions);
  if (!gl_info.is_es && gl_info.major_version >= 3) {
    EXPECT_CALL(*gl, GetIntegerv(GL_NUM_EXTENSIONS, _))
        .WillOnce(SetArgumentPointee<1>(split_extensions_.size()))
        .RetiresOnSaturation();
    for (size_t ii = 0; ii < split_extensions_.size(); ++ii) {
      EXPECT_CALL(*gl, GetStringi(GL_EXTENSIONS, ii))
          .WillOnce(Return(
              reinterpret_cast<const uint8_t*>(split_extensions_[ii].c_str())))
          .RetiresOnSaturation();
    }
  } else {
    EXPECT_CALL(*gl, GetString(GL_EXTENSIONS))
        .WillOnce(Return(reinterpret_cast<const uint8_t*>(extensions)))
        .RetiresOnSaturation();
  }

  EXPECT_CALL(*gl, GetString(GL_VERSION))
      .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_version)))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl, GetString(GL_RENDERER))
      .WillOnce(Return(reinterpret_cast<const uint8_t*>(gl_renderer)))
      .RetiresOnSaturation();

  if ((strstr(extensions, "GL_ARB_texture_float") ||
       gl_info.is_desktop_core_profile) ||
      (gl_info.is_es3 && strstr(extensions, "GL_EXT_color_buffer_float"))) {
    static const GLuint tx_ids[] = {101, 102};
    static const GLuint fb_ids[] = {103, 104};
    const GLsizei width = 16;
    EXPECT_CALL(*gl, GetIntegerv(GL_FRAMEBUFFER_BINDING, _))
        .WillOnce(SetArgumentPointee<1>(fb_ids[0]))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_TEXTURE_BINDING_2D, _))
        .WillOnce(SetArgumentPointee<1>(tx_ids[0]))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GenTextures(1, _))
        .WillOnce(SetArrayArgument<1>(tx_ids + 1, tx_ids + 2))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GenFramebuffersEXT(1, _))
        .WillOnce(SetArrayArgument<1>(fb_ids + 1, fb_ids + 2))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, BindTexture(GL_TEXTURE_2D, tx_ids[1]))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
        GL_NEAREST))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, width, 0,
        GL_RGBA, GL_FLOAT, _))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, BindFramebufferEXT(GL_FRAMEBUFFER, fb_ids[1]))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, FramebufferTexture2DEXT(GL_FRAMEBUFFER,
        GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tx_ids[1], 0))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
        .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0,
        GL_RGB, GL_FLOAT, _))
        .Times(1)
        .RetiresOnSaturation();
    if (gl_info.is_es3) {
      EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
          .WillOnce(Return(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT))
          .RetiresOnSaturation();
    } else {
      EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
          .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
          .RetiresOnSaturation();

      if (enable_es3 && gl_info.IsES3Capable()) {
        EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_R16F, width, width,
            0, GL_RED, GL_FLOAT, _))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RG16F, width, width,
            0, GL_RG, GL_FLOAT, _))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, width,
            0, GL_RGBA, GL_FLOAT, _))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_R32F, width, width,
            0, GL_RED, GL_FLOAT, _))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_RG32F, width, width,
            0, GL_RG, GL_FLOAT, _))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, GL_R11F_G11F_B10F,
            width, width, 0, GL_RGB, GL_FLOAT, _))
            .Times(1)
            .RetiresOnSaturation();
        EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
            .Times(1)
            .RetiresOnSaturation();
      }
    }

    EXPECT_CALL(*gl, DeleteFramebuffersEXT(1, _))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, DeleteTextures(1, _))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, BindFramebufferEXT(GL_FRAMEBUFFER, fb_ids[0]))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, BindTexture(GL_TEXTURE_2D, tx_ids[0]))
        .Times(1)
        .RetiresOnSaturation();
#if DCHECK_IS_ON()
    EXPECT_CALL(*gl, GetError())
        .WillOnce(Return(GL_NO_ERROR))
        .RetiresOnSaturation();
#endif
  }

  if (strstr(extensions, "GL_EXT_draw_buffers") ||
      strstr(extensions, "GL_ARB_draw_buffers") ||
      (gl_info.is_es3 && strstr(extensions, "GL_NV_draw_buffers")) ||
      gl_info.is_desktop_core_profile) {
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, _))
        .WillOnce(SetArgumentPointee<1>(8))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, _))
        .WillOnce(SetArgumentPointee<1>(8))
        .RetiresOnSaturation();
  }

  if (gl_info.is_es3 || gl_info.is_desktop_core_profile ||
      strstr(extensions, "GL_EXT_texture_rg") ||
      (strstr(extensions, "GL_ARB_texture_rg"))) {
    static const GLuint tx_ids[] = {101, 102};
    static const GLuint fb_ids[] = {103, 104};
    const GLsizei width = 1;
    EXPECT_CALL(*gl, GetIntegerv(GL_FRAMEBUFFER_BINDING, _))
        .WillOnce(SetArgumentPointee<1>(fb_ids[0]))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetIntegerv(GL_TEXTURE_BINDING_2D, _))
        .WillOnce(SetArgumentPointee<1>(tx_ids[0]))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GenTextures(1, _))
        .WillOnce(SetArrayArgument<1>(tx_ids + 1, tx_ids + 2))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, BindTexture(GL_TEXTURE_2D, tx_ids[1]))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, TexImage2D(GL_TEXTURE_2D, 0, _, width, width, 0,
        GL_RED_EXT, GL_UNSIGNED_BYTE, _))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GenFramebuffersEXT(1, _))
        .WillOnce(SetArrayArgument<1>(fb_ids + 1, fb_ids + 2))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, BindFramebufferEXT(GL_FRAMEBUFFER, fb_ids[1]))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, FramebufferTexture2DEXT(GL_FRAMEBUFFER,
        GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tx_ids[1], 0))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
        .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, DeleteFramebuffersEXT(1, _))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, DeleteTextures(1, _))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, BindFramebufferEXT(GL_FRAMEBUFFER, fb_ids[0]))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, BindTexture(GL_TEXTURE_2D, tx_ids[0]))
        .Times(1)
        .RetiresOnSaturation();
#if DCHECK_IS_ON()
    EXPECT_CALL(*gl, GetError())
        .WillOnce(Return(GL_NO_ERROR))
        .RetiresOnSaturation();
#endif
  }
}

void TestHelper::SetupExpectationsForClearingUniforms(
    ::gfx::MockGLInterface* gl, UniformInfo* uniforms, size_t num_uniforms) {
  for (size_t ii = 0; ii < num_uniforms; ++ii) {
    const UniformInfo& info = uniforms[ii];
    switch (info.type) {
    case GL_FLOAT:
      EXPECT_CALL(*gl, Uniform1fv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_FLOAT_VEC2:
      EXPECT_CALL(*gl, Uniform2fv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_FLOAT_VEC3:
      EXPECT_CALL(*gl, Uniform3fv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_FLOAT_VEC4:
      EXPECT_CALL(*gl, Uniform4fv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_INT:
    case GL_BOOL:
    case GL_SAMPLER_2D:
    case GL_SAMPLER_CUBE:
    case GL_SAMPLER_EXTERNAL_OES:
    case GL_SAMPLER_3D_OES:
    case GL_SAMPLER_2D_RECT_ARB:
    case GL_SAMPLER_2D_ARRAY:
      EXPECT_CALL(*gl, Uniform1iv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_UNSIGNED_INT:
      EXPECT_CALL(*gl, Uniform1uiv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_INT_VEC2:
    case GL_BOOL_VEC2:
      EXPECT_CALL(*gl, Uniform2iv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_UNSIGNED_INT_VEC2:
      EXPECT_CALL(*gl, Uniform2uiv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_INT_VEC3:
    case GL_BOOL_VEC3:
      EXPECT_CALL(*gl, Uniform3iv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_UNSIGNED_INT_VEC3:
      EXPECT_CALL(*gl, Uniform3uiv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_INT_VEC4:
    case GL_BOOL_VEC4:
      EXPECT_CALL(*gl, Uniform4iv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_UNSIGNED_INT_VEC4:
      EXPECT_CALL(*gl, Uniform4uiv(info.real_location, info.size, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_FLOAT_MAT2:
      EXPECT_CALL(*gl, UniformMatrix2fv(
          info.real_location, info.size, false, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_FLOAT_MAT3:
      EXPECT_CALL(*gl, UniformMatrix3fv(
          info.real_location, info.size, false, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    case GL_FLOAT_MAT4:
      EXPECT_CALL(*gl, UniformMatrix4fv(
          info.real_location, info.size, false, _))
          .Times(1)
          .RetiresOnSaturation();
      break;
    default:
      NOTREACHED();
      break;
    }
  }
}

void TestHelper::SetupProgramSuccessExpectations(
    ::gfx::MockGLInterface* gl,
    const FeatureInfo* feature_info,
    AttribInfo* attribs,
    size_t num_attribs,
    UniformInfo* uniforms,
    size_t num_uniforms,
    VaryingInfo* varyings,
    size_t num_varyings,
    ProgramOutputInfo* program_outputs,
    size_t num_program_outputs,
    GLuint service_id) {
  EXPECT_CALL(*gl,
      GetProgramiv(service_id, GL_LINK_STATUS, _))
      .WillOnce(SetArgumentPointee<2>(1))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl,
      GetProgramiv(service_id, GL_INFO_LOG_LENGTH, _))
      .WillOnce(SetArgumentPointee<2>(0))
      .RetiresOnSaturation();
  EXPECT_CALL(*gl,
      GetProgramiv(service_id, GL_ACTIVE_ATTRIBUTES, _))
      .WillOnce(SetArgumentPointee<2>(num_attribs))
      .RetiresOnSaturation();
  size_t max_attrib_len = 0;
  for (size_t ii = 0; ii < num_attribs; ++ii) {
    size_t len = strlen(attribs[ii].name) + 1;
    max_attrib_len = std::max(max_attrib_len, len);
  }
  EXPECT_CALL(*gl,
      GetProgramiv(service_id, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, _))
      .WillOnce(SetArgumentPointee<2>(max_attrib_len))
      .RetiresOnSaturation();

  for (size_t ii = 0; ii < num_attribs; ++ii) {
    const AttribInfo& info = attribs[ii];
    EXPECT_CALL(*gl,
        GetActiveAttrib(service_id, ii,
                        max_attrib_len, _, _, _, _))
        .WillOnce(DoAll(
            SetArgumentPointee<3>(strlen(info.name)),
            SetArgumentPointee<4>(info.size),
            SetArgumentPointee<5>(info.type),
            SetArrayArgument<6>(info.name,
                                info.name + strlen(info.name) + 1)))
        .RetiresOnSaturation();
    if (!ProgramManager::HasBuiltInPrefix(info.name)) {
      EXPECT_CALL(*gl, GetAttribLocation(service_id, StrEq(info.name)))
          .WillOnce(Return(info.location))
          .RetiresOnSaturation();
    }
  }
  EXPECT_CALL(*gl,
      GetProgramiv(service_id, GL_ACTIVE_UNIFORMS, _))
      .WillOnce(SetArgumentPointee<2>(num_uniforms))
      .RetiresOnSaturation();

  if (num_uniforms > 0) {
    size_t max_uniform_len = 0;
    for (size_t ii = 0; ii < num_uniforms; ++ii) {
      size_t len = strlen(uniforms[ii].name) + 1;
      max_uniform_len = std::max(max_uniform_len, len);
    }
    EXPECT_CALL(*gl, GetProgramiv(service_id, GL_ACTIVE_UNIFORM_MAX_LENGTH, _))
        .WillOnce(SetArgumentPointee<2>(max_uniform_len))
        .RetiresOnSaturation();
    for (size_t ii = 0; ii < num_uniforms; ++ii) {
      const UniformInfo& info = uniforms[ii];
      EXPECT_CALL(*gl,
                  GetActiveUniform(service_id, ii, max_uniform_len, _, _, _, _))
          .WillOnce(DoAll(SetArgumentPointee<3>(strlen(info.name)),
                          SetArgumentPointee<4>(info.size),
                          SetArgumentPointee<5>(info.type),
                          SetArrayArgument<6>(
                              info.name, info.name + strlen(info.name) + 1)))
          .RetiresOnSaturation();

      if (info.real_location != -1) {
        EXPECT_CALL(*gl, GetUniformLocation(service_id, StrEq(info.name)))
            .WillOnce(Return(info.real_location))
            .RetiresOnSaturation();
      }
      if (info.size > 1) {
        std::string base_name = info.name;
        size_t array_pos = base_name.rfind("[0]");
        if (base_name.size() > 3 && array_pos == base_name.size() - 3) {
          base_name = base_name.substr(0, base_name.size() - 3);
        }
        for (GLsizei jj = 1; jj < info.size; ++jj) {
          std::string element_name(std::string(base_name) + "[" +
                                   base::IntToString(jj) + "]");
          EXPECT_CALL(*gl, GetUniformLocation(service_id, StrEq(element_name)))
              .WillOnce(Return(info.real_location + jj * 2))
              .RetiresOnSaturation();
        }
      }
    }
  }

  if (feature_info->feature_flags().chromium_path_rendering) {
    EXPECT_CALL(*gl, GetProgramInterfaceiv(service_id, GL_FRAGMENT_INPUT_NV,
                                           GL_ACTIVE_RESOURCES, _))
        .WillOnce(SetArgumentPointee<3>(int(num_varyings)))
        .RetiresOnSaturation();
    size_t max_varying_len = 0;
    for (size_t ii = 0; ii < num_varyings; ++ii) {
      size_t len = strlen(varyings[ii].name) + 1;
      max_varying_len = std::max(max_varying_len, len);
    }
    EXPECT_CALL(*gl, GetProgramInterfaceiv(service_id, GL_FRAGMENT_INPUT_NV,
                                           GL_MAX_NAME_LENGTH, _))
        .WillOnce(SetArgumentPointee<3>(int(max_varying_len)))
        .RetiresOnSaturation();
    for (size_t ii = 0; ii < num_varyings; ++ii) {
      VaryingInfo& info = varyings[ii];
      EXPECT_CALL(*gl, GetProgramResourceName(service_id, GL_FRAGMENT_INPUT_NV,
                                              ii, max_varying_len, _, _))
          .WillOnce(DoAll(SetArgumentPointee<4>(strlen(info.name)),
                          SetArrayArgument<5>(
                              info.name, info.name + strlen(info.name) + 1)))
          .RetiresOnSaturation();
      if (ProgramManager::HasBuiltInPrefix(info.name))
        continue;

        static const GLenum kPropsArray[] = {GL_LOCATION, GL_TYPE,
                                             GL_ARRAY_SIZE};
        static const size_t kPropsSize = arraysize(kPropsArray);
        EXPECT_CALL(
            *gl, GetProgramResourceiv(
                     service_id, GL_FRAGMENT_INPUT_NV, ii, kPropsSize,
                     _ /*testing::ElementsAreArray(kPropsArray, kPropsSize)*/,
                     kPropsSize, _, _))
            .WillOnce(testing::Invoke([info](GLuint, GLenum, GLuint, GLsizei,
                                             const GLenum*, GLsizei,
                                             GLsizei* length, GLint* params) {
              *length = kPropsSize;
              params[0] = info.real_location;
              params[1] = info.type;
              params[2] = info.size;
            }))
            .RetiresOnSaturation();
      }
  }
  if (feature_info->gl_version_info().IsES3Capable() &&
      !feature_info->disable_shader_translator()) {
    for (size_t ii = 0; ii < num_program_outputs; ++ii) {
      ProgramOutputInfo& info = program_outputs[ii];
      if (ProgramManager::HasBuiltInPrefix(info.name))
        continue;

      EXPECT_CALL(*gl, GetFragDataLocation(service_id, StrEq(info.name)))
          .WillOnce(Return(info.color_name))
          .RetiresOnSaturation();
      if (feature_info->feature_flags().ext_blend_func_extended) {
        EXPECT_CALL(*gl, GetFragDataIndex(service_id, StrEq(info.name)))
            .WillOnce(Return(info.index))
            .RetiresOnSaturation();
      } else {
        // Test case must not use indices, or the context of the testcase has to
        // support the dual source blending.
        DCHECK(info.index == 0);
      }
    }
  }
}

void TestHelper::SetupShaderExpectations(::gfx::MockGLInterface* gl,
                                         const FeatureInfo* feature_info,
                                         AttribInfo* attribs,
                                         size_t num_attribs,
                                         UniformInfo* uniforms,
                                         size_t num_uniforms,
                                         GLuint service_id) {
  InSequence s;

  EXPECT_CALL(*gl, LinkProgram(service_id)).Times(1).RetiresOnSaturation();

  SetupProgramSuccessExpectations(gl, feature_info, attribs, num_attribs,
                                  uniforms, num_uniforms, nullptr, 0, nullptr,
                                  0, service_id);
}

void TestHelper::SetupShaderExpectationsWithVaryings(
    ::gfx::MockGLInterface* gl,
    const FeatureInfo* feature_info,
    AttribInfo* attribs,
    size_t num_attribs,
    UniformInfo* uniforms,
    size_t num_uniforms,
    VaryingInfo* varyings,
    size_t num_varyings,
    ProgramOutputInfo* program_outputs,
    size_t num_program_outputs,
    GLuint service_id) {
  InSequence s;

  EXPECT_CALL(*gl,
      LinkProgram(service_id))
      .Times(1)
      .RetiresOnSaturation();

  SetupProgramSuccessExpectations(
      gl, feature_info, attribs, num_attribs, uniforms, num_uniforms, varyings,
      num_varyings, program_outputs, num_program_outputs, service_id);
}

void TestHelper::DoBufferData(
    ::gfx::MockGLInterface* gl, MockErrorState* error_state,
    BufferManager* manager, Buffer* buffer, GLenum target, GLsizeiptr size,
    GLenum usage, const GLvoid* data, GLenum error) {
  EXPECT_CALL(*error_state, CopyRealGLErrorsToWrapper(_, _, _))
      .Times(1)
      .RetiresOnSaturation();
  if (manager->IsUsageClientSideArray(usage)) {
    EXPECT_CALL(*gl, BufferData(target, 0, _, usage))
        .Times(1)
        .RetiresOnSaturation();
  } else {
    EXPECT_CALL(*gl, BufferData(target, size, _, usage))
        .Times(1)
        .RetiresOnSaturation();
  }
  EXPECT_CALL(*error_state, PeekGLError(_, _, _))
      .WillOnce(Return(error))
      .RetiresOnSaturation();
  manager->DoBufferData(error_state, buffer, target, size, usage, data);
}

void TestHelper::SetTexParameteriWithExpectations(
    ::gfx::MockGLInterface* gl, MockErrorState* error_state,
    TextureManager* manager, TextureRef* texture_ref,
    GLenum pname, GLint value, GLenum error) {
  if (error == GL_NO_ERROR) {
    EXPECT_CALL(*gl, TexParameteri(texture_ref->texture()->target(),
                                   pname, value))
        .Times(1)
        .RetiresOnSaturation();
  } else if (error == GL_INVALID_ENUM) {
    EXPECT_CALL(*error_state, SetGLErrorInvalidEnum(_, _, _, value, _))
        .Times(1)
        .RetiresOnSaturation();
  } else {
    EXPECT_CALL(*error_state, SetGLErrorInvalidParami(_, _, error, _, _, _))
        .Times(1)
        .RetiresOnSaturation();
  }
  manager->SetParameteri("", error_state, texture_ref, pname, value);
}

// static
void TestHelper::SetShaderStates(
    ::gfx::MockGLInterface* gl,
    Shader* shader,
    bool expected_valid,
    const std::string* const expected_log_info,
    const std::string* const expected_translated_source,
    const int* const expected_shader_version,
    const AttributeMap* const expected_attrib_map,
    const UniformMap* const expected_uniform_map,
    const VaryingMap* const expected_varying_map,
    const InterfaceBlockMap* const expected_interface_block_map,
    const OutputVariableList* const expected_output_variable_list,
    const NameMap* const expected_name_map) {
  const std::string empty_log_info;
  const std::string* log_info = (expected_log_info && !expected_valid) ?
      expected_log_info : &empty_log_info;
  const std::string empty_translated_source;
  const std::string* translated_source =
      (expected_translated_source && expected_valid) ?
          expected_translated_source : &empty_translated_source;
  int default_shader_version = 100;
  const int* shader_version = (expected_shader_version && expected_valid) ?
      expected_shader_version : &default_shader_version;
  const AttributeMap empty_attrib_map;
  const AttributeMap* attrib_map = (expected_attrib_map && expected_valid) ?
      expected_attrib_map : &empty_attrib_map;
  const UniformMap empty_uniform_map;
  const UniformMap* uniform_map = (expected_uniform_map && expected_valid) ?
      expected_uniform_map : &empty_uniform_map;
  const VaryingMap empty_varying_map;
  const VaryingMap* varying_map = (expected_varying_map && expected_valid) ?
      expected_varying_map : &empty_varying_map;
  const InterfaceBlockMap empty_interface_block_map;
  const InterfaceBlockMap* interface_block_map =
      (expected_interface_block_map && expected_valid) ?
      expected_interface_block_map : &empty_interface_block_map;
  const OutputVariableList empty_output_variable_list;
  const OutputVariableList* output_variable_list =
      (expected_output_variable_list && expected_valid)
          ? expected_output_variable_list
          : &empty_output_variable_list;
  const NameMap empty_name_map;
  const NameMap* name_map = (expected_name_map && expected_valid) ?
      expected_name_map : &empty_name_map;

  MockShaderTranslator* mock_translator = new MockShaderTranslator;
  scoped_refptr<ShaderTranslatorInterface> translator(mock_translator);
  EXPECT_CALL(*mock_translator, Translate(_,
                                          NotNull(),   // log_info
                                          NotNull(),   // translated_source
                                          NotNull(),   // shader_version
                                          NotNull(),   // attrib_map
                                          NotNull(),   // uniform_map
                                          NotNull(),   // varying_map
                                          NotNull(),   // interface_block_map
                                          NotNull(),   // output_variable_list
                                          NotNull()))  // name_map
      .WillOnce(DoAll(SetArgumentPointee<1>(*log_info),
                      SetArgumentPointee<2>(*translated_source),
                      SetArgumentPointee<3>(*shader_version),
                      SetArgumentPointee<4>(*attrib_map),
                      SetArgumentPointee<5>(*uniform_map),
                      SetArgumentPointee<6>(*varying_map),
                      SetArgumentPointee<7>(*interface_block_map),
                      SetArgumentPointee<8>(*output_variable_list),
                      SetArgumentPointee<9>(*name_map), Return(expected_valid)))
      .RetiresOnSaturation();
  if (expected_valid) {
    EXPECT_CALL(*gl, ShaderSource(shader->service_id(), 1, _, NULL))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, CompileShader(shader->service_id()))
        .Times(1)
        .RetiresOnSaturation();
    EXPECT_CALL(*gl, GetShaderiv(shader->service_id(),
                                 GL_COMPILE_STATUS,
                                 NotNull()))  // status
        .WillOnce(SetArgumentPointee<2>(GL_TRUE))
        .RetiresOnSaturation();
  }
  shader->RequestCompile(translator, Shader::kGL);
  shader->DoCompile();
}

// static
void TestHelper::SetShaderStates(
      ::gfx::MockGLInterface* gl, Shader* shader, bool valid) {
  SetShaderStates(gl, shader, valid, nullptr, nullptr, nullptr, nullptr,
                  nullptr, nullptr, nullptr, nullptr, nullptr);
}

// static
sh::Attribute TestHelper::ConstructAttribute(
    GLenum type, GLint array_size, GLenum precision,
    bool static_use, const std::string& name) {
  return ConstructShaderVariable<sh::Attribute>(
      type, array_size, precision, static_use, name);
}

// static
sh::Uniform TestHelper::ConstructUniform(
    GLenum type, GLint array_size, GLenum precision,
    bool static_use, const std::string& name) {
  return ConstructShaderVariable<sh::Uniform>(
      type, array_size, precision, static_use, name);
}

// static
sh::Varying TestHelper::ConstructVarying(
    GLenum type, GLint array_size, GLenum precision,
    bool static_use, const std::string& name) {
  return ConstructShaderVariable<sh::Varying>(
      type, array_size, precision, static_use, name);
}

sh::OutputVariable TestHelper::ConstructOutputVariable(
    GLenum type,
    GLint array_size,
    GLenum precision,
    bool static_use,
    const std::string& name) {
  return ConstructShaderVariable<sh::OutputVariable>(
      type, array_size, precision, static_use, name);
}

ScopedGLImplementationSetter::ScopedGLImplementationSetter(
    gfx::GLImplementation implementation)
    : old_implementation_(gfx::GetGLImplementation()) {
  gfx::SetGLImplementation(implementation);
}

ScopedGLImplementationSetter::~ScopedGLImplementationSetter() {
  gfx::SetGLImplementation(old_implementation_);
}

}  // namespace gles2
}  // namespace gpu

redpajama_set_name: RedPajamaGithub


"the Airport Admin Utility was unable to read the configuratin of the selected base station. An error occured while reading the configuration.
i tried re-setting the base station the same appears.
Also, connection to internet was lost was the above appear after trying to access the base station, the airport icon reads connection is done, but i couldnt access the internet until i re-start.
It only does his while you are connected wireles. When connected with an ethernet cable, it should not do so. If anyone can check this, since this is only from self experience.


Finally finished Death Battle's Link vs Cloud match on ScrewAttack. This is my first ever fully 3d animation. Yes its a bit rough but I had a strict deadline to keep. Most of the animation was made in a week. Let me know what you think.
Its out now. Watch it.
Anyone watch the Death Battle series on ScrewAttack? Their ideas and presentation are great, but they needed better sprite animation. I'm taking over that position. Already got one episode done.
For those unaware, the character analysis and closing section are Ben and Chad's work, the original Death Battle material. My work is the sprite fight in between all that.
Check it out, I hope I may surprise some of you more jaded types that leer at sprite animation.
Since I can't embed those kinds of videos, here's the trailer as seen on Youtube.
Can you believe I made this in a week? Neither can I.
It is time. We are ready to present this publicly. I have a video presentation to introduce Helix to everyone. Please visit the website too, there's a lot more information.
We are looking for anyone who can help with skills in Java, OpenGL, OpenAL, or anything related to 3d math or graphics.
You may just be interested in the articles describing Helix and the theory behind it.
For those who enjoyed my ending to the second Castle Collab, here's a standalone video version on Youtube for convenience. There's no audio desync with this and you can always download it and scan through it as you like, since you can't get enough of me and my greatness.
Discuss. Yep I had to say that.
Nintendo's upcoming great game features ahhabla bhalb habalb blhalhlahbabla. And much more.
For those who believe I make no progress.
After endless experimentation, practice, and figuring out a structure for the creation process, I've settled on a large scale and elaborate methodology for the creation of NASF 2. I will be able to work in full 3d, animate with full freedom, and create absolutely anything the movie demands. Its been tough, its been frustrating to the point of lunacy, and the lack of any solid progress has made me look flakier than a snowman with dandruff. But as I've said many a time, I'm always working, still experimenting, blah blah hurble gurble blah. Now, NOW, I'm making real progress.
To start things off, seen below is a prototype of the first area to be seen in the trailer.
-Sprites all are lit dynamically. As in, no static shading. They are actually shaded according to the lighting arrangement and colors in the environment.
-Custom character sprites and animation. Lots of hand drawn animation, as well as rigs and setups for more complex character animation.
-The whole movie is created as if it were a real (though fictitious) video game. The movie has a "combat system". is organized in eight "stages", and features all kinds of re imagined classic video game elements in a mixed up frenzy of nostalgic madness. All of this is designed in the vein of the 90s era video game aesthetic.
I've been learning and practicing so much I don't think I could even cover all of the awesome things I'm doing for this movie. Its going to be a ridiculously larger scale project than the clumsily made first NASF. Bigger cast, enormous and diversely biomed world, crazy action, remastered classic VG music for the soundtrack, and the whole movie will probably be quite long. 20 minutes at the least. Pretty poor (and short) estimate though.
I'll be back soon with more stuff to show.
I do believe I am broken.
Here are some board games.


These are delicious little rolls that you can have as a side dish or as part of a buffet. Ideally, the Greek cheese anthotiro is used, but if this is unavailable, riccota can be used. Likewise, the Greek hard cheese kefalograviera is used ideally, but if this is unavailable, parmesan can be used (the Italians have a few nice cheeses as well :) ) As stated in the recipe, you should get sun-dried tomatoes that have been preserved in olive oil.
4 sun-dried tomatoes, chopped, that have been preserved in a jar of olive oil.
Saute the garlic for 2 minutes in the olive oil.
Add the chilli pepper and sauté for another minute, stirring with a wooden spoon.
Add the tomato puree, salt and pepper and simmer for approximately 30 minutes until the sauce is ready.
Sprinkle 1 tablespoon of chopped basil on top and stir well.
Remove strips of the eggplant skin, so that the eggplants have alternate 'stripes' of skin and no-skin.
Slice the eggplants lengthwise into strips of approx. ½ cm thickness.
Place them in salty water for 1 hour.
After 1 hour, remove from the water and drain well.
Fry the eggplant strips in the sunflower oil in a heavy bottomed pan.
Remove and place them on kitchen paper to drain the oil.
Mix together the anthotiro, chopped sun-dried tomatoes, half of the grated cheese, 1 tablespoon basil and the 2 tablespoons of olive oil from the tomatoes.
Mix them together well with your hands.
Place 1 teaspoonful of the mixture on top of the narrow end of one of the eggplant strips.
Roll up the eggplant strip, starting at the narrow end with the mixture.
Repeat this for all the eggplant strips.
Cover the bottom of a shallow oven dish with some of the sauce you prepared earlier and place the eggplant rolls in the dish next to each other.
Bake in a pre-heated oven at 180 degrees Celsius for 30 minutes.
I like a sauce with garlic....delicious!


text:
With More Opportunities, Colts' Rookies Stand Out Against Ravens
Intro: As their rookie seasons come to an end, several young Indianapolis Colts players put in quality performances on Saturday against the Baltimore Ravens, with standouts on offense, defense and special teams.
Ross Hollebon
Colts.com Contributor
INDIANAPOLIS — There's no time like the present.
For the Indianapolis Colts' rookies, that's certainly a saying they've been able to take to heart the last few weeks. With several starters and key backups landing on injured reserve or otherwise unavailable on gameday, it's the youngsters who are being thrown into the fire to show what they can do.
Saturday's game against the Baltimore Ravens was a prime example of several Colts rookies responding to that challenge. The Ravens, one of the hottest teams in the league, desperately needed a win to remain in the playoff hunt, and although Baltimore would escape with a 23-16 victory, many young Colts players were responsible for keeping the final outcome in doubt until the final seconds:• Inside linebacker Anthony Walker:
No play on Saturday might have been bigger than the blocked punt by Walker, who also earned his first-career start at inside linebacker, with 2:45 remaining in the fourth quarter and the Colts needing a late score on the road in rainy conditions to have a shot at tying the game.
"It was textbook of what the film called for us to do," Walker said. "Our special teams coach (Tom McMahon) put that in on Monday and was like, 'This could come open if they give us the same look we were expecting.' They gave it to us, and I was able to make a play for my teammates."
"He (Walker) went through, used great technique, got the block and gave us a chance to tie the game, go to overtime and possibly win it. It was huge," head coach Chuck Pagano explained after the game.
Walker, a fifth-round selection out of Northwestern, was credited with eight tackles, including one for loss, in place of veteran Jon Bostic, who was placed on injured reserve after suffering a knee injury against the Denver Broncos in Week 15.
"I was there to make a few plays," Walker said. "There are a couple plays I wish I could have back. It's definitely a learning experience. I'm just trying to get better each snap. I felt like I got into a rhythm more into the second half, but I'm just trying to grow as the snaps come."• Outside linebacker Tarell Basham:
Fellow rookie Tarell Basham, a third-round pick out of Ohio University, was the finisher on Walker's blocked punt, recovering the ball at the Baltimore 27-yard line to set up the Colts' final offensive opportunity on the night.
Basham also contributed two tackles and had a couple nice pressures on Ravens quarterback Joe Flacco, pushing him in and out of the pocket and utilizing his speed to reach past the right tackle and nearly earn a strip sack at one point.
Basham has earned the praise of his coaches after taking a little while to start getting adjusted to the pro game.
"The last two weeks, Tarell Basham has made a quantum leap, not only as a pass rusher but as a run player as well," defensive coordinator Ted Monachino said last Wednesday. "I think that – and I mentioned it to him yesterday – I still think this is a guy that's going to grow into a really fine football player."• Cornerbacks Kenny Moore II, Quincy Wilson and Nate Hairston:
All three rookies, each of whom started, again saw significant time on Saturday.
Moore II collected a game-high nine tackles, including one for a loss. He added on pass defensed and forced his first-career fumble on a play in which the Ravens ultimately recovered.
"It was a fight," Moore said after the game as his team dropped another close contest. "We just need to string it together and pull through at the end."
Wilson, according to Pro Football Focus, allowed just two yards on passes thrown his way against the Ravens, while adding three tackles.
Hairston, who has had a solid rookie campaign as the Colts' primary nickel cornerback, was credited with one tackle on the day, but also had a learning experience on the Ravens' eventual game-winning drive, when he was called for two key penalties.
"I played well, but I did get (two penalties)," Hairston said after the game. "I'm not sure what I did, but it is what it is. I'll take a look at it on film."• Running back Marlon Mack:
Mack, again, showed flashes of what he can do with limited touches on Saturday. He showed great burst on four rushing attempts for 17 yards and added two receptions for 37 yards.
Then, on special teams, Mack had a career-long 34-yard kickoff return to help set up the Colts' first offensive possession of the second half, which led to a 48-yard field goal by Adam Vinatieri to pull Indy within six points, 16-10.
Colts' Dallis Flowers Named To PFWA All-Rookie Team
Flowers, who led the NFL in yards per kickoff return, was named to the PFWA's All-Rookie Team as a kick returner.
Colts 2023 Head Coach Search: Full List Of Interviews, Candidates
The Colts over the last few weeks have conducted several interviews for the team's head coaching position. Here's a recap of where things stand:
Colts 2023 NFL Mock Draft Monday: Jan. 23
Mock Draft Monday, our weekly roundup of experts' predictions for who the Colts will take in the NFL Draft, is back for 2023 this week with a focus on quarterbacks, as well as a few Day 2 selections. Check it out below.
Colts Interview New York Giants Defensive Coordinator Don 'Wink' Martindale For Head Coach Position
Martindale's aggressive defense helped propel the Giants to the playoffs in 2022.
Colts Interview New York Giants Offensive Coordinator Mike Kafka For Head Coach Position
Kafka spent five seasons coaching for Andy Reid with the Kansas City Chiefs before joining the Giants in 2022.
Colts Interview Dallas Cowboys Defensive Coordinator Dan Quinn For Head Coach Position
Quinn's Cowboys defense has helped Dallas reach the playoffs in each of the last two seasons.
Colts Interview Cincinnati Bengals Offensive Coordinator Brian Callahan For Head Coach Position
The Bengals' offense, under Callahan, has ranked seventh in points per game in each of the last two seasons.
Colts Interview Green Bay Packers Special Teams Coordinator Rich Bisaccia For Head Coach Position
Bisaccia has 21 years of experience as an NFL special teams coordinator.
Colts Interview Jeff Saturday For Head Coach Position
Saturday spent the final eight games of the 2022 season as the Colts' interim head coach.
2023 Colts Schedule Tracker: Live Updates
Keep track of all updates to the 2023 NFL schedule, including early announcements, international games & more!
Colts Interview Philadelphia Eagles Offensive Coordinator Shane Steichen For Head Coach Position
Steichen guided the Eagles to the NFL's second-highest points per game average in 2022.
Colts Interview Detroit Lions Defensive Coordinator Aaron Glenn For Head Coach Position
Glenn has spent the last two seasons with the Lions after serving as the New Orleans Saints' secondary coach from 2016-2020.


text:
The Logic of Networks Commenced When? The Fascinating Heritage of Graphs
In the 14th century, Nicole Oresme to start with represented variability. He graphed the velocity of motion by making use of geometrical figures as visuals of unique versions in motions and their magnitudes. This use of geometrical figures to depict practical relations among the time and magnitude of motion marks a considerable amount of abstraction.
A paper written by Leonhard Euler on the Seven Bridges of Königsberg and released in 1741 is regarded as the first description in the historical past of graph concept. In Königsberg, Germany, a river ran through the metropolis this kind of that in its centre was an island, bs79 and soon after passing the island, the river broke into two pieces. Seven bridges were built so that the people of the city could get from 1 portion to an additional. The people today wondered regardless of whether or not a person could stroll all-around the town in a way that would entail crossing every bridge accurately as soon as.
Euler's method relating the quantity of edges, vertices, and faces of a convex polyhedron is at the origin of topology, and signifies a different phase in abstraction.
The invention of Cartesian coordinates in the 17th century by Rene Descartes revolutionized arithmetic by supplying the initial website link amongst Euclidean geometry and algebra. Using the Cartesian coordinate system, geometric shapes are explained with Cartesian equations. A Cartesian graph is a collection of points in the Cartesian plane. Each and every position in the Cartesian aircraft is an requested pair of points (x, y) on the x- and y-axes. An equation with two variables is a Cartesian graph, like these two familiar examples:
y = ax + b is a line
x^two + y^two = r^2 is a circle of radius r with a heart at the origin.
In 1929, Frigyes Karinthy released a shorter story, Chain-One-way links. The story investigated many of the difficulties that would charm to upcoming generations of mathematicians, sociologists, and physicists. In certain, Karinthy believed that the fashionable globe was shrinking for the reason that of the increasing connectedness of human beings. He posited that in spite of physical distances between persons, the escalating density of human networks created real social distance lesser.
As a outcome of this speculation, Karinthy considered that any two folks could be linked by way of at most 5 acquaintances. This has turn out to be identified as the shortest path challenge or the challenge of getting a route between two vertices these kinds of that the sum of the weights of its constituent edges is minimized.